Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Hobbyking_Cheetah_Compact Hobbyking_Cheetah_Compact_DRV8323_14bit Hobbyking_Cheetah_Compact_DRV8323_V51_201907 HKC_MiniCheetah ... more
Fork of mbed-dev by
Diff: targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/rtc_api.c
- Revision:
- 167:e84263d55307
- Parent:
- 149:156823d33999
diff -r c97ed07ec1a8 -r e84263d55307 targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/rtc_api.c
--- a/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/rtc_api.c Thu Jun 08 15:02:37 2017 +0100
+++ b/targets/TARGET_RENESAS/TARGET_VK_RZ_A1H/rtc_api.c Wed Jun 21 17:46:44 2017 +0100
@@ -25,6 +25,7 @@
#include "rtc_api.h"
#include "rtc_iodefine.h"
+#include "mbed_mktime.h"
#define RCR1_VAL_ON (0x08u) // AIE = 1
@@ -247,7 +248,7 @@
if (err == 0) {
// Convert to timestamp
- t = mktime(&timeinfo);
+ t = _rtc_mktime(&timeinfo);
} else {
// Error
t = TIME_ERROR_VAL;
@@ -337,7 +338,10 @@
*/
void rtc_write(time_t t) {
- struct tm *timeinfo = localtime(&t);
+ struct tm timeinfo;
+ if (_rtc_localtime(t, &timeinfo) == false) {
+ return;
+ }
volatile uint16_t dummy_read;
if (rtc_isenabled() != 0) {
@@ -348,12 +352,12 @@
dummy_read = (uint16_t)RTC.RCR2;
dummy_read = (uint16_t)RTC.RCR2;
- RTC.RSECCNT = rtc_hex8_to_dec(timeinfo->tm_sec);
- RTC.RMINCNT = rtc_hex8_to_dec(timeinfo->tm_min);
- RTC.RHRCNT = rtc_hex8_to_dec(timeinfo->tm_hour);
- RTC.RDAYCNT = rtc_hex8_to_dec(timeinfo->tm_mday);
- RTC.RMONCNT = rtc_hex8_to_dec(timeinfo->tm_mon + 1);
- RTC.RYRCNT = rtc_hex16_to_dec(timeinfo->tm_year + 1900);
+ RTC.RSECCNT = rtc_hex8_to_dec(timeinfo.tm_sec);
+ RTC.RMINCNT = rtc_hex8_to_dec(timeinfo.tm_min);
+ RTC.RHRCNT = rtc_hex8_to_dec(timeinfo.tm_hour);
+ RTC.RDAYCNT = rtc_hex8_to_dec(timeinfo.tm_mday);
+ RTC.RMONCNT = rtc_hex8_to_dec(timeinfo.tm_mon + 1);
+ RTC.RYRCNT = rtc_hex16_to_dec(timeinfo.tm_year + 1900);
dummy_read = (uint16_t)RTC.RYRCNT;
dummy_read = (uint16_t)RTC.RYRCNT;
