FSM thermostat
port_temp_sensor.h
Go to the documentation of this file.
1 
10 #ifndef PORT_TEMP_SENSOR_H
11 #define PORT_TEMP_SENSOR_H
12 
13 /* Includes ------------------------------------------------------------------*/
14 /* Standard C includes */
15 #include <stdbool.h>
16 
17 /* HW dependent includes */
18 #include "port_system.h"
19 
20 /* Defines and macros --------------------------------------------------------*/
21 // HW Nucleo-STM32F446RE:
22 #define TEMP_SENSOR_THERMOSTAT_GPIO GPIOA
23 #define TEMP_SENSOR_THERMOSTAT_PIN 0
24 #define TEMP_SENSOR_THERMOSTAT_ADC ADC1
25 #define TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL 0
27 /* Typedefs --------------------------------------------------------------------*/
28 
31 typedef struct
32 {
33  GPIO_TypeDef *p_port;
34  uint8_t pin;
35  ADC_TypeDef *p_adc;
36  uint32_t adc_channel;
39 
40 /* Global variables -----------------------------------------------------------*/
49 
56 void port_temp_sensor_save_adc_value(port_temp_hw_t *p_temp, double adc_value);
57 
63 void port_temp_sensor_init(port_temp_hw_t *pir_sensor);
64 
65 #endif /* PORT_TEMP_SENSOR_H */
port_temp_hw_t::adc_channel
uint32_t adc_channel
Definition: port_temp_sensor.h:36
port_temp_hw_t::temperature_celsius
double temperature_celsius
Definition: port_temp_sensor.h:37
port_temp_sensor_get_temperature
double port_temp_sensor_get_temperature(port_temp_hw_t *pir_sensor)
Gets the temperature in Celsius of the temperature sensor.
Definition: port_temp_sensor.c:37
port_temp_sensor_init
void port_temp_sensor_init(port_temp_hw_t *pir_sensor)
Initializes the temperature sensor.
Definition: port_temp_sensor.c:52
port_temp_hw_t::p_port
GPIO_TypeDef * p_port
Definition: port_temp_sensor.h:33
port_system.h
Header for port_system.c file.
port_temp_hw_t::p_adc
ADC_TypeDef * p_adc
Definition: port_temp_sensor.h:35
port_temp_hw_t
Structure to define the HW dependencies of a temperature sensor.
Definition: port_temp_sensor.h:31
port_temp_sensor_save_adc_value
void port_temp_sensor_save_adc_value(port_temp_hw_t *p_temp, double adc_value)
Saves the ADC value of the temperature sensor and converts it to Celsius.
Definition: port_temp_sensor.c:42
port_temp_hw_t::pin
uint8_t pin
Definition: port_temp_sensor.h:34
temp_sensor_thermostat
port_temp_hw_t temp_sensor_thermostat
Definition: port_temp_sensor.c:20