summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-29 18:10:01 +0700
committerhathach <[email protected]>2018-03-29 18:10:01 +0700
commit97db3c7c3d7cfbbb19dbda09809aa39bb19608b9 (patch)
treed7a1461e5c658e7ccc59f71891ccc4ab8cdcc639
parente2f97443694c5f8ffd4657055a4caaffab153f2c (diff)
update nrf52 hal millis
-rw-r--r--examples/device/nrf52840/segger/nrf52840.emProject2
-rw-r--r--examples/device/nrf52840/src/main.c2
-rw-r--r--hw/bsp/pca10056/board_pca10056.c19
-rw-r--r--tinyusb/portable/nordic/nrf5x/hal_nrf5x.c15
4 files changed, 20 insertions, 18 deletions
diff --git a/examples/device/nrf52840/segger/nrf52840.emProject b/examples/device/nrf52840/segger/nrf52840.emProject
index 4f29a8188..4433744cc 100644
--- a/examples/device/nrf52840/segger/nrf52840.emProject
+++ b/examples/device/nrf52840/segger/nrf52840.emProject
@@ -66,6 +66,8 @@
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.c" />
<file file_name="../../../../hw/bsp/pca10056/board_pca10056.h" />
</folder>
+ <file file_name="../../../../hw/bsp/ansi_escape.h" />
+ <file file_name="../../../../hw/bsp/board.h" />
</folder>
<folder Name="mcu">
<folder Name="nordic">
diff --git a/examples/device/nrf52840/src/main.c b/examples/device/nrf52840/src/main.c
index 44e0b3ebf..203cd3f18 100644
--- a/examples/device/nrf52840/src/main.c
+++ b/examples/device/nrf52840/src/main.c
@@ -118,7 +118,7 @@ void led_blinking_task(void)
static uint32_t last_blink = 0;
// 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;
diff --git a/hw/bsp/pca10056/board_pca10056.c b/hw/bsp/pca10056/board_pca10056.c
index 77293cf6e..98071429b 100644
--- a/hw/bsp/pca10056/board_pca10056.c
+++ b/hw/bsp/pca10056/board_pca10056.c
@@ -34,6 +34,7 @@
*/
/**************************************************************************/
+#include "bsp/board.h"
#include "board_pca10056.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)
{
diff --git a/tinyusb/portable/nordic/nrf5x/hal_nrf5x.c b/tinyusb/portable/nordic/nrf5x/hal_nrf5x.c
index 4cb7f076e..e3d27e556 100644
--- a/tinyusb/portable/nordic/nrf5x/hal_nrf5x.c
+++ b/tinyusb/portable/nordic/nrf5x/hal_nrf5x.c
@@ -56,13 +56,6 @@
/* FUNCTION DECLARATION
*------------------------------------------------------------------*/
-volatile uint32_t system_ticks = 0;
-
-void SysTick_Handler (void)
-{
- system_ticks++;
-}
-
bool tusb_hal_init(void)
{
@@ -81,12 +74,4 @@ void tusb_hal_int_disable(uint8_t rhport)
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