38 lines
759 B
C
Executable File
38 lines
759 B
C
Executable File
#pragma once
|
|
|
|
/**************************************************************************************
|
|
statemachine.h
|
|
|
|
Universelle Funktionen zum errichten einer Statemachine
|
|
|
|
**************************************************************************************/
|
|
|
|
#include <hwo/mutex.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef uint8_t (*StateMachineChangerCallback)(uint8_t oldstate,uint8_t newstate);
|
|
|
|
struct _sm_statemachine
|
|
{
|
|
StateMachineChangerCallback *callbacks;
|
|
uint8_t numcallbacks;
|
|
|
|
uint8_t state,
|
|
changing_to,
|
|
change_to;
|
|
|
|
MUTEX mutex;
|
|
};
|
|
|
|
void sm_set_changerlist(StateMachineChangerCallback *callbacklist);
|
|
uint8_t sm_state(void);
|
|
void sm_change(uint8_t tostate);
|
|
void sm_change_immediate(uint8_t newstate);
|
|
|
|
void sm_wait(uint8_t state);
|
|
|
|
|
|
|
|
|