Urbanite: Parking aid system
|
Header for fsm_urbanite.c file. More...
Typedefs | |
typedef struct fsm_urbanite_t | fsm_urbanite_t |
Structure that contains the information of the Urbanite FSM. More... | |
Enumerations | |
enum | FSM_URBANITE { OFF = 0, MEASURE, SLEEP_WHILE_OFF, SLEEP_WHILE_ON } |
Enumerator for the Urbanite finite state machine. More... | |
Functions | |
fsm_urbanite_t * | fsm_urbanite_new (fsm_button_t *p_fsm_button, uint32_t on_off_press_time_ms, uint32_t pause_display_time_ms, fsm_ultrasound_t *p_fsm_ultrasound_rear, fsm_display_t *p_fsm_display_rear) |
Create a new Urbanite FSM. More... | |
void | fsm_urbanite_fire (fsm_urbanite_t *p_fsm) |
Fire the Urbanite FSM. More... | |
void | fsm_urbanite_destroy (fsm_urbanite_t *p_fsm) |
Destroy an Urbanite FSM. More... | |
Header for fsm_urbanite.c file.
typedef struct fsm_urbanite_t fsm_urbanite_t |
Structure that contains the information of the Urbanite FSM.
enum FSM_URBANITE |
Enumerator for the Urbanite finite state machine.
This enumerator defines the different states that the Urbanite finite state machine can be in. Each state represents a specific condition or step in the process of showing the distance to the nearest obstacle.
void fsm_urbanite_destroy | ( | fsm_urbanite_t * | p_fsm | ) |
Destroy an Urbanite FSM.
This function destroys an Urbanite FSM and frees the memory.
TODO alumnos:
✅ 1. Implement this function analogously to the
fsm_button_destroy()
,fsm_ultrasound_destroy()
andfsm_display_destroy()
functions.
p_fsm | Pointer to an fsm_urbanite_t struct. |
void fsm_urbanite_fire | ( | fsm_urbanite_t * | p_fsm | ) |
Fire the Urbanite FSM.
This function is used to check the transitions and execute the actions of the Urbanite FSM.
TODO alumnos:
✅ 1. Call function
fsm_fire()
with the received pointer tofsm_t
p_fsm | Pointer to the fsm_urbanite_t struct. |
fsm_urbanite_t* fsm_urbanite_new | ( | fsm_button_t * | p_fsm_button, |
uint32_t | on_off_press_time_ms, | ||
uint32_t | pause_display_time_ms, | ||
fsm_ultrasound_t * | p_fsm_ultrasound_rear, | ||
fsm_display_t * | p_fsm_display_rear | ||
) |
Create a new Urbanite FSM.
This function creates a new Urbanite FSM with the given button, ultrasound, display FSMs and the required times for configuration.
TODO alumnos:
✅ 1. Allocate memory for the
fsm_urbanite_t
struct in the same way as thefsm_button_new()
,fsm_ultrasound_new()
andfsm_display_new()
functions.
✅ 2. Initialize thefsm_t
struct of the Urbanite FSM by calling thefsm_urbanite_init()
function.
✅ 3. Return the pointer to the Urbanite FSM once it has been created and initialized.
p_fsm_button | Pointer to the button FSM to interact with the Urbanite. |
on_off_press_time_ms | Time in ms to consider ON/OFF of the Urbanite parking aid system. |
pause_display_time_ms | Time in ms to pause the display system. |
p_fsm_ultrasound_rear | Pointer to the rear ultrasound FSM. |
p_fsm_display_rear | Pointer to the rear display FSM. |