![]() |
NTURT Zephyr v0.0.1
NTURT common library for Zephyr RTOS
|
Control system state machine. More...
#include <stdbool.h>#include <stdint.h>#include <zephyr/sys/iterable_sections.h>#include <zephyr/sys/util.h>
Include dependency graph for states.h:
This graph shows which files directly or indirectly include this file:Data Structures | |
| struct | states_trans_cmd_info |
| State transition command information. More... | |
| struct | states_callback |
| State transition callback. More... | |
Macros | |
| #define | STATES_CALLBACK_DEFINE_NAMED(_name, _states, _handler, _user_data) |
| Same as STATES_CALLBACK_DEFINE, but with a custom name for the callback. | |
| #define | STATES_CALLBACK_DEFINE(states, handler, user_data) |
| Define a callback for state transition. | |
Typedefs | |
| typedef uint32_t | states_t |
| State machine states type, where each bit represents a state defined in states_state. | |
| typedef void(* | states_handler_t) (enum states_state state, bool is_entry, void *user_data) |
| State transition handler type. | |
Enumerations | |
| enum | states_state { STATE_INVALID = 0 , STATE_READY = BIT(0) , STATE_RTD_BLINK = BIT(1) , STATE_RTD_STEADY = BIT(2) , STATE_RTD_READY = BIT(3) , STATE_RTD_SOUND = BIT(4) , STATE_RUNNING = BIT(5) , STATE_RUNNING_OK = BIT(6) , STATE_RUNNING_ERROR = BIT(7) , STATE_ERROR = BIT(8) , STATE_ALL = UINT32_MAX , NUM_STATE = 9 } |
| State machine states. More... | |
| enum | states_trans_cmd { TRANS_CMD_INVALID = 0 , TRANS_CMD_PEDAL , TRANS_CMD_PEDAL_CLEAR , TRANS_CMD_RTD , TRANS_CMD_RTD_FORCED , TRANS_CMD_RTD_FINISH , TRANS_CMD_ERROR , TRANS_CMD_ERROR_CLEARED , TRANS_CMD_ERROR_RUNNING , TRANS_CMD_ERROR_CLEARED_RUNNING , TRANS_CMD_FATAL_ERROR , TRANS_CMD_DISABLE , NUM_TRANS_CMD } |
| State transition commands. More... | |
Functions | |
| states_t | states_get () |
| Get the current states. | |
| bool | states_valid_transition (enum states_trans_cmd cmd) |
| Test if a state transition command is valid. | |
| bool | states_transition_pending () |
| Check if a state transition is currently pending. | |
| void | states_transition (enum states_trans_cmd cmd) |
| Execute a state transition command to transition to a new state. | |
| const char * | states_state_str (enum states_state state) |
| Get the string representation of a state. | |
| int | states_states_str (char *buf, size_t size, states_t states) |
| Get the string representation of states separated by commas in the same semantic as snprintf. | |
| const struct states_trans_cmd_info * | states_transition_info (enum states_trans_cmd cmd) |
| Get the information of a state transition. | |
Control system state machine.