minor edits to TestEncoderAAR.c

This commit is contained in:
2023-10-12 18:52:25 +01:00
parent eeed51f882
commit b7ddb49f1f

View File

@@ -19,7 +19,7 @@ char receivedChars[numChars]="00"; // an array to store the received data
void initialiseEncoderStateMachine();
void updateEncoderStateMachine();
enum states get_state();
enum states get_current_state();
int main()
{
@@ -54,7 +54,7 @@ int main()
// Could be implemented as a C macro, which would be faster
// but I've forgotten how to define C macros
enum states get_state()
enum states get_current_state()
{
/* If A is 0 and B is 0, system is in State 1
If A is 1 and B is 0, system is in State 2
@@ -72,13 +72,13 @@ enum states get_state()
void initialiseEncoderStateMachine()
{
state = get_state();
state = get_current_state();
}
void updateEncoderStateMachine()
{
enum states new_state = get_state(); // get new state, don't update state yet so states can be compared
enum states new_state = get_current_state(); // get new state, don't update state yet so states can be compared
switch (state)
{