|
FSM thermostat
|
Finite State Machine for a thermostat. More...
#include <stdlib.h>#include <string.h>#include "fsm_thermostat.h"#include "port_thermostat.h"#include "port_led.h"#include "port_temp_sensor.h"Go to the source code of this file.
Functions | |
| bool | check_heat (fsm_t *p_this) |
| Check if the temperature is cold enough to activate the thermostat. More... | |
| bool | check_comfort (fsm_t *p_this) |
| Check if the temperature is hot enough to deactivate the thermostat. More... | |
| void | do_thermostat_on (fsm_t *p_this) |
| Turn off the thermostat. More... | |
| void | do_thermostat_off (fsm_t *p_this) |
| Turn on the thermostat. More... | |
| uint32_t | fsm_thermostat_get_last_time_event (fsm_t *p_this, uint8_t event) |
| Gets the last time there was an event in the thermostat. If the event is not found, it returns 0. More... | |
| uint8_t | fsm_thermostat_get_status (fsm_t *p_this) |
| Gets the thermostat status. More... | |
| void | fsm_thermostat_init (fsm_t *p_this, port_led_hw_t *p_led_heat, port_led_hw_t *p_led_comfort, port_temp_hw_t *p_temp) |
| Initialize the thermostat FSM. More... | |
| fsm_t * | fsm_thermostat_new (port_led_hw_t *p_led_heat, port_led_hw_t *p_led_comfort, port_temp_hw_t *p_temp) |
| Creates a new thermostat FSM. More... | |
Variables | |
| fsm_trans_t | fsm_trans_thermostat [] |
| Transitions table for the thermostat. More... | |
| bool check_comfort | ( | fsm_t * | p_this | ) |
Check if the temperature is hot enough to deactivate the thermostat.
| p_this | Pointer to the FSM structure |
Definition at line 50 of file fsm_thermostat.c.
| bool check_heat | ( | fsm_t * | p_this | ) |
Check if the temperature is cold enough to activate the thermostat.
| p_this | Pointer to the FSM structure |
Definition at line 28 of file fsm_thermostat.c.
| void do_thermostat_off | ( | fsm_t * | p_this | ) |
Turn on the thermostat.
| p_this | Pointer to the thermostat FSM structure |
Definition at line 82 of file fsm_thermostat.c.
| void do_thermostat_on | ( | fsm_t * | p_this | ) |
Turn off the thermostat.
| p_this | Pointer to the thermostat FSM structure |
Definition at line 62 of file fsm_thermostat.c.
| uint32_t fsm_thermostat_get_last_time_event | ( | fsm_t * | p_this, |
| uint8_t | event | ||
| ) |
Gets the last time there was an event in the thermostat. If the event is not found, it returns 0.
| p_this | Pointer to the thermostat FSM structure. |
| event | Event to check. It can be any of the events in the THERMOSTAT_EVENTS enum. |
Definition at line 108 of file fsm_thermostat.c.
| uint8_t fsm_thermostat_get_status | ( | fsm_t * | p_this | ) |
Gets the thermostat status.
| p_this | Pointer to the thermostat FSM structure. |
Definition at line 123 of file fsm_thermostat.c.
| void fsm_thermostat_init | ( | fsm_t * | p_this, |
| port_led_hw_t * | p_led_heat, | ||
| port_led_hw_t * | p_led_comfort, | ||
| port_temp_hw_t * | p_temp | ||
| ) |
Initialize the thermostat FSM.
| p_this | Pointer to the FSM structure |
| p_led_heat | Pointer to the LED structure |
| p_led_comfort | Pointer to the LED structure |
| p_temp | Pointer to the temperature sensor structure |
Definition at line 139 of file fsm_thermostat.c.
| fsm_t* fsm_thermostat_new | ( | port_led_hw_t * | p_led_heat, |
| port_led_hw_t * | p_led_comfort, | ||
| port_temp_hw_t * | p_temp | ||
| ) |
Creates a new thermostat FSM.
| p_led_heat | Pointer to the LED of the thermostat. |
| p_led_comfort | Pointer to the comfort LED of the thermostat. |
| p_temp | Pointer to the temperature sensor of the thermostat. |
Definition at line 174 of file fsm_thermostat.c.
| fsm_trans_t fsm_trans_thermostat[] |
Transitions table for the thermostat.
Definition at line 102 of file fsm_thermostat.c.