Commit eb099b98 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

teensy: Switch from HAL_* to mp_hal_* functions.

parent 4a9eac20
......@@ -32,7 +32,7 @@
#include "py/obj.h"
#include "py/gc.h"
#include "teensy_hal.h"
#include MICROPY_HAL_H
#include "gccollect.h"
#include "irq.h"
......@@ -161,7 +161,7 @@ STATIC mp_obj_t pyb_millis(void) {
// We want to "cast" the 32 bit unsigned into a small-int. This means
// copying the MSB down 1 bit (extending the sign down), which is
// equivalent to just using the MP_OBJ_NEW_SMALL_INT macro.
return MP_OBJ_NEW_SMALL_INT(HAL_GetTick());
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms());
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
......@@ -177,7 +177,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
/// # Perform some operation
STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
uint32_t startMillis = mp_obj_get_int(start);
uint32_t currMillis = HAL_GetTick();
uint32_t currMillis = mp_hal_ticks_ms();
return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x3fffffff);
}
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);
STATIC mp_obj_t pyb_delay(mp_obj_t ms_in) {
mp_int_t ms = mp_obj_get_int(ms_in);
if (ms >= 0) {
HAL_Delay(ms);
mp_hal_delay_ms(ms);
}
return mp_const_none;
}
......
......@@ -7,12 +7,12 @@
#include "Arduino.h"
#include MICROPY_HAL_H
uint32_t HAL_GetTick(void) {
uint32_t mp_hal_ticks_ms(void) {
return millis();
}
void HAL_Delay(uint32_t Delay) {
delay(Delay);
void mp_hal_delay_ms(uint32_t ms) {
delay(ms);
}
void mp_hal_set_interrupt_char(int c) {
......
......@@ -112,8 +112,8 @@ __attribute__(( always_inline )) static inline void __WFI(void) {
__asm volatile ("wfi");
}
uint32_t HAL_GetTick(void);
void HAL_Delay(uint32_t Delay);
uint32_t mp_hal_ticks_ms(void);
void mp_hal_delay_ms(uint32_t delay);
void mp_hal_set_interrupt_char(int c);
void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment