File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ static FspTimer main_timer;
22
22
const uint8_t _timer_type = AGT_TIMER;
23
23
const uint8_t _timer_index = 0 ;
24
24
inline uint8_t _timer_get_underflow_bit () { return R_AGT0->AGTCR_b .TUNDF ; }
25
+ inline uint16_t _timer_get_counter () { return R_AGT0->AGT ; }
25
26
// clock divider 8 works for the Uno R4 and Portenta C33 both because _timer_period is < 16-bit.
26
27
// on the Uno R4 the AGT clock is 24 MHz / 8 -> 3000 ticks per ms
27
28
// on the Portenta C33 the AGT clock is 50 Mhz / 8 -> 6250 ticks per ms
@@ -55,7 +56,7 @@ unsigned long micros() {
55
56
// Return time in us
56
57
NVIC_DisableIRQ (main_timer.get_cfg ()->cycle_end_irq );
57
58
uint32_t ms = agt_time_ms;
58
- uint32_t const down_counts = main_timer. get_counter ();
59
+ uint32_t const down_counts = _timer_get_counter ();
59
60
if (_timer_get_underflow_bit () && (down_counts > (_timer_period / 2 )))
60
61
{
61
62
// the counter wrapped around just before it was read
You can’t perform that action at this time.
0 commit comments