Skip to content

Commit bd5152c

Browse files
committed
stm32/mboot: Add board-configurable SysTick hook.
Signed-off-by: Damien George <damien@micropython.org>
1 parent 313f082 commit bd5152c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

ports/stm32/mboot/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,9 @@ void SysTick_Handler(void) {
15181518
// work properly.
15191519
SysTick->CTRL;
15201520

1521-
// Update the LED0 state from here to ensure it's consistent regardless of
1521+
// Run any board-specific code that needs to be done regardless of
15221522
// other processing going on in interrupts or main.
1523-
led0_update();
1523+
MBOOT_BOARD_SYSTICK();
15241524
}
15251525

15261526
#if defined(MBOOT_I2C_SCL)

ports/stm32/mboot/mboot.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
#define MBOOT_BOARD_STATE_CHANGE(state, arg) mboot_state_change_default((state), (arg))
5555
#endif
5656

57+
#ifndef MBOOT_BOARD_SYSTICK
58+
#define MBOOT_BOARD_SYSTICK() mboot_ui_systick()
59+
#endif
60+
5761
#ifndef MBOOT_ADDRESS_SPACE_64BIT
5862
#define MBOOT_ADDRESS_SPACE_64BIT (0)
5963
#endif
@@ -148,7 +152,7 @@ extern uint8_t _estack[ELEM_DATA_SIZE];
148152

149153
void systick_init(void);
150154
void led_init(void);
151-
void led0_update(void);
155+
void mboot_ui_systick(void);
152156
void SystemClock_Config(void);
153157

154158
uint32_t get_le32(const uint8_t *b);

ports/stm32/mboot/ui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void led0_state(led0_state_t state) {
122122
}
123123
}
124124

125-
void led0_update(void) {
125+
void mboot_ui_systick(void) {
126126
if (led0_cur_state != LED0_STATE_OFF && systick_ms - led0_ms_interval > 50) {
127127
uint8_t rate = (led0_cur_state >> 2) & 0x1f;
128128
led0_ms_interval += 50;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy