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;
2222const uint8_t _timer_type = AGT_TIMER;
2323const uint8_t _timer_index = 0 ;
2424inline uint8_t _timer_get_underflow_bit () { return R_AGT0->AGTCR_b .TUNDF ; }
25+ inline uint16_t _timer_get_counter () { return R_AGT0->AGT ; }
2526// clock divider 8 works for the Uno R4 and Portenta C33 both because _timer_period is < 16-bit.
2627// on the Uno R4 the AGT clock is 24 MHz / 8 -> 3000 ticks per ms
2728// on the Portenta C33 the AGT clock is 50 Mhz / 8 -> 6250 ticks per ms
@@ -55,7 +56,7 @@ unsigned long micros() {
5556 // Return time in us
5657 NVIC_DisableIRQ (main_timer.get_cfg ()->cycle_end_irq );
5758 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 ();
5960 if (_timer_get_underflow_bit () && (down_counts > (_timer_period / 2 )))
6061 {
6162 // the counter wrapped around just before it was read
You can’t perform that action at this time.
0 commit comments