update nrf52 hal millis
This commit is contained in:
@@ -66,6 +66,8 @@
|
|||||||
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.c" />
|
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.c" />
|
||||||
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.h" />
|
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.h" />
|
||||||
</folder>
|
</folder>
|
||||||
|
<file file_name="../../../../hw/bsp/ansi_escape.h" />
|
||||||
|
<file file_name="../../../../hw/bsp/board.h" />
|
||||||
</folder>
|
</folder>
|
||||||
<folder Name="mcu">
|
<folder Name="mcu">
|
||||||
<folder Name="nordic">
|
<folder Name="nordic">
|
||||||
|
@@ -118,7 +118,7 @@ void led_blinking_task(void)
|
|||||||
static uint32_t last_blink = 0;
|
static uint32_t last_blink = 0;
|
||||||
|
|
||||||
// not enough time
|
// not enough time
|
||||||
if ( last_blink + BLINK_INTEVAL > tusb_hal_tick_get() ) return;
|
if ( last_blink + BLINK_INTEVAL > tusb_hal_millis() ) return;
|
||||||
|
|
||||||
last_blink += BLINK_INTEVAL;
|
last_blink += BLINK_INTEVAL;
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#include "bsp/board.h"
|
||||||
#include "board_pca10056.h"
|
#include "board_pca10056.h"
|
||||||
#include "nrf_gpio.h"
|
#include "nrf_gpio.h"
|
||||||
|
|
||||||
@@ -48,11 +49,25 @@
|
|||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* VARIABLE DECLARATION
|
/* TUSB HAL MILLISECOND
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
volatile uint32_t system_ticks = 0;
|
||||||
|
|
||||||
|
void SysTick_Handler (void)
|
||||||
|
{
|
||||||
|
system_ticks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t tusb_hal_millis(void)
|
||||||
|
{
|
||||||
|
//#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ )
|
||||||
|
//return tick2ms( app_timer_cnt_get() );
|
||||||
|
|
||||||
|
return (system_ticks*1000) / BOARD_TICKS_HZ;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/* FUNCTION DECLARATION
|
/* BOARD API
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
@@ -56,13 +56,6 @@
|
|||||||
/* FUNCTION DECLARATION
|
/* FUNCTION DECLARATION
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
volatile uint32_t system_ticks = 0;
|
|
||||||
|
|
||||||
void SysTick_Handler (void)
|
|
||||||
{
|
|
||||||
system_ticks++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool tusb_hal_init(void)
|
bool tusb_hal_init(void)
|
||||||
{
|
{
|
||||||
@@ -81,12 +74,4 @@ void tusb_hal_int_disable(uint8_t rhport)
|
|||||||
NVIC_DisableIRQ(USBD_IRQn);
|
NVIC_DisableIRQ(USBD_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tusb_hal_millis(void)
|
|
||||||
{
|
|
||||||
//#define tick2ms(tck) ( ( ((uint64_t)(tck)) * 1000) / configTICK_RATE_HZ )
|
|
||||||
//return tick2ms( app_timer_cnt_get() );
|
|
||||||
|
|
||||||
return system_ticks;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user