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

@@ -1,13 +1,20 @@
#ifndef MAD_CORE_COMMON_MEMORY_H
#define MAD_CORE_COMMON_MEMORY_H
#define M_TEMPERATURE 0
#define M_DEWPOINT 1
typedef struct mem_block_s mem_block_t;
// Important: Must reset EEPROM memory when the size of
// mem_block_s is changed. Also the flag value must be
// kept at the first position of the struct.
struct mem_block_s {
byte flag;
float temp, dewp;
} __attribute__((packed));
void MEM_Init(void);
void MEM_Write(word temp, word dewp);
void MEM_Read(word *temp, word *dewp);
void MEM_Write(mem_block_t *in);
int MEM_Read(mem_block_t *out);
void MEM_Free(void);
void MEM_Dump(void);
#endif // MAD_CORE_COMMON_MEMORY_H