Rename the beta implementation to be Model01Beta

pull/18/head
Jesse Vincent 9 years ago
parent 0f92dc4943
commit 0400670487

@ -3,38 +3,38 @@
#include "Model01Beta.h" #include "Model01Beta.h"
sx1509Class KeyboardHardware_::leftsx1509(LEFT_SX1509_ADDRESS); sx1509Class Model01Beta_::leftsx1509(LEFT_SX1509_ADDRESS);
sx1509Class KeyboardHardware_::rightsx1509(RIGHT_SX1509_ADDRESS); sx1509Class Model01Beta_::rightsx1509(RIGHT_SX1509_ADDRESS);
WS2812 KeyboardHardware_::LED(LED_COUNT); WS2812 Model01Beta_::LED(LED_COUNT);
KeyboardHardware_::KeyboardHardware_(void) { Model01Beta_::Model01Beta_(void) {
} }
void KeyboardHardware_::leds_setup() { void Model01Beta_::leds_setup() {
LED.setOutput(LED_DATA_PIN); LED.setOutput(LED_DATA_PIN);
LED.setColorOrderGRB(); // Uncomment for RGB color order LED.setColorOrderGRB(); // Uncomment for RGB color order
} }
void KeyboardHardware_::led_set_crgb_at(byte row, byte col, cRGB color) { void Model01Beta_::led_set_crgb_at(byte row, byte col, cRGB color) {
LED.set_crgb_at(key_led_map[row][col], color); LED.set_crgb_at(key_led_map[row][col], color);
} }
cRGB KeyboardHardware_::get_key_color(byte row, byte col) { cRGB Model01Beta_::get_key_color(byte row, byte col) {
return LED.get_crgb_at(key_led_map[row][col]); return LED.get_crgb_at(key_led_map[row][col]);
} }
void KeyboardHardware_::led_set_crgb_at(uint8_t i, cRGB crgb) { void Model01Beta_::led_set_crgb_at(uint8_t i, cRGB crgb) {
LED.set_crgb_at(i, crgb); LED.set_crgb_at(i, crgb);
} }
void KeyboardHardware_::led_sync() { void Model01Beta_::led_sync() {
LED.sync(); LED.sync();
} }
void KeyboardHardware_::scan_row(byte row) { void Model01Beta_::scan_row(byte row) {
if (left_initted) { if (left_initted) {
leftsx1509.updatePinState(left_rowpins[row], LOW); leftsx1509.updatePinState(left_rowpins[row], LOW);
leftsx1509.sendPinStates(); leftsx1509.sendPinStates();
@ -47,14 +47,14 @@ void KeyboardHardware_::scan_row(byte row) {
} }
} }
void KeyboardHardware_::finish_scanning_row(byte row) { void Model01Beta_::finish_scanning_row(byte row) {
if (left_initted) if (left_initted)
leftsx1509.updatePinState(left_rowpins[row], HIGH); leftsx1509.updatePinState(left_rowpins[row], HIGH);
if (right_initted) if (right_initted)
rightsx1509.updatePinState(right_rowpins[row], HIGH); rightsx1509.updatePinState(right_rowpins[row], HIGH);
} }
void KeyboardHardware_::scan_left_col(byte row, byte col,uint8_t *state) { void Model01Beta_::scan_left_col(byte row, byte col,uint8_t *state) {
//If we see an electrical connection on I->J, //If we see an electrical connection on I->J,
@ -68,7 +68,7 @@ void KeyboardHardware_::scan_left_col(byte row, byte col,uint8_t *state) {
} }
} }
void KeyboardHardware_::scan_right_col(byte row, byte col, uint8_t *state) { void Model01Beta_::scan_right_col(byte row, byte col, uint8_t *state) {
//If we see an electrical connection on I->J, //If we see an electrical connection on I->J,
@ -86,7 +86,7 @@ void KeyboardHardware_::scan_right_col(byte row, byte col, uint8_t *state) {
boolean KeyboardHardware_::right_hand_connected(void) { boolean Model01Beta_::right_hand_connected(void) {
if (right_initted) { if (right_initted) {
return true; return true;
} else { } else {
@ -94,24 +94,24 @@ boolean KeyboardHardware_::right_hand_connected(void) {
} }
} }
void KeyboardHardware_::pins_setup() { void Model01Beta_::pins_setup() {
right_initted = setup_sx1509(rightsx1509, right_colpins, right_rowpins); right_initted = setup_sx1509(rightsx1509, right_colpins, right_rowpins);
left_initted = setup_sx1509(leftsx1509, left_colpins, left_rowpins); left_initted = setup_sx1509(leftsx1509, left_colpins, left_rowpins);
rightsx1509.fetchPinStates(); rightsx1509.fetchPinStates();
} }
void KeyboardHardware_::make_input(sx1509Class sx1509, uint8_t pin) { void Model01Beta_::make_input(sx1509Class sx1509, uint8_t pin) {
sx1509.pinDir(pin, INPUT); // Set SX1509 pin 1 as an input sx1509.pinDir(pin, INPUT); // Set SX1509 pin 1 as an input
sx1509.writePin(pin, HIGH); // Activate pull-up sx1509.writePin(pin, HIGH); // Activate pull-up
} }
void KeyboardHardware_::make_output(sx1509Class sx1509, uint8_t pin) { void Model01Beta_::make_output(sx1509Class sx1509, uint8_t pin) {
sx1509.pinDir(pin, OUTPUT); sx1509.pinDir(pin, OUTPUT);
sx1509.writePin(pin, HIGH); sx1509.writePin(pin, HIGH);
} }
int KeyboardHardware_::setup_sx1509 (sx1509Class sx1509, uint8_t colpins[], uint8_t rowpins[]) { int Model01Beta_::setup_sx1509 (sx1509Class sx1509, uint8_t colpins[], uint8_t rowpins[]) {
byte initted; byte initted;
for (int counter = 0; counter < 10; counter++) { for (int counter = 0; counter < 10; counter++) {
@ -148,4 +148,4 @@ int KeyboardHardware_::setup_sx1509 (sx1509Class sx1509, uint8_t colpins[], uint
} }
KeyboardHardware_ KeyboardHardware; Model01Beta_ KeyboardHardware;

@ -32,9 +32,9 @@ static uint8_t right_rowpins[]= {8,9,10,11};
#define KEYMAP_LIST KEYMAP_QWERTY KEYMAP_GENERIC_FN2 KEYMAP_NUMPAD #define KEYMAP_LIST KEYMAP_QWERTY KEYMAP_GENERIC_FN2 KEYMAP_NUMPAD
class KeyboardHardware_ { class Model01Beta_ {
public: public:
KeyboardHardware_(void); Model01Beta_(void);
void led_sync(void); void led_sync(void);
void led_set_crgb_at(byte row, byte col, cRGB color); void led_set_crgb_at(byte row, byte col, cRGB color);
void led_set_crgb_at(uint8_t i, cRGB crgb); void led_set_crgb_at(uint8_t i, cRGB crgb);
@ -140,4 +140,4 @@ static const uint8_t key_led_map[4][16] = {
#define LED_APOSTROPHE 62 #define LED_APOSTROPHE 62
#define LED_MINUS 63 #define LED_MINUS 63
extern KeyboardHardware_ KeyboardHardware; extern Model01Beta_ KeyboardHardware;

Loading…
Cancel
Save