You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kaleidoscope/KeyboardioFirmware.ino

54 lines
1.3 KiB

// Copyright 2015 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#define DEBUG_SERIAL false
#include "KeyboardioFirmware.h"
#include "KeyboardioHID.h"
9 years ago
9 years ago
uint8_t matrixState[ROWS][COLS] = {0};
const Key keymaps[KEYMAPS][ROWS][COLS] = { KEYMAP_LIST };
uint8_t primary_keymap = 0;
uint8_t temporary_keymap = 0;
11 years ago
9 years ago
void scan_matrix() {
//scan the Keyboard matrix looking for connections
for (byte row = 0; row < LEFT_ROWS; row++) {
implementation_scan_row(row);
9 years ago
for (byte col = 0; col < LEFT_COLS; col++) {
implementation_scan_left_col(row,col,&matrixState[row][col]);
handle_key_event(row, col);
9 years ago
if (implementation_right_hand_connected()) {
implementation_scan_right_col(row,col,&matrixState[row][(COLS - 1) - col]);
handle_key_event(row, (COLS - 1) - col);
}
9 years ago
}
implementation_finish_scanning_row(row);
11 years ago
}
}
9 years ago
void setup() {
wdt_disable();
Keyboard.begin();
Mouse.begin();
implementation_leds_setup();
LEDControl.boot_animation();
implementation_pins_setup();
9 years ago
temporary_keymap = primary_keymap = Storage.load_primary_keymap(KEYMAPS);
11 years ago
}
9 years ago
void loop() {
scan_matrix();
Keyboard.sendReport();
Keyboard.releaseAll();
LEDControl.update(temporary_keymap);
11 years ago
}