bug 1)
Setting second not working
in set function is
int state=rtc_bcd[MCP7940_SEC] & MCP7940_CLOCKHALT;
but because
#define MCP7940_CLOCKHALT B01111111
and state is store in highest bit
there should be
int state=rtc_bcd[MCP7940_SEC] & ~(MCP7940_CLOCKHALT);
bug 2) month bit mask
high month bitmask is only one bit, not two
#define MCP7940_HI_MTH B00110000
http://ww1.microchip.com/downloads/en/DeviceDoc/20002292B.pdf
should be
#define MCP7940_HI_MTH B00010000
bug 1)
Setting second not working
in set function is
int state=rtc_bcd[MCP7940_SEC] & MCP7940_CLOCKHALT;but because
#define MCP7940_CLOCKHALT B01111111and state is store in highest bit
there should be
int state=rtc_bcd[MCP7940_SEC] & ~(MCP7940_CLOCKHALT);bug 2) month bit mask
high month bitmask is only one bit, not two
#define MCP7940_HI_MTH B00110000http://ww1.microchip.com/downloads/en/DeviceDoc/20002292B.pdf
should be
#define MCP7940_HI_MTH B00010000