v01d commented on pull request #1705: URL: https://github.com/apache/incubator-nuttx/pull/1705#issuecomment-687670561
After looking more closely into timer_lowerhalf_s it does not appear to be a good interface to provide the periodic + freerun interface either: it currently returns the "status" (which indicates the time remaining to the timeout) but not a free running counter. It would also be necessary to handle overflow. But the problem is actually that it would require distinguishing between a timer that is capable of freerunning from one that it is not (such as an STM32 basic timer, which is the current implementation). I think this semantic should be provided by a different interface (maybe monotonic_timer_lowerhalf_s?). This would then be a better replacement for oneshot on arch_alarm.c. An alternative path is to follow one of Xiang suggestions and expose the timer as an rtc_lowerhalf_s (using CONFIG_RTC_HIRES in this case). This is not ideal either because the timer continues to run on low power mode but **not** on system OFF (there's not battery backup domain on nRF52). Considering this lengthy discussion I think I will take this approach for nRF52. We can revisit this in the future if a new interface is added as previously mentioned. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
