mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
Correctly initialize and handle the system tick
Forgot to reload the systick timer in the irq handler
This commit is contained in:
parent
1d2a57a9e1
commit
60d03110f7
@ -67,12 +67,7 @@ void board_init(void) {
|
|||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
SysTimer_SetLoadValue(0);
|
SysTick_Config(TIMER_TICKS);
|
||||||
SysTimer_SetCompareValue(SystemCoreClock / 1000);
|
|
||||||
ECLIC_SetLevelIRQ(SysTimer_IRQn, 3);
|
|
||||||
ECLIC_SetTrigIRQ(SysTimer_IRQn, ECLIC_POSTIVE_EDGE_TRIGGER);
|
|
||||||
ECLIC_EnableIRQ(SysTimer_IRQn);
|
|
||||||
SysTimer_Start();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rcu_periph_clock_enable(RCU_GPIOA);
|
rcu_periph_clock_enable(RCU_GPIOA);
|
||||||
@ -188,7 +183,10 @@ int board_uart_write(void const* buf, int len) {
|
|||||||
|
|
||||||
#if CFG_TUSB_OS == OPT_OS_NONE
|
#if CFG_TUSB_OS == OPT_OS_NONE
|
||||||
volatile uint32_t system_ticks = 0;
|
volatile uint32_t system_ticks = 0;
|
||||||
void eclic_mtip_handler(void) { system_ticks++; }
|
void eclic_mtip_handler(void) {
|
||||||
|
system_ticks++;
|
||||||
|
SysTick_Reload(TIMER_TICKS);
|
||||||
|
}
|
||||||
uint32_t board_millis(void) { return system_ticks; }
|
uint32_t board_millis(void) { return system_ticks; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -209,7 +207,3 @@ void assert_failed(char* file, uint32_t line) {
|
|||||||
/* USER CODE END 6 */
|
/* USER CODE END 6 */
|
||||||
}
|
}
|
||||||
#endif /* USE_FULL_ASSERT */
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
// Required by __libc_init_array in startup code if we are compiling using
|
|
||||||
// -nostdlib/-nostartfiles.
|
|
||||||
// void _init(void) {}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user