AB1805_RK
|
Library for AB1805/AM1805 RTC/Watchdog for Particle devices
This is just the minimal implement of using the RTC and Watchdog Timer (WDT). Here's the complete code:
Things to note in this code:
Declare an AB1805
object in your code as a global variable. Only do this once in your main source file. The parameter is the I2C interface the AB1805 is connected to, typically Wire
(D0/D1).
In setup(), call the ab1805.setup()
method.
Reset the settings on the AB1805. This isn't strictly necessary since it resets the chip to power-on defaults, but it's not a bad idea to be safe:
If you want to use the hardware watchdog, enable it:
And from loop(), make sure you call the loop method:
The ab1805.loop()
method takes care of:
The "typical" example adds in a few helpful features:
This example has the device wake up once per hour and publish a value. It illustrates:
The self-test code is used to do a quick check of the hardware to make sure it's visible by I2C. It's helpful when you've soldered up a new board to make sure the AB1805 at least has working I2C communications.
This is the hardware test suite that allows various modes to be tested via commands from the cloud.
This is an example of using a board with a super capacitor.
This is the deep power down example that uses a LiPo powered RTC to a deep power down, not using a supercap.