more stats output

This commit is contained in:
2020-11-20 12:32:00 +01:00
parent 206e371d48
commit b1fdc04366
3 changed files with 26 additions and 11 deletions

View File

@@ -35,18 +35,15 @@ typedef union {
static const uint16_t EEPROM_HEADER_ADDR = 0;
static t_eepromHeader eepromHeader;
typedef union {
struct __attribute__((__packed__)) s_deviceStats {
uint32_t totalRunningHours;
uint32_t totalPowercycles;
uint32_t totalRequests;
uint32_t totalFailures;
} s;
uint8_t b[sizeof(struct s_deviceStats)];
} t_deviceStats;
t_deviceStats s;
uint8_t b[sizeof(t_deviceStats)];
} t_deviceStatsBlock;
static const uint16_t DEVICE_STATS_ADDR = 32;
static t_deviceStats deviceStats;
static t_deviceStatsBlock deviceStats;
static const uint8_t NUM_OF_BLOCKS = 2;
static const uint16_t BLOCK_ADDR[] = { 64, 4128 };
@@ -62,6 +59,9 @@ typedef union {
} t_spiMsg;
t_deviceStats* getGlobalDeviceStats() {
return &(deviceStats.s);
}
inline static void __EEPROM_CS(GPIO_PinState v) {
HAL_GPIO_WritePin(EEPROM_CS_GPIO_Port, EEPROM_CS_Pin, v);