2024-03-06 14:49:48 +00:00
|
|
|
/*
|
|
|
|
|
* File: eeprom.h
|
2024-04-28 18:19:57 +00:00
|
|
|
* Author: Helle Augland Grasmo, Sebastian H. Gabrielli
|
2024-03-06 14:49:48 +00:00
|
|
|
*
|
|
|
|
|
* Created on 06 March 2024, 15:30
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef EEPROM_H
|
|
|
|
|
#define EEPROM_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <avr/io.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <avr/eeprom.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2024-03-06 19:05:52 +00:00
|
|
|
// Struct for information on the controller.
|
2024-03-06 14:49:48 +00:00
|
|
|
typedef struct {
|
2024-04-30 14:17:52 +00:00
|
|
|
uint16_t ms_fanspeed_sample_rate;
|
2024-03-06 14:49:48 +00:00
|
|
|
} config_t;
|
|
|
|
|
|
2024-04-28 18:19:57 +00:00
|
|
|
// Check if EEPROM is ready to be written to
|
2024-03-13 10:48:58 +00:00
|
|
|
void check_eeprom_is_ready();
|
2024-03-06 19:05:52 +00:00
|
|
|
|
2024-04-28 18:19:57 +00:00
|
|
|
// Writes a config_t struct to the EEPROM
|
2024-03-13 11:03:40 +00:00
|
|
|
void write_struct_from_EEPROM(config_t write_struct);
|
2024-03-06 19:05:52 +00:00
|
|
|
|
2024-04-28 18:19:57 +00:00
|
|
|
// Read data from EEPROM and return it as a config_t struct
|
2024-03-13 10:48:58 +00:00
|
|
|
config_t read_struct_from_EEPROM();
|
2024-03-06 19:05:52 +00:00
|
|
|
|
2024-03-06 14:49:48 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* EEPROM_H */
|
|
|
|
|
|