Skip to content

Date set bug in stm32f1xx #9

Closed
Closed
@LieBtrau

Description

@LieBtrau

Hello,

I tried the epoch example. It works fine when you run it with the given date. Replacing the epoch with a current one, i.e. 1534017459 reveals a bug.
The library refuses to set the date. Setting time works ok.

It starts to go wrong on line 444 of rtc.c:
if(IS_RTC_YEAR(year) && IS_RTC_MONTH(month) && IS_RTC_DATE(day) && IS_RTC_WEEKDAY(wday)) {

The IS_RTC_WEEKDAY(wday) doesn't return a correct value.
Diving deeper: rtc.h, line 105: #if defined(STM32F1xx) && !defined(IS_RTC_WEEKDAY). The weekdays for stm32f1xx are defined in this rtc.h, while for the other architectures this is done in the stm32(blablabla)_hal_rtc.h files. Strange...

A quick and dirty fix is adding the #defines of the weekdays in rtc.h.
`

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions