From 7cd12868106554e894ab82bcdf8a1129b39880f4 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 31 Jan 2016 22:44:54 -0800 Subject: [PATCH] simplify the 'setup' API for the hardware --- KeyboardioFirmware.ino | 3 +-- implementation/Model01Beta.cpp | 4 ++++ implementation/Model01Beta.h | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/KeyboardioFirmware.ino b/KeyboardioFirmware.ino index 87df894b..370b3a1d 100644 --- a/KeyboardioFirmware.ino +++ b/KeyboardioFirmware.ino @@ -18,8 +18,7 @@ void setup() { Keyboard.begin(); Mouse.begin(); AbsoluteMouse.begin(); - KeyboardHardware.leds_setup(); - KeyboardHardware.pins_setup(); + KeyboardHardware.setup(); LEDControl.boot_animation(); temporary_keymap = primary_keymap = Storage.load_primary_keymap(KEYMAPS); diff --git a/implementation/Model01Beta.cpp b/implementation/Model01Beta.cpp index bf6b1df5..94d295cc 100644 --- a/implementation/Model01Beta.cpp +++ b/implementation/Model01Beta.cpp @@ -13,6 +13,10 @@ Model01Beta_::Model01Beta_(void) { } +void Model01Beta_::setup(void) { + pins_setup(); + leds_setup(); +} void Model01Beta_::leds_setup() { LED.setOutput(LED_DATA_PIN); LED.setColorOrderGRB(); // Uncomment for RGB color order diff --git a/implementation/Model01Beta.h b/implementation/Model01Beta.h index c57053c1..b062477c 100644 --- a/implementation/Model01Beta.h +++ b/implementation/Model01Beta.h @@ -38,9 +38,7 @@ class Model01Beta_ { cRGB get_key_color(byte row, byte col); void scan_matrix(void); - - void pins_setup(); - void leds_setup(); + void setup(); private: @@ -51,6 +49,8 @@ class Model01Beta_ { int left_initted = 0; boolean right_hand_connected(void); + void pins_setup(); + void leds_setup(); void scan_row(byte row); void finish_scanning_row(byte row); void scan_right_col(byte row, byte col, uint8_t *state);