FSM thermostat
|
Port layer for a temperature sensor. More...
#include <stdint.h>
#include <stdio.h>
#include "port_temp_sensor.h"
#include "stm32f4xx.h"
#include "port_system.h"
Go to the source code of this file.
Functions | |
uint32_t | _adc_to_mvolts (uint32_t adcValue, uint8_t adc_res_bits) |
Converts an ADC value to millivolts. More... | |
double | port_temp_sensor_get_temperature (port_temp_hw_t *p_temp) |
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 *p_temp) |
Initializes the temperature sensor. More... | |
Variables | |
port_temp_hw_t | temp_sensor_thermostat = {.p_port = TEMP_SENSOR_THERMOSTAT_GPIO, .pin = TEMP_SENSOR_THERMOSTAT_PIN, .p_adc = TEMP_SENSOR_THERMOSTAT_ADC, .adc_channel = TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL, .temperature_celsius = 0} |
Port layer for a temperature sensor.
Definition in file port_temp_sensor.c.
uint32_t _adc_to_mvolts | ( | uint32_t | adcValue, |
uint8_t | adc_res_bits | ||
) |
Converts an ADC value to millivolts.
adcValue | Counts of the ADC |
adc_res_bits | Resolution of the ADC in bits |
Definition at line 31 of file port_temp_sensor.c.
double port_temp_sensor_get_temperature | ( | port_temp_hw_t * | pir_sensor | ) |
Gets the temperature in Celsius of the temperature sensor.
Definition at line 37 of file port_temp_sensor.c.
void port_temp_sensor_init | ( | port_temp_hw_t * | pir_sensor | ) |
Initializes the temperature sensor.
pir_sensor | Pointer to the temperature sensor structure. |
Definition at line 52 of file port_temp_sensor.c.
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.
p_temp | Pointer to the temperature sensor structure. |
adc_value | ADC value of the temperature sensor. |
Definition at line 42 of file port_temp_sensor.c.
port_temp_hw_t temp_sensor_thermostat = {.p_port = TEMP_SENSOR_THERMOSTAT_GPIO, .pin = TEMP_SENSOR_THERMOSTAT_PIN, .p_adc = TEMP_SENSOR_THERMOSTAT_ADC, .adc_channel = TEMP_SENSOR_THERMOSTAT_ADC_CHANNEL, .temperature_celsius = 0} |
Temperature sensor of the thermostat system. Public for access to interrupt handlers.
Definition at line 20 of file port_temp_sensor.c.