FSM thermostat
|
Header file for the thermostat FSM. More...
Go to the source code of this file.
Data Structures | |
struct | fsm_thermostat_t |
Structure to define the thermostat FSM. More... | |
Macros | |
#define | THERMOSTAT_TIMEOUT_SEC 1 |
#define | THERMOSTAT_HISTORY 10 |
#define | THERMOSTAT_DEFAULT_THRESHOLD 25 |
Enumerations | |
enum | FSM_THERMOSTAT_STATES { THERMOSTAT_OFF = 0, THERMOSTAT_ON } |
Enumerates the states of the thermostat FSM. More... | |
enum | THERMOSTAT_EVENTS { UNKNOWN = -1, ACTIVATION = 0, DEACTIVATION } |
Enumerates the events of the thermostat FSM. More... | |
Functions | |
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... | |
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... | |
#define THERMOSTAT_DEFAULT_THRESHOLD 25 |
Threshold temperature to activate the thermostat
Definition at line 25 of file fsm_thermostat.h.
#define THERMOSTAT_HISTORY 10 |
Number of events to store in the thermostat
Definition at line 24 of file fsm_thermostat.h.
#define THERMOSTAT_TIMEOUT_SEC 1 |
Timeout for the thermostat to be activated
Definition at line 23 of file fsm_thermostat.h.
Enumerates the states of the thermostat FSM.
Enumerator | |
---|---|
THERMOSTAT_OFF | Thermostat is off |
THERMOSTAT_ON | Thermostat is on |
Definition at line 32 of file fsm_thermostat.h.
enum THERMOSTAT_EVENTS |
Enumerates the events of the thermostat FSM.
Enumerator | |
---|---|
UNKNOWN | Unknown event |
ACTIVATION | Thermostat activated |
DEACTIVATION | Thermostat deactivated |
Definition at line 42 of file fsm_thermostat.h.
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.
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.