diff --git a/examples/KeyboardioFirmware/KeyboardioFirmware.ino b/examples/KeyboardioFirmware/KeyboardioFirmware.ino index 9f342368..9c0247d0 100644 --- a/examples/KeyboardioFirmware/KeyboardioFirmware.ino +++ b/examples/KeyboardioFirmware/KeyboardioFirmware.ino @@ -7,7 +7,8 @@ #include "KeyboardioFirmware.h" #include "generated/keymaps.h" -#include "LED-BootAnimation.h" +#include "BootAnimation.h" +#include "LED-Off.h" #include "LED-SolidColor.h" #include "LED-Numlock.h" #include "LED-BreatheEffect.h" @@ -23,7 +24,7 @@ uint8_t temporary_keymap = 0; const Key keymaps[][ROWS][COLS] PROGMEM = { KEYMAP_LIST }; -static LEDBootAnimation bootAnimation; +static LEDOff LEDSOff; static LEDSolidColor solidRed (100, 0, 0); static LEDSolidColor solidOrange (100, 30, 0); static LEDSolidColor solidYellow (90, 70, 0); @@ -41,6 +42,7 @@ static LEDNumlock numLockEffect (NUMPAD_KEYMAP); void setup() { Keyboardio.setup(KEYMAPS); + bootAnimation(); } diff --git a/src/LED-BootAnimation.cpp b/src/BootAnimation.cpp similarity index 67% rename from src/LED-BootAnimation.cpp rename to src/BootAnimation.cpp index 728c4eb1..d5f973b7 100644 --- a/src/LED-BootAnimation.cpp +++ b/src/BootAnimation.cpp @@ -1,4 +1,8 @@ -#include "LED-BootAnimation.h" +#include "BootAnimation.h" +#include "KeyboardConfig.h" +#include "EEPROM.h" + +#define EEPROM_BOOT_ANIMATION_LOCATION 1 static void type_letter(uint8_t letter) { @@ -10,12 +14,11 @@ type_letter(uint8_t letter) { delay(10); } -LEDBootAnimation::LEDBootAnimation (void) { - LEDControl.mode_add (this); -} - void -LEDBootAnimation::setup (void) { +bootAnimation (void) { + if (EEPROM.read (EEPROM_BOOT_ANIMATION_LOCATION)) + return; + LEDControl.set_all_leds_to(0, 0, 0); type_letter(LED_K); @@ -32,4 +35,6 @@ LEDBootAnimation::setup (void) { type_letter(LED_0); type_letter(LED_PERIOD); type_letter(LED_9); + + EEPROM.update (EEPROM_BOOT_ANIMATION_LOCATION, 1); } diff --git a/src/BootAnimation.h b/src/BootAnimation.h new file mode 100644 index 00000000..f8b49cac --- /dev/null +++ b/src/BootAnimation.h @@ -0,0 +1,3 @@ +#pragma once + +void bootAnimation(void); diff --git a/src/LED-BootAnimation.h b/src/LED-BootAnimation.h deleted file mode 100644 index dcd4f616..00000000 --- a/src/LED-BootAnimation.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "LEDControl.h" - -class LEDBootAnimation : LEDMode { - public: - LEDBootAnimation (void); - - virtual void setup (void) final; -}; diff --git a/src/LED-Off.h b/src/LED-Off.h new file mode 100644 index 00000000..daae9150 --- /dev/null +++ b/src/LED-Off.h @@ -0,0 +1,8 @@ +#pragma once + +#include "LEDControl.h" + +class LEDOff : LEDMode { + public: + LEDOff (void) { LEDControl.mode_add (this); }; +};