Hey Nathan,
I noticed that the am_stimer_cmpr6_isr is relied upon heavily for all timing related functions with the OpenLog Artemis. Do you envision that you’ll ultimately want to transition to using the Artemis’ built-in RTC for alarm and interrupt functionality (e.g. am_rtc_isr)?
I’ve been working on improving the RTC functionality of the Apollo3 Core for my own project requirements. While still a work in progress, the code is working extremely well. My thoughts were that the alarm functionality I’ve added could be beneficial to the OLA. The rolling alarm example would lend itself especially well to the datalogger.
Changes to the RTC library are here: https://github.com/adamgarbo/Arduino_Ap … raries/RTC
Before submitting a PR to the Apollo3 Core, I wanted to double-check whether you think these would be worthwhile additions.
Cheers,
Adam
This looks great! Thank you for creating. I welcome the PR.
A few notes:
-
For users who are just seeing the new examples for the first time it may not be clear how the setAlarm vs setAlarmMode works. Does the int fire when the minute register rolls over? Or is it related to setAlarm? Some initial comments at the top of the sketch would clarify things.
-
Can these ints be used to wake from deep sleep? I assume so. If that’s the case, please modify ex 2 to use the alarm rather than timer 6.
-
Ex 6 - why are you triggering a rolling alarm (which to my knowledge is just an alarm that you’ve moved ahead by 5 seconds), but then setting the mode (https://github.com/adamgarbo/Arduino_Ap … ms.ino#L56) to month match? What is this example trying to demonstrate?
Hi Nathan,
Thanks for the positive feedback. Please see below for my comments.
- For users who are just seeing the new examples for the first time it may not be clear how the setAlarm vs setAlarmMode works. Does the int fire when the minute register rolls over? Or is it related to setAlarm? Some initial comments at the top of the sketch would clarify things.
I agree that additional information in the examples would be extremely helpful for new users. Heck, I’m still learning my way around the Apollo3 HAL for the RTC and would put myself in that same category. I’d be happy to provide some additional insights into how the RTC functions in each example.
- Can these ints be used to wake from deep sleep? I assume so. If that’s the case, please modify ex 2 to use the alarm rather than timer 6.
Yes, am_rtc_isr() can directly replace am_stimer_cmpr6_isr(). It simply becomes a matter of managing interrupts. In fact, your Artemis Examples > Advanced > LowPower_WithWake example makes use of the am_rtc_isr() to wake from deep sleep. I think a deep sleep RTC example would also be a good idea. It could be based on the Artemis low power code in the OLA repository, which is a bit more developed.
- Ex 6 - why are you triggering a rolling alarm (which to my knowledge is just an alarm that you’ve moved ahead by 5 seconds), but then setting the mode (https://github.com/adamgarbo/Arduino_Ap … ms.ino#L56) to month match? What is this example trying to demonstrate?
Good questions!
First, the alarm mode should have been set to match every minute (6). That was a small typo. Second, the example is to demonstrate that you can have any type of rolling alarm (seconds, minutes, hours, days, months, etc.) I updated the example, which illustrates I think a bit better what I’m trying to accomplish.
https://github.com/adamgarbo/Arduino_Ap … no#L59-L67
I’ll keep working on polishing the code and welcome any additional feedback!
Cheers,
Adam