I'm using alarms successfully, but now there are times when I need to turn them off. Here's a little info:
/* control register 0Eh/8Eh
bit7 EOSC Enable Oscillator (1 if oscillator must be stopped when on battery)
bit6 BBSQW Battery Backed Square Wave
bit5 CONV Convert temperature (1 forces a conversion NOW)
bit4 RS2 Rate select - frequency of square wave output
bit3 RS1 Rate select
bit2 INTCN Interrupt control (1 for use of the alarms and to disable square wave)
bit1 A2IE Alarm2 interrupt enable (1 to enable)
bit0 A1IE Alarm1 interrupt enable (1 to enable)
*/
I'd need a copy of whatever library you are using or at least the implementation of the DS3234_set_creg command to tell you. I don't know if using that function with 0's will work or if there is another clear_creg function to clear bits.
On the same topic regarding my lack of bit knowledge, I just ran into another condition I've never had before. I need to activate alarm 2, but also keep alarm 1 in whatever state it is- whether or not it's activated or not activated. Is this possible?
OK, so set_creg just sets the creg to whatever bit pattern you give it. If you want to turn everything off, and you don't need any bits in the creg set, then you can just set it to 0.
If you only want to turn off one bit in the creg, then you'll have to get the creg first so you can se tit back like it was. Unfortunately, they don't seem to have included any function for doing that.
No it would set INTCN flag to 1 (square wave interrupt disabled and alarms interrupt enabled if at least one alarm is also enabled), so as you don't set the A1IE and A2IE flags, the alarms are disabled.
Yes it's weird that there isn't a DS3234_get_creg function. Here is one, should work: