mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Diff: targets/TARGET_RENESAS/TARGET_RZ_A1XX/rtc_api.c
- Revision:
- 184:08ed48f1de7f
- Parent:
- 181:57724642e740
- Child:
- 186:707f6e361f3e
--- a/targets/TARGET_RENESAS/TARGET_RZ_A1XX/rtc_api.c Tue Mar 20 17:01:51 2018 +0000 +++ b/targets/TARGET_RENESAS/TARGET_RZ_A1XX/rtc_api.c Thu Apr 19 17:12:19 2018 +0100 @@ -66,7 +66,7 @@ #define SHIFT_1BYTE (8u) #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_dec16_to_hex(uint16_t dec_val, uint16_t offset, int *hex_val); @@ -246,7 +246,9 @@ if (err == 0) { // Convert to timestamp - t = _rtc_mktime(&timeinfo); + if (_rtc_maketime(&timeinfo, &t, RTC_FULL_LEAP_YEAR_SUPPORT) == false) { + return TIME_ERROR_VAL; + } } else { // Error t = TIME_ERROR_VAL; @@ -337,9 +339,10 @@ void rtc_write(time_t t) { struct tm timeinfo; - if (_rtc_localtime(t, &timeinfo) == false) { + if (_rtc_localtime(t, &timeinfo, RTC_FULL_LEAP_YEAR_SUPPORT) == false) { return; } + volatile uint16_t dummy_read; if (rtc_isenabled() != 0) {