FreeRTOS Emulator with SDL2 Based Graphics and Input Library  1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
states.h
Go to the documentation of this file.
1 /****************************************************************************
2  ----------------------------------------------------------------------
3  Copyright (C) Alexander Hoffman, 2019
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17  ----------------------------------------------------------------------
18  ****************************************************************************/
19 
67 #ifndef STATES_H_
68 #define STATES_H_
69 
76 unsigned char uStatesInit(void);
77 
89 unsigned char uStatesRun(void);
90 
102 int xStatesAdd(void (*probe)(void), void (*enter)(void),
103  void (*run)(void), void (*exit)(void), int ID,
104  char *name);
105 
114 void vStatesSetCallback(void (*callback)(void));
115 
122 void vStatesSetData(void *data);
123 
132 void vStatesSetInput(unsigned char input);
133 
145 unsigned char uStatesSetState(unsigned int state_id);
146 
154 void *pStatesGetData(void);
155 
161 char *pStatesGetStateName(void);
162 
168 unsigned char uStatesGetInput(void);
169 
175 int xStatesGetStateID(void);
176 
182 int xStatesGetStateCount(void);
183 
189 int xStatesIncrementState(void);
190 
196 int xStatesDecrementState(void);
197 
201 void vStatesClearInput(void);
202 
204 #endif /* STATES_H_ */
unsigned char uStatesRun(void)
Ticks the state machine over.
Definition: states.c:235
int xStatesAdd(void(*probe)(void), void(*enter)(void), void(*run)(void), void(*exit)(void), int ID, char *name)
Adds a state to the state machine.
Definition: states.c:286
int xStatesGetStateID(void)
Returns the ID of the current state.
Definition: states.c:152
void vStatesClearInput(void)
Clears the 8 bit input vector stored in the state machine.
unsigned char uStatesSetState(unsigned int state_id)
Sets the next state of the state machine using the state's ID.
Definition: states.c:106
char * pStatesGetStateName(void)
Returns the string of the current state's name.
Definition: states.c:139
int xStatesDecrementState(void)
Decrements the state to the previous in the linked list of states.
Definition: states.c:205
int xStatesIncrementState(void)
Increments the state to the next in the linked list of states.
Definition: states.c:176
unsigned char uStatesInit(void)
Initialized the states stored in the state machine by calling their probe functions,...
Definition: states.c:347
void vStatesSetInput(unsigned char input)
Sets the input variable stored in the state machine.
void * pStatesGetData(void)
Returns a pointer to the data stored in the current state.
Definition: states.c:127
int xStatesGetStateCount(void)
Returns the number of states currently stored within the state machine.
Definition: states.c:164
void vStatesSetData(void *data)
Sets the data of the current state.
Definition: states.c:93
void vStatesSetCallback(void(*callback)(void))
Sets the callback function for the state machine.
Definition: states.c:83
unsigned char uStatesGetInput(void)
Retrieves the input vector stored within the state machine.