Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in startClock method #6

Open
ad-johnson opened this issue Feb 28, 2021 · 0 comments
Open

Error in startClock method #6

ad-johnson opened this issue Feb 28, 2021 · 0 comments

Comments

@ad-johnson
Copy link

ad-johnson commented Feb 28, 2021

In this method, the intention is to only write back to the RTCC if the register value has changed or it wasn't read from the device in the first place (i.e. a bcdsecs value was passed in):

// Write back the data if it is different to the contents of the
// register.  Always write back if the data wasn't fetched with
// readData as the contents of the stop bit are unknown.
if (s != s2 || bcdSec < 0)
	writeData(reg, s2);

This code looks like it will write back IF the register has changed OR it was read from the device. So basically, every time. I think it should be:
// Write back the data if it is different to the contents of the
// register. Always write back if the data wasn't fetched with
// readData as the contents of the stop bit are unknown.
if (s != s2 || bcdSec >= 0)
writeData(reg, s2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant