I am working with an Artemis RedBoard (DEV-15444). I am trying to use the RTC like the qwiic RTC which I believe is the 1805. I have a simple sketch that enables the countdown interrupt and then triggers every 10 seconds.
Here is my working qwiic sketch. All it does is turn the LED on and off with the countdown.
#include <Wire.h>
#include <SparkFun_RV1805.h>
// Interrupt pins
const byte intPin = 10;
RV1805 rtc; // Realtime clock
double temps[1]; // array to hold temperatures
volatile byte blinkFlag = LOW;
void setup(){
Wire.begin();
Wire.setClock(400000); // Want fast I2C speeds
Serial.begin(9600);
rtc.begin();
setupRTC(0);
// When the timer counts to 0 interupt
pinMode(intPin, INPUT);
attachInterrupt(digitalPinToInterrupt(intPin), readTemp, CHANGE);
pinMode(blinkPin, OUTPUT);
Serial.println("Setup complete");
}
void loop(){
digitalWrite(blinkPin, blinkFlag);
}
void setupRTC(byte setRTC){
Serial.println("Setting up the RTC");
rtc.clearInterrupts(); // ensure a clear state to start
if (setRTC){
Serial.println("Setting time to compiler time.");
rtc.setToCompilerTime(); // not always needed
}
rtc.setCountdownTimer(10, 0b10, true, true); // 10 Second count down
rtc.setAlarmMode(0); // Turn off the alarm
rtc.enableInterrupt(INTERRUPT_TIE); // Timer interrupt
rtc.updateTime();
String currentTime = rtc.stringTime(); //Get the time
Serial.println(currentTime);
}
void intFun(){
blinkFlag = !blinkFlag;
}
Now when I tried to convert to use the Artemis internal RTC the examples showed the RTC library. This library doesn’t seem to have interrupts nor a countdown. So I looked at the Arduino.h and found am_hal_rtc.h and am_hal_rtc.c. The HAL appears to have interrupts and an alarm. I didn’t see any documentation on which pin is the interrupt and also how to set a countdown. My question is how to use the RedBoard internal RTC with my sketch? And is there documentation for the internal RTC for the Artemis RedBoard?