![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Manages multiple menus and settings using Adafruit NeoTrellis. More...
#include <NeoTrellisMenuHandler.h>
Static Public Member Functions | |
static void | Update () |
Updates the menu state and processes user interactions. | |
static bool | Initialize () |
Initializes the MenuHandler and sets up the NeoTrellis keypad. | |
static void | SetDefaultValue (uint16_t menu, uint8_t value) |
Sets a default value for a specific menu. | |
static void | SetInitialized () |
Marks the menu system as initialized. | |
static void | SetMenuMax (uint8_t menu, uint8_t maxValue) |
Sets the maximum value for a specific menu. | |
static uint8_t | GetMenuValue (uint8_t menu) |
Retrieves the current value of a specific menu. | |
static uint8_t | GetCurrentMenu () |
Retrieves the index of the currently active menu. | |
static void | Begin () |
Begins the menu handling process, setting up necessary states. | |
static bool | Initialize (uint8_t pin, uint16_t holdingTime) |
Initializes the MenuHandler with specified parameters. | |
static void | SetDefaultValue (uint16_t menu, uint8_t value) |
Sets a default value for a specific menu. | |
static void | SetInitialized () |
Marks the menu system as initialized. | |
static void | SetMenuMax (uint8_t menu, uint8_t maxValue) |
Sets the maximum value for a specific menu. | |
static uint8_t | GetMenuValue (uint8_t menu) |
Retrieves the current value of a specific menu. | |
static uint8_t | GetCurrentMenu () |
Retrieves the index of the currently active menu. | |
static void | Begin () |
Begins the menu handling process, setting up necessary states. | |
static bool | Initialize (uint8_t pin, uint16_t holdingTime) |
Initializes the MenuHandler with specified parameters. | |
static void | SetDefaultValue (uint16_t menu, uint8_t value) |
Sets a default value for a specific menu. | |
static void | SetInitialized () |
Marks the menu system as initialized. | |
static void | SetMenuMax (uint8_t menu, uint8_t maxValue) |
Sets the maximum value for a specific menu. | |
static void | Update () |
Updates the menu system and processes button input. | |
static uint8_t | GetMenuValue (uint8_t menu) |
Retrieves the current value of a specific menu. | |
static uint8_t | GetCurrentMenu () |
Retrieves the index of the currently active menu. | |
Static Private Member Functions | |
static uint32_t | Wheel (byte WheelPos) |
Generates a color value based on a position on a color wheel. | |
static TrellisCallback | blink (keyEvent evt) |
Callback function for handling key events on the NeoTrellis keypad. | |
static uint8_t | ReadEEPROM (uint16_t index) |
Reads a value from EEPROM at the specified index. | |
static void | WriteEEPROM (uint16_t index, uint8_t value) |
Writes a value to EEPROM at the specified index. | |
static void | ResetI2CBus () |
Resets the I2C bus to recover from communication issues. | |
static void | UpdateState () |
Updates the button state and menu navigation. | |
static uint8_t | ReadEEPROM (uint16_t index) |
Reads a value from EEPROM at the specified index. | |
static void | WriteEEPROM (uint16_t index, uint8_t value) |
Writes a value to EEPROM at the specified index. | |
static uint8_t | ReadEEPROM (uint16_t index) |
Reads a value from EEPROM at the specified index. | |
static void | WriteEEPROM (uint16_t index, uint8_t value) |
Writes a value to EEPROM at the specified index. | |
Static Private Attributes | |
static Adafruit_NeoTrellis | trellis |
Instance of the Adafruit NeoTrellis keypad. | |
static uint8_t | currentMenu |
Index of the currently active menu. | |
static uint8_t | currentSetting |
Index of the currently active setting within the menu. | |
static uint8_t | currentValue [menuCount] |
Array of current values for each menu. | |
static uint8_t | maxValue [menuCount] |
Array of maximum values for each menu. | |
static uint8_t | faceChoices |
Number of face choices available. | |
static bool | menuActive |
Flag indicating whether the menu is active. | |
static bool | isReady |
Flag indicating whether the menu system is ready for interaction. | |
static bool | didBegin |
Flag indicating whether the initialization process has been completed. | |
static IntervalTimer | menuChangeTimer |
Timer for handling menu change intervals. | |
static long | previousMillisHold |
Tracks the last hold event time in milliseconds. | |
static uint16_t | holdingTime |
Time threshold for detecting holding behavior in milliseconds. | |
static uint8_t | pin |
The pin number associated with the button. | |
static bool | holdingState |
Indicates whether the button is in a holding state. | |
static bool | previousState |
Tracks the previous state of the button. | |
static long | previousMillis |
Tracks the last button press time in milliseconds. | |
static uint8_t | inputCount |
Number of Morse code inputs received. | |
static uint16_t | inputStream [4] |
Buffer for storing Morse code input. | |
Manages multiple menus and settings using Adafruit NeoTrellis.
Manages single-button menu navigation and settings storage.
The MenuHandler class provides functionality for navigating and managing settings across multiple menus, including support for EEPROM storage, custom settings, and dynamic updates.
menuCount | The number of menus to manage. |
The MenuHandler class provides functionality for navigating through menus and managing settings using a single button. It supports persistent storage through EEPROM and leverages an IntervalTimer for handling button hold and state transitions.
menuCount | The number of menus to manage. |
The MenuHandler class provides functionality for navigating through menus and managing settings using a single button. It supports Morse code input for advanced interaction and persistent storage through EEPROM.
menuCount | The number of menus to manage. |
Definition at line 29 of file NeoTrellisMenuHandler.h.
Begins the menu handling process, setting up necessary states.
Referenced by Menu::Initialize().
Begins the menu handling process, setting up necessary states.
|
staticprivate |
Callback function for handling key events on the NeoTrellis keypad.
evt | The key event to process. |
Retrieves the index of the currently active menu.
Referenced by Menu::GetCurrentMenu(), Menu::Update(), and GammaAnimation::Update().
Retrieves the index of the currently active menu.
Retrieves the index of the currently active menu.
Retrieves the current value of a specific menu.
menu | The menu index to retrieve the value from. |
Referenced by Menu::GetAccentBrightness(), Menu::GetBrightness(), Menu::GetCurrentMenuValue(), Menu::GetEffectS(), Menu::GetFaceColor(), Menu::GetFaceSize(), Menu::GetFaceState(), Menu::GetFanSpeed(), Menu::GetHueB(), Menu::GetHueF(), Menu::GetMicLevel(), Menu::MirrorSpectrumAnalyzer(), Menu::UseBoopSensor(), and Menu::UseMicrophone().
Retrieves the current value of a specific menu.
menu | The menu index to retrieve the value from. |
Retrieves the current value of a specific menu.
menu | The menu index to retrieve the value from. |
Initializes the MenuHandler and sets up the NeoTrellis keypad.
Initializes the MenuHandler with specified parameters.
pin | The pin number associated with the button. |
holdingTime | The time threshold for detecting holding behavior in milliseconds. |
Initializes the MenuHandler with specified parameters.
pin | The pin number associated with the button. |
holdingTime | The time threshold for detecting holding behavior in milliseconds. |
Reads a value from EEPROM at the specified index.
index | The EEPROM address to read from. |
Reads a value from EEPROM at the specified index.
index | The EEPROM address to read from. |
Reads a value from EEPROM at the specified index.
index | The EEPROM address to read from. |
Resets the I2C bus to recover from communication issues.
Sets a default value for a specific menu.
menu | The menu index to set the default value for. |
value | The default value to set. |
Referenced by Menu::SetDefaultEntries().
Sets a default value for a specific menu.
menu | The menu index to set the default value for. |
value | The default value to set. |
Sets a default value for a specific menu.
menu | The menu index to set the default value for. |
value | The default value to set. |
Marks the menu system as initialized.
Referenced by Menu::SetDefaultEntries().
Marks the menu system as initialized.
Marks the menu system as initialized.
Sets the maximum value for a specific menu.
menu | The menu index to set the maximum value for. |
maxValue | The maximum value to set. |
Referenced by Menu::SetMaxEntries().
Sets the maximum value for a specific menu.
menu | The menu index to set the maximum value for. |
maxValue | The maximum value to set. |
Sets the maximum value for a specific menu.
menu | The menu index to set the maximum value for. |
maxValue | The maximum value to set. |
Updates the menu state and processes user interactions.
Referenced by Menu::Update().
Updates the menu system and processes button input.
Updates the button state and menu navigation.
Generates a color value based on a position on a color wheel.
WheelPos | The position on the color wheel (0-255). |
Writes a value to EEPROM at the specified index.
index | The EEPROM address to write to. |
value | The value to write to EEPROM. |
Writes a value to EEPROM at the specified index.
index | The EEPROM address to write to. |
value | The value to write to EEPROM. |
Writes a value to EEPROM at the specified index.
index | The EEPROM address to write to. |
value | The value to write to EEPROM. |
Index of the currently active menu.
Definition at line 32 of file NeoTrellisMenuHandler.h.
Index of the currently active setting within the menu.
Definition at line 33 of file NeoTrellisMenuHandler.h.
Array of current values for each menu.
Definition at line 34 of file NeoTrellisMenuHandler.h.
Flag indicating whether the initialization process has been completed.
Definition at line 39 of file NeoTrellisMenuHandler.h.
Number of face choices available.
Definition at line 36 of file NeoTrellisMenuHandler.h.
Indicates whether the button is in a holding state.
Definition at line 39 of file SingleButtonMenuHandler.h.
Time threshold for detecting holding behavior in milliseconds.
Definition at line 34 of file SingleButtonMenuHandler.h.
Number of Morse code inputs received.
Definition at line 31 of file SingleButtonMorseHandler.h.
Buffer for storing Morse code input.
Definition at line 32 of file SingleButtonMorseHandler.h.
Flag indicating whether the menu system is ready for interaction.
Definition at line 38 of file NeoTrellisMenuHandler.h.
Array of maximum values for each menu.
Definition at line 35 of file NeoTrellisMenuHandler.h.
Flag indicating whether the menu is active.
Definition at line 37 of file NeoTrellisMenuHandler.h.
|
staticprivate |
Timer for handling menu change intervals.
Definition at line 32 of file SingleButtonMenuHandler.h.
The pin number associated with the button.
Definition at line 38 of file SingleButtonMenuHandler.h.
Tracks the last button press time in milliseconds.
Definition at line 30 of file SingleButtonMorseHandler.h.
Tracks the last hold event time in milliseconds.
Definition at line 33 of file SingleButtonMenuHandler.h.
Tracks the previous state of the button.
Definition at line 40 of file SingleButtonMenuHandler.h.
|
staticprivate |
Instance of the Adafruit NeoTrellis keypad.
Definition at line 31 of file NeoTrellisMenuHandler.h.