configuration
This commit is contained in:
@ -48,6 +48,8 @@ static t_deviceStatsBlock deviceStats;
|
||||
static const uint8_t NUM_OF_BLOCKS = 2;
|
||||
static const uint16_t BLOCK_ADDR[] = { 64, 4128 };
|
||||
|
||||
static const uint8_t EEPROM_WRITE_BLOCK_SIZE = 32;
|
||||
|
||||
|
||||
typedef union {
|
||||
struct __attribute__((__packed__)) s_spiMsg {
|
||||
@ -58,7 +60,6 @@ typedef union {
|
||||
uint8_t b[sizeof(struct s_spiMsg)];
|
||||
} t_spiMsg;
|
||||
|
||||
|
||||
t_deviceStats* getGlobalDeviceStats() {
|
||||
return &(deviceStats.s);
|
||||
}
|
||||
@ -126,6 +127,15 @@ static void eepromHourlyUpdateDeviceStats(void *handle) {
|
||||
eepromWrite(DEVICE_STATS_ADDR, deviceStats.b, sizeof(deviceStats));
|
||||
}
|
||||
|
||||
void eepromReadConfigBlock(uint8_t blockNum, t_configBlock *destConfigBlock) {
|
||||
uint8_t configBlockSizeMod = sizeof(*destConfigBlock) % EEPROM_WRITE_BLOCK_SIZE;
|
||||
if (configBlockSizeMod != 0) {
|
||||
coloredMsg(LOG_RED, false, "eeRCB, config block size must be dividable by 32");
|
||||
coloredMsg(LOG_RED, false, "eeRCB, current size is %d", sizeof(*destConfigBlock));
|
||||
coloredMsg(LOG_RED, false, "eeRCB, append %d filler octets", configBlockSizeMod);
|
||||
}
|
||||
}
|
||||
|
||||
// active waiting, use only during initialization!
|
||||
static void eepromActiveDelay(uint8_t delay_ms) {
|
||||
activeDelay(delay_ms);
|
||||
|
Reference in New Issue
Block a user