rename tusb_tick_get to hal_tick_get
This commit is contained in:
@@ -65,7 +65,6 @@ int main(void)
|
|||||||
tusb_init();
|
tusb_init();
|
||||||
|
|
||||||
//------------- application task init -------------//
|
//------------- application task init -------------//
|
||||||
led_blinking_init();
|
|
||||||
cdc_serial_app_init();
|
cdc_serial_app_init();
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
@@ -92,6 +91,25 @@ void tud_umount_cb(uint8_t coreid)
|
|||||||
cdc_serial_app_umount(coreid);
|
cdc_serial_app_umount(coreid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// BLINKING TASK
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
void led_blinking_task(void)
|
||||||
|
{
|
||||||
|
enum { BLINK_INTEVAL = 1000 };
|
||||||
|
|
||||||
|
static uint32_t led_on_mask = 0;
|
||||||
|
static uint32_t last_blink = 0;
|
||||||
|
|
||||||
|
// not enough time
|
||||||
|
if ( last_blink + BLINK_INTEVAL > hal_tick_get() ) return;
|
||||||
|
|
||||||
|
last_blink += BLINK_INTEVAL;
|
||||||
|
|
||||||
|
board_leds(led_on_mask, 1 - led_on_mask);
|
||||||
|
led_on_mask = 1 - led_on_mask; // toggle
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// HELPER FUNCTION
|
// HELPER FUNCTION
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@@ -48,14 +48,14 @@ void SysTick_Handler (void)
|
|||||||
system_ticks++;
|
system_ticks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tusb_tick_get(void)
|
uint32_t hal_tick_get(void)
|
||||||
{
|
{
|
||||||
return system_ticks;
|
return system_ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// BLINKING TASK
|
// BLINKING TASK
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@@ -154,6 +154,7 @@ void board_uart_putchar(uint8_t c);
|
|||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
#if 0
|
||||||
//------------- Board Application -------------//
|
//------------- Board Application -------------//
|
||||||
void led_blinking_task(void* param);
|
void led_blinking_task(void* param);
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ void led_blinking_init(void);
|
|||||||
* \param[in] ms The interval between on and off.
|
* \param[in] ms The interval between on and off.
|
||||||
*/
|
*/
|
||||||
void led_blinking_set_interval(uint32_t ms);
|
void led_blinking_set_interval(uint32_t ms);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -53,8 +53,8 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// TICK API
|
// TICK API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
uint32_t tusb_tick_get(void);
|
uint32_t hal_tick_get(void);
|
||||||
#define osal_tick_get tusb_tick_get
|
#define osal_tick_get hal_tick_get
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// TASK API
|
// TASK API
|
||||||
|
Reference in New Issue
Block a user