Skip to content

Error in startClock method #6

@ad-johnson

Description

@ad-johnson

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions