feat(radio): OS compatibility layer (#5840)
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
|
||||
#include "hal/usb_driver.h"
|
||||
#include "hal/rotary_encoder.h"
|
||||
#include "os/time.h"
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
#define FRAME_INTERVAL_MS 20
|
||||
|
||||
#if defined(SPI_FLASH)
|
||||
#define MAIN_MENU_LEN 3
|
||||
#else
|
||||
@@ -17,16 +20,8 @@
|
||||
#define SEL_CLEAR_FLASH_STORAGE_MENU_LEN 2
|
||||
#endif
|
||||
|
||||
volatile tmr10ms_t g_tmr10ms;
|
||||
volatile uint8_t tenms = 1;
|
||||
|
||||
void per5ms() {} // make linker happy
|
||||
|
||||
void per10ms()
|
||||
void pollInputs()
|
||||
{
|
||||
tenms |= 1u; // 10 mS has passed
|
||||
g_tmr10ms++;
|
||||
|
||||
keysPollingCycle();
|
||||
|
||||
// TODO: use rotaryEncoderPollingCycle() instead
|
||||
@@ -42,6 +37,13 @@ void per10ms()
|
||||
#endif
|
||||
}
|
||||
|
||||
// poll inputs every 10ms
|
||||
void per5ms()
|
||||
{
|
||||
static uint32_t cnt = 0;
|
||||
if (++cnt & 1) { pollInputs(); }
|
||||
}
|
||||
|
||||
FlashCheckRes valid;
|
||||
|
||||
int menuFlashFile(uint32_t index, event_t event)
|
||||
@@ -74,10 +76,12 @@ void bootloaderMenu()
|
||||
|
||||
sdInit();
|
||||
|
||||
uint32_t next_frame = time_get_ms();
|
||||
|
||||
for (;;) {
|
||||
|
||||
if (tenms) {
|
||||
tenms = 0;
|
||||
if (time_get_ms() - next_frame >= FRAME_INTERVAL_MS) {
|
||||
next_frame += FRAME_INTERVAL_MS;
|
||||
|
||||
if (state != ST_USB && state != ST_FLASHING
|
||||
&& state != ST_FLASH_DONE && state != ST_RADIO_MENU) {
|
||||
|
||||
Reference in New Issue
Block a user