Pass variable structure as argument for memory functions

This commit is contained in:
2024-09-21 01:51:36 +02:00
parent a423144599
commit 7ca158a8dd
3 changed files with 135 additions and 91 deletions

View File

@@ -32,6 +32,8 @@ static word dewp, dewp_target;
static int Init(void)
{
mem_block_t mem;
state = S_IDLE;
// MOSFETS control things like the heating element
@@ -73,12 +75,17 @@ static int Init(void)
// used.
MEM_Init();
MEM_Read(&temp_target, &dewp_target);
Info("Persistent memory contains [%d, %d]",
temp_target, dewp_target);
// MEM_Write(20, 60);
// MEM_Dump();
// mem.temp = 30.50f;
// mem.dewp = 15.25f;
// MEM_Write(&mem);
// MEM_Free();
if (MEM_Read(&mem) == 0) {
Info("Found persistent configuration in EEPROM!");
Info("Setting targets TEMP='%.2f', DEWP='%.2f'.",
mem.temp, mem.dewp);
}
// There is a possiblity to use interrupt signals
// for I2C communication but only as one large