From 7bab8749994442fb512ab0826f299c0d13633e48 Mon Sep 17 00:00:00 2001 From: Robert Hargreaves Date: Sun, 31 Mar 2024 21:58:41 +0100 Subject: [PATCH] Move UI and Everdrive LED scheduler hookup calls to respective init() methods --- .vscode/settings.json | 3 ++- src/everdrive_led.c | 6 ++++++ src/everdrive_led.h | 1 + src/main.c | 3 +-- src/ui.c | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index d8bb8f76..7ba75320 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -26,6 +26,7 @@ "ostream": "c", "array": "c", "utility": "c", - "everdrive_led.h": "c" + "everdrive_led.h": "c", + "comm.h": "c" } } diff --git a/src/everdrive_led.c b/src/everdrive_led.c index e0ff8025..33352b5d 100644 --- a/src/everdrive_led.c +++ b/src/everdrive_led.c @@ -1,4 +1,5 @@ #include "everdrive_led.h" +#include "scheduler.h" #include #define CTRL_LED_ON 0x1000 @@ -21,6 +22,11 @@ static void led_off(void) ledOn = false; } +void everdrive_led_init(void) +{ + scheduler_addFrameHandler(everdrive_led_tick); +} + void everdrive_led_tick(void) { if (ledOn) { diff --git a/src/everdrive_led.h b/src/everdrive_led.h index f648f9bb..7a6efa39 100644 --- a/src/everdrive_led.h +++ b/src/everdrive_led.h @@ -2,5 +2,6 @@ #include #include +void everdrive_led_init(void); void everdrive_led_blink(void); void everdrive_led_tick(void); diff --git a/src/main.c b/src/main.c index a50d5a2c..a8e7e028 100644 --- a/src/main.c +++ b/src/main.c @@ -15,8 +15,6 @@ static void registerSchedulerHandlers() { - scheduler_addFrameHandler(ui_update); - scheduler_addFrameHandler(everdrive_led_tick); scheduler_addFrameHandler(comm_megawifi_vsync); scheduler_addFrameHandler(comm_demo_vsync); } @@ -25,6 +23,7 @@ int main() { DMA_init(); scheduler_init(); + everdrive_led_init(); registerSchedulerHandlers(); log_init(); comm_init(); diff --git a/src/ui.c b/src/ui.c index fbc5c68e..b6dea243 100644 --- a/src/ui.c +++ b/src/ui.c @@ -93,6 +93,7 @@ static Sprite* activitySprites[DEV_CHANS]; void ui_init(void) { + scheduler_addFrameHandler(ui_update); SPR_init(); VDP_setBackgroundColor(BG_COLOUR_INDEX); VDP_setPaletteColor(BG_COLOUR_INDEX, RGB24_TO_VDPCOLOR(0x202020));