/* * File: main.c * Author: Sebastian H. Gabrielli, Helle Augland Grasmo * * Created on March 6, 2024, 12:34 PM */ #include #include "uart.h" #include "voltage.h" #define RTC_PERIOD (511) #define DELAY_TIME 1000 #include "eeprom.h" #include #include #include #include #define F_CPU 4E6 #include "command-handler.h" #include "i2c.h" #include "themistor-temp.h" #include "uart.h" #include #include #include // Fan history variables volatile uint16_t fan1_history[512] = {1, 2, 3, 4}; volatile uint16_t fan2_history[512] = {2, 3, 4, 5}; // Default config is 500ms sample rate volatile config_t config = { 500 }; volatile bool store_config = false; int main() { // Initialize functionality init_uart((uint16_t)9600); ADC0_init(); init_led(); init_i2c(); stdout = &USART_stream; // Read the stored config struct //config = read_struct_from_EEPROM(); config.ms_fanspeed_sample_rate = 500; PORTB.DIRSET = PIN3_bm; sei(); while (1) { // If we have made a config change, store it. if (store_config) { write_struct_from_EEPROM(config); store_config = false; } } }