minor edits to TestEncoderAAR.c
This commit is contained in:
@@ -19,7 +19,7 @@ char receivedChars[numChars]="00"; // an array to store the received data
|
|||||||
|
|
||||||
void initialiseEncoderStateMachine();
|
void initialiseEncoderStateMachine();
|
||||||
void updateEncoderStateMachine();
|
void updateEncoderStateMachine();
|
||||||
enum states get_state();
|
enum states get_current_state();
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ int main()
|
|||||||
|
|
||||||
// Could be implemented as a C macro, which would be faster
|
// Could be implemented as a C macro, which would be faster
|
||||||
// but I've forgotten how to define C macros
|
// 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 0 and B is 0, system is in State 1
|
||||||
If A is 1 and B is 0, system is in State 2
|
If A is 1 and B is 0, system is in State 2
|
||||||
@@ -72,13 +72,13 @@ enum states get_state()
|
|||||||
|
|
||||||
void initialiseEncoderStateMachine()
|
void initialiseEncoderStateMachine()
|
||||||
{
|
{
|
||||||
state = get_state();
|
state = get_current_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void updateEncoderStateMachine()
|
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)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user