I'm wondering if anyone is using this library that Eric Ayars released quite some time ago. I modified it so it would compile under v1.0.x of the IDE. Everything I've tried to do with this library so far worked without a problem, from setting the clock, setting simple alarms, reading the clock, etc., etc. Till now. I've run into what seems to be a bug but I can't verify that it is a bug or not, or if the example file provided with the library has a problem.
Basically, when setting the alarms, the syntax for Alarm 1 is:Clock.setA1Time(DoW, Hour, Minute+1, Second, 0x0, true, false, false);
... and the syntax for Alarm 2 is similar except it doesn't have a "Second" variable to pass. Alarm 2 doesn't support that.
The issue here is that whatever I put in for the AlarmBits part (in the above example it's the 0x0) for Alarm 2, it seems to get overwritten by whatever the bits are for Alarm 1. In the _set example file, I changed the setA1Time() syntax to have 0b1000 as AlarmBits and setA2Time syntax to have 0b111. However when I read it back, both of them had 0b1000 in them.
I thought it was a fluke so I changed the bits only on Alarm 2 but nothing changed when I read the data back. Then I changed the bits on Alarm 1 and sure enough, reading the data back and both alarms have the same information, namely what I just changed Alarm 1 to.
So at this point I don't know where the problem sits. For one, the AlarmBits for Alarm 2 should only be 0b000 to 0b111, so why do I see 0b0000 (four digits), I don't know. And second I don't understand why it's copying whatever the bits are for Alarm 1 into Alarm 2.
I've attached the library here in the hopes that someone can look over it and figure out what may be the problem. The author doesn't seem to be responding or supporting it anymore. At least, his last posting was early last year and I haven't gotten a response from him from the messages I've sent.
DS3231.zip (9.24 KB)