Skip to content

Commit 1163462

Browse files
committed
nrf: Remove the old time hal and replace with nRFx
1 parent 388f554 commit 1163462

File tree

8 files changed

+13
-158
lines changed

8 files changed

+13
-158
lines changed

ports/nrf/Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ LIBS += -L $(dir $(LIBC_FILE_NAME)) -lc
9090
LIBS += -L $(dir $(LIBGCC_FILE_NAME)) -lgcc
9191

9292
SRC_HAL = $(addprefix hal/,\
93-
hal_time.c \
9493
hal_rng.c \
9594
)
9695

ports/nrf/common-hal/time/__init__.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@
2626

2727
#include "py/mphal.h"
2828

29-
#include "shared-bindings/time/__init__.h"
3029
#include "tick.h"
3130

32-
#include "nrfx_glue.h"
33-
34-
inline uint64_t common_hal_time_monotonic(void) {
31+
uint64_t common_hal_time_monotonic(void) {
3532
return ticks_ms;
3633
}
3734

3835
void common_hal_time_delay_ms(uint32_t delay) {
39-
NRFX_DELAY_US(delay);
36+
mp_hal_delay_ms(delay);
4037
}

ports/nrf/drivers/bluetooth/ble_uart.c

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <string.h>
3030
#include "ble_uart.h"
3131
#include "ringbuffer.h"
32-
#include "hal/hal_time.h"
3332
#include "lib/utils/interrupt_char.h"
3433

3534
#if MICROPY_PY_BLE_NUS

ports/nrf/hal/hal_time.c

-116
This file was deleted.

ports/nrf/hal/hal_time.h

-34
This file was deleted.

ports/nrf/modules/ubluepy/ubluepy_scanner.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
#include "py/runtime.h"
3030
#include "py/objstr.h"
3131
#include "py/objlist.h"
32+
#include "py/mphal.h"
3233

3334
#if MICROPY_PY_UBLUEPY_CENTRAL
3435

3536
#include "ble_drv.h"
36-
#include "hal_time.h"
3737

3838
STATIC void adv_event_handler(mp_obj_t self_in, uint16_t event_id, ble_drv_adv_data_t * data) {
3939
ubluepy_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);

ports/nrf/mphalport.c

+8
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,11 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) {
7272
void mp_hal_stdout_tx_str(const char *str) {
7373
mp_hal_stdout_tx_strn(str, strlen(str));
7474
}
75+
76+
void mp_hal_delay_ms(mp_uint_t ms) {
77+
NRFX_DELAY_US(ms * 1000);
78+
}
79+
80+
void mp_hal_delay_us(mp_uint_t us) {
81+
NRFX_DELAY_US(us);
82+
}

ports/nrf/mphalport.h

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static inline mp_uint_t mp_hal_ticks_ms(void) {
4848
int mp_hal_stdin_rx_chr(void);
4949
void mp_hal_stdout_tx_str(const char *str);
5050
bool mp_hal_stdin_any(void);
51+
void mp_hal_delay_ms(mp_uint_t ms);
52+
void mp_hal_delay_us(mp_uint_t us);
5153

5254
#endif
5355

0 commit comments

Comments
 (0)