-
Notifications
You must be signed in to change notification settings - Fork 0
Mode Stack Manager
Neo Hop edited this page Jun 18, 2024
·
1 revision
- Run mode with highest priority
- Add or remove modes from stack
- Only one instance of a mode can exist on the stack.
- Modes cannot have same priority
- There is always and idle state with priority level 0.
- Store current running state in Marker State Manager
none
uint8_t
current_mode
typedef struct {
uint8_t id; // unique
const char* name;
uint8_t priority;
mode_function_t mode_enter_func;
mode_function_t mode_function;
mode_function_t mode_exit_func;
} stack_manager_mode_t;
typedef void (* mode_function_t)( /* void * */ );
esp_err_t mode_stack_manager_sort();
void mode_stack_manager_print();
void mode_stack_manager_task(void* args);
esp_err_t mode_stack_manager_init(stack_manager_mode_t* idle_mode);
esp_err_t mode_stack_manager_add_mode(stack_manager_mode_t* mode);
esp_err_t mode_stack_manager_enter_mode(uint8_t id);
esp_err_t mode_stack_manager_exit_mode(uint8_t id);
esp_err_t mode_stack_manager_get_current_mode(stack_manager_mode_t** mode);
esp_err_t mode_stack_manager_get_mode(uint8_t id, stack_manager_mode_t** mode);