Hide the keyboard setup/loop in helpers

Primarily so we can use the Keyboardio_ constructor later to initialize
things for us.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/27/head
Gergely Nagy 8 years ago
parent a5f3b98c79
commit 79ddb15c3b

@ -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();
}

@ -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;

@ -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();
}

Loading…
Cancel
Save