Skip to content

Commit eb099b9

Browse files
committed
teensy: Switch from HAL_* to mp_hal_* functions.
1 parent 4a9eac2 commit eb099b9

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

teensy/modpyb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "py/obj.h"
3333
#include "py/gc.h"
3434

35-
#include "teensy_hal.h"
35+
#include MICROPY_HAL_H
3636

3737
#include "gccollect.h"
3838
#include "irq.h"
@@ -161,7 +161,7 @@ STATIC mp_obj_t pyb_millis(void) {
161161
// We want to "cast" the 32 bit unsigned into a small-int. This means
162162
// copying the MSB down 1 bit (extending the sign down), which is
163163
// equivalent to just using the MP_OBJ_NEW_SMALL_INT macro.
164-
return MP_OBJ_NEW_SMALL_INT(HAL_GetTick());
164+
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms());
165165
}
166166
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
167167

@@ -177,7 +177,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
177177
/// # Perform some operation
178178
STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
179179
uint32_t startMillis = mp_obj_get_int(start);
180-
uint32_t currMillis = HAL_GetTick();
180+
uint32_t currMillis = mp_hal_ticks_ms();
181181
return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x3fffffff);
182182
}
183183
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
@@ -218,7 +218,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
218218
STATIC mp_obj_t pyb_delay(mp_obj_t ms_in) {
219219
mp_int_t ms = mp_obj_get_int(ms_in);
220220
if (ms >= 0) {
221-
HAL_Delay(ms);
221+
mp_hal_delay_ms(ms);
222222
}
223223
return mp_const_none;
224224
}

teensy/teensy_hal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#include "Arduino.h"
88
#include MICROPY_HAL_H
99

10-
uint32_t HAL_GetTick(void) {
10+
uint32_t mp_hal_ticks_ms(void) {
1111
return millis();
1212
}
1313

14-
void HAL_Delay(uint32_t Delay) {
15-
delay(Delay);
14+
void mp_hal_delay_ms(uint32_t ms) {
15+
delay(ms);
1616
}
1717

1818
void mp_hal_set_interrupt_char(int c) {

teensy/teensy_hal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ __attribute__(( always_inline )) static inline void __WFI(void) {
112112
__asm volatile ("wfi");
113113
}
114114

115-
uint32_t HAL_GetTick(void);
116-
void HAL_Delay(uint32_t Delay);
115+
uint32_t mp_hal_ticks_ms(void);
116+
void mp_hal_delay_ms(uint32_t delay);
117117
void mp_hal_set_interrupt_char(int c);
118118

119119
void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio);

0 commit comments

Comments
 (0)