Chapter 10: C Structures
NU_STATE menu_state[] PROGMEM = {
// STATE STATE TEXT STATE_FUNC
{ST_AVRBF, MT_AVRBF, NULL},
{ST_AVRBF_REV, NULL, Revision},
MT_TIME, NULL},
NULL},
efined as ST_AVRBF_REV
is defined as Revision
u will note in the table that each state has either a state text or a state function
defined, but not both, that complication will be explained later.
cture we also have 256 possible states, and 256
ssible next states for all those, that’s
for each state, fortunately we won’t need that
is structure in Menu.h as follows:
menu_nextstate[] PROGMEM = {
0, 0}
can use this as:
character to the caller. We define an array of instances of this structure in Menu.h
as follows:
const ME
{ST_TIME,
{ST_TIME_CLOCK, MT_TIME_CLOCK, NULL},
// Lots more stuff
{0, NULL,
};
We can use this as:
menu_state[1].state is d
menu_state[1].pText is defined as NULL
menu_state[1].pFunc
Yo
For the MENU_NEXTSTATE stru
possible inputs for each state, and 256 po
65 536 possible state transitions
many. We define an array of instances of th
const MENU_NEXTSTATE
// STATE INPUT NEXT STATE
{ST_AVRBF, KEY_PLUS, ST_OPTIONS},
{ST_AVRBF, KEY_NEXT, ST_AVRBF_REV},
{ST_AVRBF, KEY_MINUS, ST_TIME},
// Lots more states
{0,
};
We