|
| 1 | +https://forums.raspberrypi.com/viewtopic.php?t=380678 |
| 2 | +hello_rtc example doesn't compile on Pico 2 W |
| 3 | + |
| 4 | + Quote |
| 5 | + |
| 6 | +Sun Dec 08, 2024 3:55 pm |
| 7 | +I would like to run the hello_rtc example on Pico 2 W. |
| 8 | + |
| 9 | +I am using Visual Studio code (1.95.3) and Raspberry Pi Pico extension (0.17.2) and I have updated the CMakeLists.txt as follows |
| 10 | + |
| 11 | + |
| 12 | +Re: hello_rtc example doesn't compile on Pico 2 W |
| 13 | + |
| 14 | + Quote |
| 15 | + |
| 16 | +Sun Dec 08, 2024 9:54 pm |
| 17 | +RTC was replaced with "POWMAN timer" on RP2350 (See https://www.raspberrypi.com/documentati ... are_powman) |
| 18 | + |
| 19 | +There is a common API for RTC and POWMAN timer (though beware use of time conversion functions) here: https://www.raspberrypi.com/documentati ... _aon_timer (although there were a lot of new APIs added in 2.1.0 and the online docs still seem to be for 2.0.0, so you may want to look at the header) |
| 20 | + |
| 21 | +https://www.raspberrypi.com/documentation/pico-sdk/high_level.html#group_pico_aon_timer |
| 22 | + |
| 23 | +pico_aon_timer |
| 24 | + |
| 25 | +High Level "Always on Timer" Abstraction. |
| 26 | +Detailed Description |
| 27 | + |
| 28 | +This library uses the RTC on RP2040. This library uses the Powman Timer on RP2350. |
| 29 | + |
| 30 | +This library supports both aon_timer_xxx_calendar() methods which use a calendar date/time (as struct tm), and aon_timer_xxx() methods which use a linear time value relative an internal reference time (via struct timespec). |
| 31 | + |
| 32 | +On RP2040 the non 'calendar date/time' methods must convert the linear time value to a calendar date/time internally; these methods are: |
| 33 | + |
| 34 | + aon_timer_start_with_timeofday |
| 35 | + |
| 36 | + aon_timer_start |
| 37 | + |
| 38 | + aon_timer_set_time |
| 39 | + |
| 40 | + aon_timer_get_time |
| 41 | + |
| 42 | + aon_timer_enable_alarm |
| 43 | + |
| 44 | +This conversion is handled by the pico_localtime_r method. By default, this pulls in the C library local_time_r method which can lead to a big increase in binary size. The default implementation of pico_localtime_r is weak, so it can be overridden if a better/smaller alternative is available, otherwise you might consider the method variants ending in _calendar() instead on RP2040. |
| 45 | + |
| 46 | +On RP2350 the 'calendar date/time' methods must convert the calendar date/time to a linear time value internally; these methods are: |
| 47 | + |
| 48 | + aon_timer_start_calendar |
| 49 | + |
| 50 | + aon_timer_set_time_calendar |
| 51 | + |
| 52 | + aon_timer_get_time_calendar |
| 53 | + |
| 54 | + aon_timer_enable_alarm_calendar |
| 55 | + |
| 56 | +This conversion is handled by the pico_mktime method. By default, this pulls in the C library mktime method which can lead to a big increase in binary size. The default implementation of pico_mktime is weak, so it can be overridden if a better/smaller alternative is available, otherwise you might consider the method variants not ending in _calendar() instead on RP2350. |
0 commit comments