rodan / ds3231

arduino library for DS3231 RTC

Home Page:http://www.maxim-ic.com/datasheet/index.mvp/id/4627

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

day of week

marc-gist opened this issue · comments

commented

having issues understanding day of week number, is Sunday=1 or 0, or 7?
i.e. is it Mon-Sun (1-7)?

When I set the date time, the wday seems to be ignored (from what i send in), yet when I change the date to something else in the week, it doesn't appear to update correctly.

Thanks,

excerpt from the datasheet:

"The day-of-week register increments at midnight. Values that correspond to the day of week are user-defined but must be sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on). Illogical time and date entries result in undefined operation."

so if you change the date you have to also set the wday accordingly, neither the chip nor the library will recalculate it for you.

ts.wday is not ignored by DS3231_set(). be warned tho that even if you don't define it explicitly the entire ts struct (wday included) is used to populate the chip's registers when the DS3231_set() function is called.