stm32/mboot: Add board-configurable SysTick hook.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-06-09 12:20:42 +10:00
parent 313f082896
commit bd5152c928
3 changed files with 8 additions and 4 deletions

View File

@ -1518,9 +1518,9 @@ void SysTick_Handler(void) {
// work properly.
SysTick->CTRL;
// Update the LED0 state from here to ensure it's consistent regardless of
// Run any board-specific code that needs to be done regardless of
// other processing going on in interrupts or main.
led0_update();
MBOOT_BOARD_SYSTICK();
}
#if defined(MBOOT_I2C_SCL)

View File

@ -54,6 +54,10 @@
#define MBOOT_BOARD_STATE_CHANGE(state, arg) mboot_state_change_default((state), (arg))
#endif
#ifndef MBOOT_BOARD_SYSTICK
#define MBOOT_BOARD_SYSTICK() mboot_ui_systick()
#endif
#ifndef MBOOT_ADDRESS_SPACE_64BIT
#define MBOOT_ADDRESS_SPACE_64BIT (0)
#endif
@ -148,7 +152,7 @@ extern uint8_t _estack[ELEM_DATA_SIZE];
void systick_init(void);
void led_init(void);
void led0_update(void);
void mboot_ui_systick(void);
void SystemClock_Config(void);
uint32_t get_le32(const uint8_t *b);

View File

@ -122,7 +122,7 @@ void led0_state(led0_state_t state) {
}
}
void led0_update(void) {
void mboot_ui_systick(void) {
if (led0_cur_state != LED0_STATE_OFF && systick_ms - led0_ms_interval > 50) {
uint8_t rate = (led0_cur_state >> 2) & 0x1f;
led0_ms_interval += 50;