Supplement the lack of "extended RTC" in RZ_A1H/rtc_api.c

Although the extened RTC is supported by #5363 commit ("Add support and tests for extended RTC"), it seems that the changes was overlooked in RZ_A1H_api.c.
So I added the changes with reference to other rtc_api.c.
pull/5767/head
TomoYamanaka 2017-12-14 20:30:45 +09:00 committed by adbridge
parent c29772a899
commit 67781c25c1
1 changed files with 5 additions and 3 deletions

View File

@ -48,7 +48,7 @@
#define SHIFT_1BYTE (8u) #define SHIFT_1BYTE (8u)
#define SHIFT_2BYTE (16u) #define SHIFT_2BYTE (16u)
#define TIME_ERROR_VAL (0xFFFFFFFFu) #define TIME_ERROR_VAL (0u)
static int rtc_dec8_to_hex(uint8_t dec_val, uint8_t offset, int *hex_val); static int rtc_dec8_to_hex(uint8_t dec_val, uint8_t offset, int *hex_val);
static int rtc_dec16_to_hex(uint16_t dec_val, uint16_t offset, int *hex_val); static int rtc_dec16_to_hex(uint16_t dec_val, uint16_t offset, int *hex_val);
@ -214,7 +214,9 @@ time_t rtc_read(void) {
if (err == 0) { if (err == 0) {
// Convert to timestamp // Convert to timestamp
t = _rtc_mktime(&timeinfo); if (_rtc_maketime(&timeinfo, &t, RTC_FULL_LEAP_YEAR_SUPPORT) == false) {
return TIME_ERROR_VAL;
}
} else { } else {
// Error // Error
t = TIME_ERROR_VAL; t = TIME_ERROR_VAL;
@ -305,7 +307,7 @@ static int rtc_dec16_to_hex(uint16_t dec_val, uint16_t offset, int *hex_val) {
void rtc_write(time_t t) { void rtc_write(time_t t) {
struct tm timeinfo; struct tm timeinfo;
if (_rtc_localtime(t, &timeinfo) == false) { if (_rtc_localtime(t, &timeinfo, RTC_FULL_LEAP_YEAR_SUPPORT) == false) {
return; return;
} }
volatile uint16_t dummy_read; volatile uint16_t dummy_read;