FSM thermostat
port_temp_sensor.h File Reference

Header file for the temperature sensor port layer. More...

#include <stdbool.h>
#include "port_system.h"

Go to the source code of this file.

Data Structures

struct  port_temp_hw_t
 Structure to define the HW dependencies of a temperature sensor. More...
 

Macros

#define TEMP_SENSOR_THERMOSTAT_GPIO   GPIOA
 
#define TEMP_SENSOR_THERMOSTAT_PIN   0
 
#define TEMP_SENSOR_THERMOSTAT_ADC   ADC1
 
#define TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL   0
 

Functions

double port_temp_sensor_get_temperature (port_temp_hw_t *pir_sensor)
 Gets the temperature in Celsius of the temperature sensor. More...
 
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. More...
 
void port_temp_sensor_init (port_temp_hw_t *pir_sensor)
 Initializes the temperature sensor. More...
 

Variables

port_temp_hw_t temp_sensor_thermostat
 

Detailed Description

Header file for the temperature sensor port layer.

Author
Josué Pagán (j.pag.nosp@m.an@u.nosp@m.pm.es)
Version
0.1
Date
2024-05-01

Definition in file port_temp_sensor.h.

Macro Definition Documentation

◆ TEMP_SENSOR_THERMOSTAT_ADC

#define TEMP_SENSOR_THERMOSTAT_ADC   ADC1

ADC of the temperature sensor in the Nucleo board

Definition at line 24 of file port_temp_sensor.h.

◆ TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL

#define TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL   0

ADC channel of the temperature sensor in the Nucleo board

Definition at line 25 of file port_temp_sensor.h.

◆ TEMP_SENSOR_THERMOSTAT_GPIO

#define TEMP_SENSOR_THERMOSTAT_GPIO   GPIOA

GPIO port of the temperature sensor in the Nucleo board

Definition at line 22 of file port_temp_sensor.h.

◆ TEMP_SENSOR_THERMOSTAT_PIN

#define TEMP_SENSOR_THERMOSTAT_PIN   0

GPIO pin of the temperature sensor in the Nucleo board

Definition at line 23 of file port_temp_sensor.h.

Function Documentation

◆ 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.

Returns
double Temperature in Celsius.

Definition at line 37 of file port_temp_sensor.c.

◆ port_temp_sensor_init()

void port_temp_sensor_init ( port_temp_hw_t pir_sensor)

Initializes the temperature sensor.

Parameters
pir_sensorPointer to the temperature sensor structure.

Definition at line 52 of file port_temp_sensor.c.

◆ 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.

Parameters
p_tempPointer to the temperature sensor structure.
adc_valueADC value of the temperature sensor.

Definition at line 42 of file port_temp_sensor.c.

Variable Documentation

◆ temp_sensor_thermostat

port_temp_hw_t temp_sensor_thermostat

Temperature sensor of the thermostat system. Public for access to interrupt handlers.

Definition at line 20 of file port_temp_sensor.c.