I have a rp2040 board using Earl E. Philhower core. I would like to use the rtc functions just like the one mentioned in the sdk. Especially the alarm function which is critical in my project.
Supposedly from what i know you have access to all the functions in the sdk on the arduino IDE but when i tried out the example in the sdk it would not compile saying that rtc functions are not declared
char datetime_buf[256];
char *datetime_str = &datetime_buf[0];
datetime_t t = {
.year = 2020,
.month = 06,
.day = 05,
.dotw = 5, // 0 is Sunday, so 5 is Friday
.hour = 15,
.min = 45,
.sec = 00
};
void setup() {
Serial.begin(9600);
Serial.println("Hello RTC!");
rtc_init();
rtc_set_datetime(&t);
}
// the loop function runs over and over again forever
void loop() {
rtc_get_datetime(&t);
Serial.println(datetime_str);
sleep_ms(100); // wait for a second
}
Earl E. Philhower comes with a Time sketch example but problem is i could not find a documentation if a alarm like function exist
/* Simple demonstration of setting and printing the current time */
/* The initial time will need to come from an RTC, NTP, or user */
/* Released to the public domain by Earle F. Philhower, III <earlephilhower@yahoo.com> */
#include <time.h>
#include <sys/time.h>
void setup() {
Serial.begin(115200);
delay(5000);
struct timeval tv;
tv.tv_sec = 1611198855; // Jan 21, 2021 3:14:15AM ...RPi Pico Release;
tv.tv_usec = 0;
settimeofday(&tv, nullptr);
}
void loop() {
time_t now;
char buff[80];
time(&now);
strftime(buff, sizeof(buff), "%c", localtime(&now));
Serial.println(buff);
delay(1000);
}