Git Product home page Git Product logo

rtc_sdl_mcp79400's Introduction

Raspberry Pi Python Library for MCP79400 RTC

SwitchDoc Labs, LLC July 28, 2014

Clone respository and run testMCP79400.py to test

More Information on www.switchdoc.com

See the full article about comparing RTC in the August 2014 issue of Raspberry Pi Geek magazine.

rtc_sdl_mcp79400's People

Contributors

switchdoclabs avatar

Watchers

 avatar

Forkers

casbad svalcken

rtc_sdl_mcp79400's Issues

Bit 5 in 05h month address contains Leap Year indicator so library fails during leap years.

Test SDL_MCP79400 Version 1.0 - SwitchDoc Labs
Program Started at:2016-01-02 16:35:12

Raspberry Pi= 2016-01-02 16:35:12
Traceback (most recent call last):
File "testSDL_MCP79400.py", line 51, in
print "MCP79400=\t%s" % mcp79400.read_datetime()
File "/home/data/SDL_MCP79400.py", line 141, in read_datetime
self._read_minutes(), self._read_seconds(), 0, tzinfo=tzinfo)
ValueError: month must be in 1..12

addr = 0x6f data = 0x6 6 returndata = 0x16 16
addr = 0x6f data = 0x5 5 returndata = 0x21 21 << Leap Year breaks here.
addr = 0x6f data = 0x4 4 returndata = 0x2 2
addr = 0x6f data = 0x2 2 returndata = 0x16 16
addr = 0x6f data = 0x1 1 returndata = 0x35 35
addr = 0x6f data = 0x0 0 returndata = 0xc9 129

Fix: mask bit 5
def _read_month(self):
return _bcd_to_int(self._read(self._REG_MONTH)& 0x5F)

I haven't looked at the write functions as I'm just reading the time, but there might be a similar issue there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.