From 59fbee75916f50728831d1a42abaf70e1413ea83 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 1 Feb 2016 20:50:31 -0800 Subject: [PATCH] Beginning to implement the ATTiny based firmwaare --- implementation/Model01.cpp | 16 ++++++---------- implementation/Model01.h | 13 +++++++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/implementation/Model01.cpp b/implementation/Model01.cpp index f0dc6b7a..463d614f 100644 --- a/implementation/Model01.cpp +++ b/implementation/Model01.cpp @@ -1,20 +1,16 @@ -#include #include "Model01.h" + KeyboardioScanner Model01::leftHand(0); + KeyboardioScanner Model01::rightHand(3); Model01::Model01(void) { } void Model01::setup(void) { + Wire.begin(); } -void Model01::led_set_crgb_at(byte row, byte col, cRGB color) { -} - -cRGB Model01::get_key_color(byte row, byte col) { -} - void Model01::led_set_crgb_at(uint8_t i, cRGB crgb) { } @@ -25,11 +21,11 @@ void Model01::led_sync() { void Model01::scan_matrix() { uint8_t key_data; //scan the Keyboard matrix looking for connections - for (byte row = 0; row < LEFT_ROWS; row++) { + for (byte row = 0; row < 4; row++) { - for (byte col = 0; col < LEFT_COLS; col++) { + for (byte col = 0; col < 4; col++) { handle_key_event(row, col, &key_data); - handle_key_event(row, (COLS - 1) - col, &key_data); + handle_key_event(row, (8- 1) - col, &key_data); } } } diff --git a/implementation/Model01.h b/implementation/Model01.h index 57ba4e14..ad856f8a 100644 --- a/implementation/Model01.h +++ b/implementation/Model01.h @@ -1,18 +1,16 @@ #pragma once -#define HARDWARE_IMPLEMENTATION Model01 +#include +#define HARDWARE_IMPLEMENTATION Model01 +#include "KeyboardioScanner.h" +#include #include "../keymaps.h" #include "../key_events.h" -#define RIGHT_COLS 8 -#define RIGHT_ROWS 4 -#define LEFT_COLS 8 -#define LEFT_ROWS 4 - @@ -29,6 +27,9 @@ class Model01 { private: + static KeyboardioScanner leftHand; + static KeyboardioScanner rightHand; + static constexpr uint8_t key_led_map[4][16] = { {3,4,11,12,19,20,26,27, 36,37,43,44,51,52,59,60}, {2,5,10,13,18,21,31,28, 35,32,42,45,50,53,58,61},