2024-04-16 15:02:59 +00:00
|
|
|
/*
|
2024-03-06 11:34:22 +00:00
|
|
|
* File: main.c
|
2024-03-13 11:03:40 +00:00
|
|
|
* Author: Sebastian H. Gabrielli, Helle Augland Grasmo
|
2024-03-06 11:34:22 +00:00
|
|
|
*
|
|
|
|
|
* Created on March 6, 2024, 12:34 PM
|
|
|
|
|
*/
|
2024-04-23 13:31:32 +00:00
|
|
|
#include <stdbool.h>
|
2024-04-09 14:20:46 +00:00
|
|
|
#include "uart.h"
|
2024-04-16 15:02:59 +00:00
|
|
|
#include "voltage.h"
|
2024-04-09 14:20:46 +00:00
|
|
|
#define RTC_PERIOD (511)
|
|
|
|
|
#define DELAY_TIME 1000
|
2024-04-16 15:02:59 +00:00
|
|
|
#include "eeprom.h"
|
2024-04-09 14:20:46 +00:00
|
|
|
#include <avr/interrupt.h>
|
2024-03-06 11:34:22 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
2024-04-16 15:02:59 +00:00
|
|
|
#include <string.h>
|
2024-03-06 13:49:16 +00:00
|
|
|
#define F_CPU 4E6
|
2024-04-16 13:30:38 +00:00
|
|
|
#include "command-handler.h"
|
2024-04-16 15:02:59 +00:00
|
|
|
#include "i2c.h"
|
2024-04-23 13:31:32 +00:00
|
|
|
#include "themistor-temp.h"
|
2024-03-06 14:36:24 +00:00
|
|
|
#include "uart.h"
|
2024-04-16 13:30:38 +00:00
|
|
|
#include <avr/io.h>
|
2024-03-13 09:25:36 +00:00
|
|
|
#include <stdint.h>
|
2024-04-23 13:31:32 +00:00
|
|
|
#include <util/delay.h>
|
|
|
|
|
|
|
|
|
|
// Fan history variables
|
|
|
|
|
volatile uint16_t fan1_history[512] = {1, 2, 3, 4};
|
|
|
|
|
volatile uint16_t fan2_history[512] = {2, 3, 4, 5};
|
2024-03-06 11:34:22 +00:00
|
|
|
|
2024-03-06 14:36:24 +00:00
|
|
|
int main() {
|
2024-04-16 15:02:59 +00:00
|
|
|
init_uart((uint16_t)9600);
|
2024-04-24 11:24:15 +00:00
|
|
|
ADC0_init();
|
|
|
|
|
init_led();
|
2024-04-16 15:02:59 +00:00
|
|
|
init_i2c();
|
|
|
|
|
stdout = &USART_stream;
|
|
|
|
|
|
|
|
|
|
PORTB.DIRSET = PIN3_bm;
|
2024-04-23 13:31:32 +00:00
|
|
|
|
2024-04-16 15:02:59 +00:00
|
|
|
sei();
|
2024-03-06 11:34:22 +00:00
|
|
|
|
2024-04-16 15:02:59 +00:00
|
|
|
while (1) {
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
}
|