From e43b9556b0781066c0314991994611315e99b17d Mon Sep 17 00:00:00 2001 From: solosky Date: Wed, 20 Nov 2024 11:43:21 +0800 Subject: [PATCH] clear screen when load game --- fw/application/src/app/game/port/common/driver.c | 9 +++++++++ fw/application/src/app/game/port/common/driver.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fw/application/src/app/game/port/common/driver.c b/fw/application/src/app/game/port/common/driver.c index 5874647e..887b1003 100644 --- a/fw/application/src/app/game/port/common/driver.c +++ b/fw/application/src/app/game/port/common/driver.c @@ -9,6 +9,14 @@ #include "nrf_log.h" #include "nrf_log_ctrl.h" +void JOY_OLED_clear() { + JOY_OLED_data_start(0); + for (uint16_t i = 0; i < 1024; i++) { + JOY_OLED_send(0); + } + JOY_OLED_end(); +} + void JOY_OLED_end() { hal_spi_bus_release(mui_u8g2_get_spi_device()); } void JOY_OLED_write_data(uint8_t is_data, uint8_t data) { @@ -37,6 +45,7 @@ void JOY_OLED_data_start(uint8_t y) { hal_spi_bus_aquire(mui_u8g2_get_spi_device()); JOY_OLED_set_pos(0, y); } +void JOY_init() { JOY_OLED_clear(); } void JOY_idle() { app_sched_execute(); diff --git a/fw/application/src/app/game/port/common/driver.h b/fw/application/src/app/game/port/common/driver.h index a569bd0e..158ff937 100644 --- a/fw/application/src/app/game/port/common/driver.h +++ b/fw/application/src/app/game/port/common/driver.h @@ -43,7 +43,7 @@ extern "C" { // Game slow-down delay #define JOY_SLOWDOWN() DLY_ms(10) -#define JOY_init() // +//#define JOY_init() // // // Init driver // static inline void JOY_init(void) { @@ -87,6 +87,7 @@ void JOY_OLED_end() ; void JOY_sound(uint8_t freq, uint8_t dur); uint16_t JOY_random(void); +void JOY_init(void); void JOY_idle(); uint8_t JOY_exit(); long map(long x, long in_min, long in_max, long out_min, long out_max) ;