diff options
| author | hathach <[email protected]> | 2018-11-14 15:25:58 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-11-14 15:25:58 +0700 |
| commit | ee399bd27b7f9fd92abea3f98ec2c59a714d3c9b (patch) | |
| tree | 3571491803b033b7da5b715840dec2da928823f2 /hw | |
| parent | 0c8e62388137b6658449e90edec5e582dcf7bd83 (diff) | |
add sand51 project to ses
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/bsp/metro_m4_express/board_metro_m4_express.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/bsp/metro_m4_express/board_metro_m4_express.c b/hw/bsp/metro_m4_express/board_metro_m4_express.c index 78a72327c..a4af9cec3 100644 --- a/hw/bsp/metro_m4_express/board_metro_m4_express.c +++ b/hw/bsp/metro_m4_express/board_metro_m4_express.c @@ -48,6 +48,11 @@ void board_init(void) { gpio_set_pin_direction(BOARD_LED0, GPIO_DIRECTION_OUT); gpio_set_pin_level(BOARD_LED0, 1-LED_STATE_ON); + +#if CFG_TUSB_OS == OPT_OS_NONE + // Tick init + SysTick_Config(SystemCoreClock/1000); +#endif } void board_led_control(uint32_t led_id, bool state) @@ -55,3 +60,20 @@ void board_led_control(uint32_t led_id, bool state) gpio_set_pin_level(led_id, state ? LED_STATE_ON : (1-LED_STATE_ON)); } + +/*------------------------------------------------------------------*/ +/* TUSB HAL MILLISECOND + *------------------------------------------------------------------*/ +#if CFG_TUSB_OS == OPT_OS_NONE +volatile uint32_t system_ticks = 0; + +void SysTick_Handler (void) +{ + system_ticks++; +} + +uint32_t tusb_hal_millis(void) +{ + return board_tick2ms(system_ticks); +} +#endif
\ No newline at end of file |
