Browse Source

samd/mphalport: Add a mp_hal_ticks_ms_64() function.

Returning a 64 bit number.  This will be used by the utime module and the
machine.UART module for timeout avoiding overflow.
pull/9534/head
robert-hh 2 years ago
committed by Damien George
parent
commit
7da7663902
  1. 6
      ports/samd/mphalport.h

6
ports/samd/mphalport.h

@ -50,6 +50,10 @@ static inline mp_uint_t mp_hal_ticks_ms(void) {
return systick_ms;
}
static inline uint64_t mp_hal_ticks_ms_64(void) {
return ((uint64_t)systick_ms_upper << 32) + systick_ms;
}
static inline mp_uint_t mp_hal_ticks_us(void) {
#if defined(MCU_SAMD21)
@ -74,7 +78,7 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
}
static inline uint64_t mp_hal_time_ns(void) {
return ((uint64_t)systick_ms + (uint64_t)systick_ms_upper * 0x100000000) * 1000000;
return mp_hal_ticks_ms_64() * 1000000;
}
// C-level pin HAL

Loading…
Cancel
Save