MajicDesigns / MD_DS3231

DS3231 Real Time Clock Library
GNU Lesser General Public License v2.1
30 stars 11 forks source link

Example for Interrupt based Alarm #6

Closed LRagji closed 6 years ago

LRagji commented 6 years ago

While i think this is covered in the documentation the methods and the function, if you can provide an example for the same in the example section would be great...

MajicDesigns commented 6 years ago

To be honest I have never seen the need for an interrupt based 1 second resolution, and you cannot update the time on a display from the interrupt routine anyway. A properly constructed loop() will do as good a job.

I'll put this on the list of things that could be done when I get time. Better, when you write one, post it here and I can include that in the examples.

LRagji commented 6 years ago

yeah this is like a "nice to have" can be last in your list (i realized it after i wrote the code) the documentation is super helpful apart from one line which said you cant have the I2c communication when the interrupt is enabled(normal alarm case, not one sec), but i was able to do it... did i miss read/understood it?

MajicDesigns commented 6 years ago

I2C needs interrupts to work, so I am not surprised that while the ISR is running (normally with interrupts disabled) that it would work.

LRagji commented 6 years ago

ohh got it my bad what you meant is you cant have comms from ISR, apparently i was just waking up Arduino from sleep in the ISR and in the loop communicating to reset the alarm bit (i took it as you cant have comms when INT is raised wondering how do i reset the alarm bit)