elpaso / Rtc_Pcf8563

Arduino Pcf8563 RTC library. A fixed/expanded version of the original Rtc_Pcf8563
29 stars 29 forks source link

setTimer won't work well as expected #19

Open llinjupt opened 3 years ago

llinjupt commented 3 years ago

void Rtc_Pcf8563::setTimer(byte value, byte frequency, bool is_pulsed) { getDateTime(); if (is_pulsed) status2 |= is_pulsed << 4; else status2 &= ~(is_pulsed << 4);

Look at this line above, if is_pulsed is false, status2 will be set as 0xff. I am pretty sure it is a bug. Code below works well just for reference:

void Rtc_Pcf8563::setTimer(byte value, Pcf8563TimerSrc_t freqType, bool is_pulsed) { getDateTime();

if(is_pulsed) status2 |= 0x01 << 4; else status2 &= ~(0x01 << 4); ......

elpaso commented 3 years ago

Thanks, feel free to open a PR and submit a patch. Honestly I'm not using this code anymore but I'm happy to accept patches.