#define F_INMENU 0 ///< Flag currently running a menu
#define F_INEDIT 1 ///< Flag currently editing a value
#define F_MENUWRAP 2 ///< Flag to wrap around ends of menu and list selections
#define F_AUTOSTART 3 ///< Flag auto start the menu system on SEL
uint8_t _options;
#define SET_FLAG(f) { _options |= (1<<f); } ///< Set a flag
#define CLEAR_FLAG(f) { _options &= ~(1<<f); } ///< Reset a flag
#define TEST_FLAG(f) ((_options>>f) & 1) ///< Test a flag
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Welcome to the Serial Monitor!");
Serial.println("---------------------------------");
_options = 0;
}
void loop() {
// put your main code here, to run repeatedly:
//while (Serial.available() == 0) {}
Serial.print("_options: ");
Serial.println(_options);
Serial.print("SET_FLAG(F_INMENU): ");
SET_FLAG(F_INMENU);
Serial.print("_options: ");
Serial.println(_options);
Serial.print("SET_FLAG(F_AUTOSTART): ");
SET_FLAG(F_AUTOSTART);
Serial.print("_options: ");
Serial.println(_options);
Serial.print("CLEAR_FLAG(F_MENUWRAP): ");
CLEAR_FLAG(F_MENUWRAP);
Serial.print("_options: ");
Serial.println(_options);
Serial.print("CLEAR_FLAG(F_INMENU): ");
CLEAR_FLAG(F_INMENU);
Serial.print("_options: ");
Serial.println(_options);
Serial.print("TEST_FLAG(F_INEDIT): ");
Serial.print("_options: ");
Serial.println(TEST_FLAG(F_INEDIT));
Serial.print("TEST_FLAG(F_INMENU): ");
Serial.print("_options: ");
Serial.println(TEST_FLAG(F_INMENU));
Serial.print("TEST_FLAG(F_AUTOSTART): ");
Serial.print("_options: ");
Serial.println(TEST_FLAG(F_AUTOSTART));
// Serial.println("\n\n\n\n\n\n\n\n\n");
while (true) {}
}