Code Monkey home page Code Monkey logo

ds3234's People

Contributors

per1234 avatar rodan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ds3234's Issues

A (minor) bug to fix

Hi, thanks for the great library.
I notice that nearly all routines for reading and writing the time follow the same process that "could" lead to invalid time/date reading. From the PDF it says the register value is copied upon CS to prevent rollover screwing with the time/date.
My suggestion is to Set CS, read/write all required registers then unset CS.
I know that it would probably be rare to be reading the time/date regs during a rollover.
But to be the best maybe a few adjustment to the code????

From the PDF ...
When reading or writing the time and date registers,
secondary (user) buffers are used to prevent errors
when the internal registers update. When reading the
time and date registers, the user buffers are synchronized
to the internal registers on the falling edge of CS
or and when the register pointer rolls over to zero. The
time information is read from these secondary registers,
while the clock continues to run. This eliminates the
need to reread the registers in case the main registers
update during a read.

ESP8266 compatibility - only reads the seconds

Have you tried it on a ESP8266?
I have it working using a bit-banged version not the inbuilt SPI library.
The seconds seem to read ok, but the subsequent reads dont get the right data.
I did have some luck by setting CS, read all 7 regs then unset CS.
Any thoughts?

1900.00.00 00:48:08
1900.00.00 00:52:13
1900.00.00 00:48:18
1900.00.00 00:52:23
1900.00.00 00:48:28
1900.00.00 00:52:33
1900.00.00 00:48:38
1900.00.00 00:52:43
1900.00.00 00:48:48
1900.00.00 00:52:53
1900.00.00 00:48:58
1900.00.00 12:53:03

Broken?

This is the output im getting off the example with 2 changes (cs set to 7 and "pinMode(10, OUTPUT);" since pin 10 has to be output for SPI for some reason...):

GET time
1917.05.20 68:24:45
1917.05.20 68:24:50
1917.05.20 68:24:55
1917.05.20 68:25:00
1917.05.20 68:25:05
1917.05.20 68:25:10
1917.05.20 68:25:15
1917.05.20 68:25:20
1917.05.20 68:25:25
1917.05.20 68:25:30
1917.05.20 68:25:35
1917.05.20 68:25:40
1917.05.20 68:25:45

Month, day and seconds seem to be right. First 2 digits of Year and first digit hour obviously not, minutes are 10 too low, so first digit.
Correct output would be eg:
2017.05.20 18:35:45 (where this is GMT and i would currently have GMT +2h here, but thats no issue since the problem exists with summer time saving anyway...

Edit:
If the time is set outside of this library I can correctly read it back with the this library - only with 1917 instead of 2017 as the year:
1917.05.20 21:39:31
1917.05.20 21:39:36
1917.05.20 21:39:41
1917.05.20 21:39:54

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.