cpu/lpc2387: rtc: remove _rtc_set()
Calling localtime() adds considerable overhead. There are easier ways to set the date to 1970. For tests/periph_rtc this results in this ROM change: master: text data bss dec hex 31328 240 98064 129632 1fa60 with this patch: text data bss dec hex 20036 140 98168 118344 1ce48
This commit is contained in:
parent
b685b4d720
commit
6dbbc8f33a
@ -40,9 +40,6 @@ static rtc_alarm_cb_t _cb;
|
||||
/* Argument to alarm callback */
|
||||
static void *_cb_arg;
|
||||
|
||||
/* internal function to set time based on time_t */
|
||||
static void _rtc_set(time_t time);
|
||||
|
||||
void RTC_IRQHandler(void) __attribute__((interrupt("IRQ")));
|
||||
|
||||
void rtc_init(void)
|
||||
@ -56,10 +53,10 @@ void rtc_init(void)
|
||||
|
||||
RTC_CCR = CCR_CLKSRC; /* Clock from external 32 kHz Osc. */
|
||||
|
||||
/* initialize clock with valid unix compatible values
|
||||
* If RTC_YEAR contains an value larger unix time_t we must reset. */
|
||||
/* initialize clock with valid unix compatible values */
|
||||
if (RTC_YEAR > 2037) {
|
||||
_rtc_set(0);
|
||||
struct tm localt = { .tm_year = 70 };
|
||||
rtc_set_time(&localt);
|
||||
}
|
||||
|
||||
rtc_poweron();
|
||||
@ -201,10 +198,3 @@ void RTC_IRQHandler(void)
|
||||
|
||||
VICVectAddr = 0; /* Acknowledge Interrupt */
|
||||
}
|
||||
|
||||
static void _rtc_set(time_t time)
|
||||
{
|
||||
struct tm *localt;
|
||||
localt = localtime(&time); /* convert seconds to broken-down time */
|
||||
rtc_set_time(localt);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user