diff --git a/KeyboardioFirmware.cpp b/KeyboardioFirmware.cpp new file mode 100644 index 00000000..8ad84dbb --- /dev/null +++ b/KeyboardioFirmware.cpp @@ -0,0 +1,26 @@ +#include "KeyboardioFirmware.h" + +Keyboardio_::Keyboardio_(void) { +} + +void +Keyboardio_::setup(void) { + wdt_disable(); + delay(100); + Keyboard.begin(); + Mouse.begin(); + AbsoluteMouse.begin(); + KeyboardHardware.setup(); + LEDControl.boot_animation(); + + temporary_keymap = primary_keymap = Storage.load_primary_keymap(KEYMAPS); +} + +void +Keyboardio_::loop(void) { + KeyboardHardware.scan_matrix(); + LEDControl.update(temporary_keymap); + Keyboard.sendReport(); + Keyboard.releaseAll(); +} + diff --git a/KeyboardioFirmware.h b/KeyboardioFirmware.h index b1919389..a88821cc 100644 --- a/KeyboardioFirmware.h +++ b/KeyboardioFirmware.h @@ -34,3 +34,12 @@ extern uint8_t temporary_keymap; #define VERSION "locally-built" #endif +class Keyboardio_ { + public: + Keyboardio_(void); + + void setup(void); + void loop(void); +}; + +static Keyboardio_ Keyboardio; diff --git a/KeyboardioFirmware.ino b/KeyboardioFirmware.ino index a267f412..def1b25f 100644 --- a/KeyboardioFirmware.ino +++ b/KeyboardioFirmware.ino @@ -4,30 +4,17 @@ #define DEBUG_SERIAL false #include "KeyboardioFirmware.h" -#include "KeyboardioHID.h" - uint8_t primary_keymap = 0; uint8_t temporary_keymap = 0; void setup() { - wdt_disable(); - delay(100); - Keyboard.begin(); - Mouse.begin(); - AbsoluteMouse.begin(); - KeyboardHardware.setup(); - LEDControl.boot_animation(); - - temporary_keymap = primary_keymap = Storage.load_primary_keymap(KEYMAPS); + Keyboardio.setup(); } void loop() { - KeyboardHardware.scan_matrix(); - LEDControl.update(temporary_keymap); - Keyboard.sendReport(); - Keyboard.releaseAll(); + Keyboardio.loop(); }