mirror of https://github.com/ARMmbed/mbed-os.git
switching timestamp_t back to 32-bits.
The underlying us_tickers used for comparison are still 32-bits; keeping a 64-bit timestamp isn't going to be useful. fixes #838pull/839/head
parent
3ec2247713
commit
c18633dcf2
|
@ -22,7 +22,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef uint64_t timestamp_t;
|
typedef uint32_t timestamp_t;
|
||||||
|
|
||||||
uint32_t us_ticker_read(void);
|
uint32_t us_ticker_read(void);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ uint32_t us_ticker_read()
|
||||||
us_ticker_init();
|
us_ticker_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp_t value;
|
uint64_t value;
|
||||||
app_timer_cnt_get(&value); /* This returns the RTC counter (which is fed by the 32khz crystal clock source) */
|
app_timer_cnt_get(&value); /* This returns the RTC counter (which is fed by the 32khz crystal clock source) */
|
||||||
return ((value * 1000000) / (uint32_t)APP_TIMER_CLOCK_FREQ); /* Return a pseudo microsecond counter value.
|
return ((value * 1000000) / (uint32_t)APP_TIMER_CLOCK_FREQ); /* Return a pseudo microsecond counter value.
|
||||||
* This is only as precise as the 32khz low-freq
|
* This is only as precise as the 32khz low-freq
|
||||||
|
@ -72,7 +72,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp_t currentCounter64;
|
uint64_t currentCounter64;
|
||||||
app_timer_cnt_get(¤tCounter64);
|
app_timer_cnt_get(¤tCounter64);
|
||||||
uint32_t currentCounter = currentCounter64 & MAX_RTC_COUNTER_VAL;
|
uint32_t currentCounter = currentCounter64 & MAX_RTC_COUNTER_VAL;
|
||||||
uint32_t targetCounter = ((uint32_t)((timestamp * (uint64_t)APP_TIMER_CLOCK_FREQ) / 1000000) + 1) & MAX_RTC_COUNTER_VAL;
|
uint32_t targetCounter = ((uint32_t)((timestamp * (uint64_t)APP_TIMER_CLOCK_FREQ) / 1000000) + 1) & MAX_RTC_COUNTER_VAL;
|
||||||
|
|
Loading…
Reference in New Issue