|
|
@ -9,6 +9,8 @@ Copyright (C) 2019 by Xose Pérez <xose dot perez at gmail dot com> |
|
|
|
#include <Ticker.h>
|
|
|
|
#include <EEPROM_Rotate.h>
|
|
|
|
|
|
|
|
#include "system.h"
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
bool _system_send_heartbeat = false; |
|
|
@ -25,33 +27,33 @@ union system_rtcmem_t { |
|
|
|
uint8_t stability_counter; |
|
|
|
uint8_t reset_reason; |
|
|
|
uint16_t _reserved_; |
|
|
|
} parts; |
|
|
|
} packed; |
|
|
|
uint32_t value; |
|
|
|
}; |
|
|
|
|
|
|
|
uint8_t systemStabilityCounter() { |
|
|
|
system_rtcmem_t data; |
|
|
|
data.value = Rtcmem->sys; |
|
|
|
return data.parts.stability_counter; |
|
|
|
return data.packed.stability_counter; |
|
|
|
} |
|
|
|
|
|
|
|
void systemStabilityCounter(uint8_t counter) { |
|
|
|
void systemStabilityCounter(uint8_t count) { |
|
|
|
system_rtcmem_t data; |
|
|
|
data.value = Rtcmem->sys; |
|
|
|
data.parts.stability_counter = counter; |
|
|
|
data.packed.stability_counter = count; |
|
|
|
Rtcmem->sys = data.value; |
|
|
|
} |
|
|
|
|
|
|
|
uint8_t _systemResetReason() { |
|
|
|
system_rtcmem_t data; |
|
|
|
data.value = Rtcmem->sys; |
|
|
|
return data.parts.reset_reason; |
|
|
|
return data.packed.reset_reason; |
|
|
|
} |
|
|
|
|
|
|
|
void _systemResetReason(uint8_t reason) { |
|
|
|
system_rtcmem_t data; |
|
|
|
data.value = Rtcmem->sys; |
|
|
|
data.parts.reset_reason = reason; |
|
|
|
data.packed.reset_reason = reason; |
|
|
|
Rtcmem->sys = data.value; |
|
|
|
} |
|
|
|
|
|
|
|