diff --git a/cores/nRF5/delay.c b/cores/nRF5/delay.c index 6c6dfc85..c2b1f4e6 100644 --- a/cores/nRF5/delay.c +++ b/cores/nRF5/delay.c @@ -29,14 +29,14 @@ static volatile uint32_t overflows = 0; uint32_t millis( void ) { - uint64_t ticks = (uint64_t)((uint64_t)overflows << (uint64_t)32) | (uint64_t)(NRF_RTC1->COUNTER); + uint64_t ticks = (uint64_t)((uint64_t)overflows << (uint64_t)24) | (uint64_t)(NRF_RTC1->COUNTER); return (ticks * 1000) / 32768; } uint32_t micros( void ) { - uint64_t ticks = (uint64_t)((uint64_t)overflows << (uint64_t)32) | (uint64_t)(NRF_RTC1->COUNTER); + uint64_t ticks = (uint64_t)((uint64_t)overflows << (uint64_t)24) | (uint64_t)(NRF_RTC1->COUNTER); return (ticks * 1000000) / 32768; } diff --git a/cores/nRF5/wiring.c b/cores/nRF5/wiring.c index e9efa719..652bfd11 100644 --- a/cores/nRF5/wiring.c +++ b/cores/nRF5/wiring.c @@ -35,11 +35,11 @@ void init( void ) NRF_CLOCK->TASKS_LFCLKSTART = 1UL; NRF_RTC1->PRESCALER = 0; - NRF_RTC1->EVTENSET = offsetof(NRF_RTC_Type, EVENTS_OVRFLW); - NRF_RTC1->INTENSET = offsetof(NRF_RTC_Type, EVENTS_OVRFLW); + NRF_RTC1->EVTENSET = RTC_INTENSET_OVRFLW_Msk; + NRF_RTC1->INTENSET = RTC_EVTEN_OVRFLW_Msk; NRF_RTC1->TASKS_START = 1; } #ifdef __cplusplus } -#endif \ No newline at end of file +#endif