Appiko
|
A simple state machine of three states is implemented in this example both switch statement and function pointers. This example is compiled for the Bluey board. The state machine is as shown in the diagram below. Note that button
in the diagram means the release of the button.
More...
Typedefs | |
typedef void(* | state_process) (void) |
The type of function pointer that'll be used by the processing functions of the three states. | |
Enumerations | |
enum | sm_states |
The three states of the state machine. | |
Functions | |
void | repeat_handler (void) |
5s timeout handler used to go from green to red state or red to off state. | |
bool | button_check (void) |
Function that returns if the button was released from the previous time it was called. More... | |
void | green_process (void) |
Green state process checks if there is a button press to reset the timer. | |
void | off_process (void) |
Off state process checks if there is a button press to go to red state. | |
void | red_process (void) |
Red state process checks if there is a button press to go to green state. | |
int | main (void) |
Function for application main entry. | |
bool button_check | ( | void | ) |
Definition at line 106 of file main.c.
References BUTTONS_ACTIVE_STATE.
Referenced by green_process(), off_process(), and red_process().