cleanup
This commit is contained in:
13
main.c
13
main.c
@ -38,7 +38,7 @@ typedef enum _Mode
|
||||
|
||||
/** Global flags */
|
||||
volatile bool bLedEnabled = true;
|
||||
volatile bool bBtnLongPressed = false;
|
||||
volatile bool bBtnPressed = false;
|
||||
volatile eMode eModeCurrent = ANIMATION_BLINK;
|
||||
|
||||
// Forward declarations
|
||||
@ -65,19 +65,18 @@ int main(void)
|
||||
VPORTA.DIR &= ~BUTTON_PIN_MASK; // Input
|
||||
PORTA.PIN0CTRL = PORT_PULLUPEN_bm; // Pull-up enabled
|
||||
|
||||
// Ensure all LEDs off at startup
|
||||
leds_off();
|
||||
leds_off(); // Ensure all LEDs off at startup
|
||||
battery_level_indicator(); // TODO: Implement
|
||||
|
||||
bool bLedEnabledOld = bLedEnabled;
|
||||
eModeCurrent = ANIMATION_BLINK;
|
||||
eModeCurrent = ANIMATION_BLINK; // Set the mode to start with
|
||||
|
||||
while (true)
|
||||
{
|
||||
bBtnLongPressed = handleSwitch(); // Check switch state
|
||||
bBtnPressed = handleSwitch(); // Check switch state
|
||||
|
||||
// Light LEDs while button is pressed
|
||||
if (bBtnLongPressed)
|
||||
if (bBtnPressed)
|
||||
{
|
||||
leds_on();
|
||||
}
|
||||
@ -115,7 +114,7 @@ int main(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bLedEnabled && !bBtnLongPressed)
|
||||
if (bLedEnabled && !bBtnPressed)
|
||||
{
|
||||
switch (eModeCurrent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user