mikrokontrollersystemer-pro.../prosjekt.X/themistor-temp.h

51 lines
988 B
C
Raw Normal View History

2024-03-13 12:07:29 +00:00
/*
* File: themistor-temp.h
* Author: athamantis
*
* Created on 08 March 2024, 11:46
*/
#ifndef THEMISTOR_TEMP_H
#define THEMISTOR_TEMP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
2024-05-03 15:16:29 +00:00
#include <float.h>
2024-03-13 12:07:29 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
2024-04-16 15:24:54 +00:00
#include <avr/io.h>
2024-04-30 14:17:52 +00:00
#define R_T0 100E3
2024-03-13 12:07:29 +00:00
#define T_0 298.15
#define B 3950
#define R_1 1000
2024-04-16 15:24:54 +00:00
#define ledpin PIN3_bm
2024-05-03 15:16:29 +00:00
// Takes inn messured value
#define ALERT_PIN PIN3_bm
2024-05-03 15:16:29 +00:00
// Takes inn messured value
2024-03-13 12:07:29 +00:00
// Calculates the temperature in celcius
2024-05-03 15:16:29 +00:00
// Returns the thermistor themperature
2024-03-13 12:07:29 +00:00
float calculate_thermistor_temp(float readValue);
2024-05-03 15:16:29 +00:00
// Returns true if temperatur is higher than max_temp
2024-04-16 13:56:51 +00:00
bool voltage_threshold_bool(float thermistor_temp, uint8_t max_temp);
2024-03-13 12:07:29 +00:00
2024-04-16 15:24:54 +00:00
void alert_voltage_threshold_exceeded(bool voltage_threshold_bool);
2024-03-13 12:07:29 +00:00
// Initialise alarm GPIO
void init_alarm_gpio();
2024-03-13 12:07:29 +00:00
#ifdef __cplusplus
}
#endif
#endif /* THEMISTOR_TEMP_H */