casaroli opened a new pull request, #20490:
URL: https://github.com/apache/nuttx/pull/20490

   ## Summary
   
   The RP2350 RTC driver (`rp23xx_rtc.c`, on the POWMAN always-on timer) 
implemented only `up_rtc_initialize()`, `up_rtc_time()` and `up_rtc_settime()`. 
The timer also has an alarm comparator. This PR adds the alarm and an RTC lower 
half, so the timer is `/dev/rtc0` with alarm support (`CONFIG_RTC_DRIVER`, 
`CONFIG_RTC_ALARM`), registered by the common rp23xx board bringup.
   
   The comparator asserts while the time is past the alarm time, not on a 
transition, so the interrupt handler disables the alarm before anything else. 
The arming sequence is the one of `powman_timer_enable_alarm_at_ms()` in the 
Pico SDK.
   
   The first commit fixes the older nxstyle errors in `rp23xx_common_bringup.c` 
(the indentation of a block), because CI checks the whole file. It is 
whitespace only: `git diff -w` is empty.
   
   ## Impact
   
   rp23xx boards with `CONFIG_RP23XX_RTC` and `CONFIG_RTC_DRIVER`. Without 
`CONFIG_RTC_DRIVER` nothing changes.
   
   ## Testing
   
   Arm GNU Toolchain 13.2.rel1 (the CI version). Each commit builds; 
`pimoroni-pico-plus-2-w:nsh` builds with RTC only, with the RTC driver, and 
with the driver and the alarm, with no new warnings. `tools/checkpatch.sh -c -u 
-m -g` passes.
   
   On a Pimoroni Pico Plus 2 W with `CONFIG_RP23XX_RTC`, `CONFIG_RTC_DRIVER`, 
`CONFIG_RTC_ALARM` and `examples/alarm`:
   
   ```
   nsh> alarm -r
   Alarm 0 is inactive with -7 seconds to expiration
   nsh> date -s "Oct 07 19:00:00 2026"
   nsh> alarm 5
   Alarm 0 set in 5 seconds
   nsh> alarm -r
   Alarm 0 is active with 5 seconds to expiration
   nsh> sleep 7
   alarm_daemon: alarm 0 received
   nsh> date
   Wed, Oct 07 19:00:07 2026
   nsh> alarm 10
   Alarm 0 set in 10 seconds
   nsh> alarm -c
   Alarm 0 has been canceled
   nsh> sleep 12
   nsh> date
   Wed, Oct 07 19:00:19 2026
   ```
   
   The canceled alarm does not fire.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to