#include "Driver.h" #include "Tetris.h" #include "Snake.h" #include "Menu.h" /* Controls: - menu up, down -> select in menu when on page select -> right, left to select page when not on page select -> right to start - tetris not in game: up to start and to finish lost game down to exit when starting in game: up - rotate right down - piece place left, right - move left, right */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wmissing-declarations" #pragma GCC diagnostic ignored "-Wreturn-type" void SysTick_Handler(void) asm("SysTick_Handler"); void SysTick_Handler(void) { driver_sys_tick(); } void EXTI9_5_IRQHandler(void) asm("EXTI9_5_IRQHandler"); void EXTI9_5_IRQHandler(void) { uint32_t pending = EXTI->PR; if (pending & (1 << 5)) driver_keyboard_irq(5); if (pending & (1 << 6)) driver_keyboard_irq(6); if (pending & (1 << 8)) driver_keyboard_irq(8); if (pending & (1 << 9)) driver_keyboard_irq(9); if (EXTI_GetITStatus(EXTI_Line5) != RESET) EXTI_ClearITPendingBit(EXTI_Line5); if (EXTI_GetITStatus(EXTI_Line6) != RESET) EXTI_ClearITPendingBit(EXTI_Line6); if (EXTI_GetITStatus(EXTI_Line8) != RESET) EXTI_ClearITPendingBit(EXTI_Line8); if (EXTI_GetITStatus(EXTI_Line9) != RESET) EXTI_ClearITPendingBit(EXTI_Line9); } int main(int argc, char* argv[]) { (void)argc; (void)argv; driver_init(); menu_init(); game_entry_t tetris_entry = { .ico = { {0, 1, 0, 0}, {0, 1, 1, 0}, {0, 1, 0, 0}, }, .init_fn = tetris_init, .update_fn = tetris_update, }; game_entry_t snake_entry = { .ico = { {1, 1, 1, 1}, {1, 0, 0, 0}, {1, 1, 0, 1}, }, .init_fn = snake_init, .update_fn = snake_update, }; menu_add_game(tetris_entry); menu_add_game(snake_entry); while (1) { menu_update(); driver_delay(100); } }