Browse Source

update

master
zhaohe 1 year ago
parent
commit
195d28909c
  1. 10
      src/znordic.c

10
src/znordic.c

@ -108,10 +108,9 @@ int16_t znrf_adc_channel_read_val(uint16_t channel) {
* RTC *
*******************************************************************************/
volatile uint32_t g_timestamp = 0;
volatile uint32_t g_power_on_rtc = 0;
volatile uint32_t g_power_on_rtc = 1704038400; // 2024/01/01/00:00:00
// static uint8_t s_timeCount1second = 0;
uint32_t znordic_getpower_on_ms() {
__disable_irq();
uint32_t ret = g_timestamp * 125;
@ -152,7 +151,12 @@ void znordic_rtc_settime(uint16_t year, uint8_t month, uint8_t day, uint8_t
s_tm.tm_isdst = -1;
uint32_t nowtimestamp = mktime(&s_tm);
g_power_on_rtc = nowtimestamp - znordic_getpower_on_s();
uint32_t tosettime = nowtimestamp - znordic_getpower_on_s();
if (tosettime > 1704038400) { // 2024/01/01/00:00:00
g_power_on_rtc = tosettime;
}
return;
}
void znordic_rtc_gettime(ztm_t* now) {

Loading…
Cancel
Save