Co-authored-by: alexo <alex-ong>pull/18684/head
@ -1,48 +0,0 @@ | |||
/* | |||
Copyright 2012 Jun Wako <wakojun@gmail.com> | |||
This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation, either version 2 of the License, or | |||
(at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#include "config_common.h" | |||
/* key matrix size */ | |||
#define MATRIX_ROWS 5 | |||
#define MATRIX_COLS 13 | |||
#define DEBOUNCE 10 | |||
/* layer optimization */ | |||
#define LAYER_STATE_8BIT | |||
#define MAX_LAYER 2 | |||
//debug scanrate | |||
//#define DEBUG_MATRIX_SCAN_RATE | |||
//debug scans taking longer than one ms | |||
//#define BENCHMARK_MATRIX | |||
#define MATRIX_IO_DELAY 15 | |||
/* | |||
* Keyboard Matrix Assignments | |||
* | |||
* Change this to how you wired your keyboard | |||
* COLS: AVR pins used for columns, left to right | |||
* ROWS: AVR pins used for rows, top to bottom | |||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) | |||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) | |||
* | |||
*/ | |||
#define MATRIX_ROW_PINS { D3, D2, D1, D0, D4 } | |||
#define MATRIX_COL_PINS { C6, D7, E6, B4, B5, B6, B2, B3, B1, F7, F6, F5, F4 } | |||
/* COL2ROW or ROW2COL */ | |||
#define DIODE_DIRECTION COL2ROW |
@ -1,78 +0,0 @@ | |||
{ | |||
"keyboard_name": "XeaLous Brown Keyboard", | |||
"manufacturer": "XeaL", | |||
"url": "", | |||
"maintainer": "qmk", | |||
"usb": { | |||
"vid": "0xFEED", | |||
"pid": "0x606A", | |||
"device_version": "0.0.2" | |||
}, | |||
"layouts": { | |||
"LAYOUT_60_ansi": { | |||
"layout": [ | |||
{"label":"`", "x":0, "y":0}, | |||
{"label":"1", "x":1, "y":0}, | |||
{"label":"2", "x":2, "y":0}, | |||
{"label":"3", "x":3, "y":0}, | |||
{"label":"4", "x":4, "y":0}, | |||
{"label":"5", "x":5, "y":0}, | |||
{"label":"6", "x":6, "y":0}, | |||
{"label":"7", "x":7, "y":0}, | |||
{"label":"8", "x":8, "y":0}, | |||
{"label":"9", "x":9, "y":0}, | |||
{"label":"0", "x":10, "y":0}, | |||
{"label":"-", "x":11, "y":0}, | |||
{"label":"=", "x":12, "y":0}, | |||
{"label":"Backspace", "x":13, "y":0, "w":2}, | |||
{"label":"Tab", "x":0, "y":1, "w":1.5}, | |||
{"label":"Q", "x":1.5, "y":1}, | |||
{"label":"W", "x":2.5, "y":1}, | |||
{"label":"E", "x":3.5, "y":1}, | |||
{"label":"R", "x":4.5, "y":1}, | |||
{"label":"T", "x":5.5, "y":1}, | |||
{"label":"Y", "x":6.5, "y":1}, | |||
{"label":"U", "x":7.5, "y":1}, | |||
{"label":"I", "x":8.5, "y":1}, | |||
{"label":"O", "x":9.5, "y":1}, | |||
{"label":"P", "x":10.5, "y":1}, | |||
{"label":"[", "x":11.5, "y":1}, | |||
{"label":"]", "x":12.5, "y":1}, | |||
{"label":"\\", "x":13.5, "y":1, "w":1.5}, | |||
{"label":"Caps Lock", "x":0, "y":2, "w":1.75}, | |||
{"label":"A", "x":1.75, "y":2}, | |||
{"label":"S", "x":2.75, "y":2}, | |||
{"label":"D", "x":3.75, "y":2}, | |||
{"label":"F", "x":4.75, "y":2}, | |||
{"label":"G", "x":5.75, "y":2}, | |||
{"label":"H", "x":6.75, "y":2}, | |||
{"label":"J", "x":7.75, "y":2}, | |||
{"label":"K", "x":8.75, "y":2}, | |||
{"label":"L", "x":9.75, "y":2}, | |||
{"label":";", "x":10.75, "y":2}, | |||
{"label":"'", "x":11.75, "y":2}, | |||
{"label":"Enter", "x":12.75, "y":2, "w":2.25}, | |||
{"label":"Shift", "x":0, "y":3, "w":2.25}, | |||
{"label":"Z", "x":2.25, "y":3}, | |||
{"label":"X", "x":3.25, "y":3}, | |||
{"label":"C", "x":4.25, "y":3}, | |||
{"label":"V", "x":5.25, "y":3}, | |||
{"label":"B", "x":6.25, "y":3}, | |||
{"label":"N", "x":7.25, "y":3}, | |||
{"label":"M", "x":8.25, "y":3}, | |||
{"label":",", "x":9.25, "y":3}, | |||
{"label":".", "x":10.25, "y":3}, | |||
{"label":"/", "x":11.25, "y":3}, | |||
{"label":"Shift", "x":12.25, "y":3, "w":2.75}, | |||
{"label":"Ctrl", "x":0, "y":4, "w":1.25}, | |||
{"label":"GUI", "x":1.25, "y":4, "w":1.25}, | |||
{"label":"Alt", "x":2.5, "y":4, "w":1.25}, | |||
{"label":"Space", "x":3.75, "y":4, "w":6.25}, | |||
{"label":"Alt", "x":10, "y":4, "w":1.25}, | |||
{"label":"GUI", "x":11.25, "y":4, "w":1.25}, | |||
{"label":"Menu", "x":12.5, "y":4, "w":1.25}, | |||
{"label":"Ctrl", "x":13.75, "y":4, "w":1.25} | |||
] | |||
} | |||
} | |||
} |
@ -1,33 +0,0 @@ | |||
/* Copyright 2019 Alex Ong | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include QMK_KEYBOARD_H | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[0] = LAYOUT_60_ansi( /* Main layer */ | |||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, | |||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | |||
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, | |||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, | |||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL | |||
), | |||
[1] = LAYOUT_60_ansi( /* FN_Layer */ | |||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, | |||
KC_CAPS, KC_PGUP, KC_UP, KC_PGDN, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, KC_TRNS, | |||
KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_HOME, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_DEL, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, | |||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS | |||
) | |||
}; |
@ -1,115 +0,0 @@ | |||
/* | |||
Copyright 2019 Alex Ong | |||
This program is free software: you can redistribute it and/or modify | |||
it under the terms of the GNU General Public License as published by | |||
the Free Software Foundation, either version 2 of the License, or | |||
(at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU General Public License for more details. | |||
You should have received a copy of the GNU General Public License | |||
along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include <stdint.h> | |||
#include <stdbool.h> | |||
#include "wait.h" | |||
#include "util.h" | |||
#include "matrix.h" | |||
#include "debounce.h" | |||
#include "quantum.h" | |||
/* matrix state(1:on, 0:off) */ | |||
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | |||
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values | |||
// matrix code | |||
// super fast read_cols code. | |||
static inline matrix_row_t read_cols(void) { | |||
return (PINC & (1 << 6) ? 0 : (1UL << 0)) | | |||
(PIND & (1 << 7) ? 0 : (1UL << 1)) | | |||
(PINE & (1 << 6) ? 0 : (1UL << 2)) | | |||
(PINB & (1 << 4) ? 0 : (1UL << 3)) | | |||
(PINB & (1 << 5) ? 0 : (1UL << 4)) | | |||
(PINB & (1 << 6) ? 0 : (1UL << 5)) | | |||
(PINB & (1 << 2) ? 0 : (1UL << 6)) | | |||
(PINB & (1 << 3) ? 0 : (1UL << 7)) | | |||
(PINB & (1 << 1) ? 0 : (1UL << 8)) | | |||
(PINF & (1 << 7) ? 0 : (1UL << 9)) | | |||
(PINF & (1 << 6) ? 0 : (1UL << 10)) | | |||
(PINF & (1 << 5) ? 0 : (1UL << 11)) | | |||
(PINF & (1 << 4) ? 0 : (1UL << 12)); | |||
} | |||
static void unselect_rows(void) { | |||
DDRD &= ~0b00011111; | |||
PORTD &= ~0b00011111; | |||
} | |||
static void select_row(uint8_t row) { | |||
switch (row) { | |||
case 0: | |||
DDRD |= (1 << 3); | |||
PORTD &= ~(1 << 3); | |||
break; | |||
case 1: | |||
DDRD |= (1 << 2); | |||
PORTD &= ~(1 << 2); | |||
break; | |||
case 2: | |||
DDRD |= (1 << 1); | |||
PORTD &= ~(1 << 1); | |||
break; | |||
case 3: | |||
DDRD |= (1 << 0); | |||
PORTD &= ~(1 << 0); | |||
break; | |||
case 4: | |||
DDRD |= (1 << 4); | |||
PORTD &= ~(1 << 4); | |||
break; | |||
} | |||
} | |||
static void init_pins(void) { | |||
DDRC &= ~(1 << 6); | |||
PORTC |= (1 << 6); | |||
DDRD &= ~(1 << 7); | |||
PORTD |= (1 << 7); | |||
DDRE &= ~(1 << 6); | |||
PORTE |= (1 << 6); | |||
DDRB &= ~(1 << 4 | 1 << 5 | 1 << 6 | 1 << 2 | 1 << 3 | 1 << 1); | |||
PORTB |= (1 << 4 | 1 << 5 | 1 << 6 | 1 << 2 | 1 << 3 | 1 << 1); | |||
DDRF &= ~(1 << 7 | 1 << 6 | 1 << 5 | 1 << 4); | |||
PORTF |= (1 << 7 | 1 << 6 | 1 << 5 | 1 << 4); | |||
} | |||
// Only need to init the pins. Debounce / raw matrix are initialized already for us. | |||
void matrix_init_custom(void) { | |||
// initialize key pins | |||
init_pins(); | |||
} | |||
// Only need to scan the result into current_matrix, and return changed. | |||
uint8_t matrix_scan_custom(matrix_row_t current_matrix[]) { | |||
bool changed = false; | |||
// Set row, read cols | |||
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { | |||
select_row(current_row); | |||
matrix_output_unselect_delay(current_row, changed); | |||
matrix_row_t cols = read_cols(); | |||
changed |= (current_matrix[current_row] != cols); | |||
current_matrix[current_row] = cols; | |||
unselect_rows(); | |||
//this internally calls matrix_io_delay() | |||
matrix_output_unselect_delay(current_row, changed); | |||
} | |||
return changed; | |||
} |
@ -1,25 +0,0 @@ | |||
# XealouS Brown | |||
My first handwired keyboard. Originally used TMK, now ported in full glory to QMK. | |||
Build log at: | |||
https://sites.google.com/site/xaelous/keyboards/handwired-keyboard | |||
* Keyboard Maintainer: [alex-ong](https://github.com/alex-ong) | |||
* Hardware Supported: Arduino Pro Micro or clone | |||
Make example for this keyboard (after setting up your build environment): | |||
make handwired/xealousbrown:default | |||
The brief list of speedhacks to make this keyboard blazing fast: | |||
1) bit-bash implementation of scanning rows, columns. Very short delay between pin waiting. | |||
2) Compiling with a few extra flags | |||
3) Eager-per-key Debouncing algorithm (no 5ms delay before message is sent) | |||
4) 1000hz polling | |||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the | |||
[make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. | |||
Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). |
@ -1,29 +0,0 @@ | |||
# MCU name | |||
MCU = atmega32u4 | |||
# Bootloader selection | |||
BOOTLOADER = caterina | |||
# Build Options | |||
# change yes to no to disable | |||
# | |||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | |||
MOUSEKEY_ENABLE = no # Mouse keys | |||
EXTRAKEY_ENABLE = yes # Audio control and System control | |||
CONSOLE_ENABLE = yes # Console for debug | |||
COMMAND_ENABLE = yes # Commands for debug and configuration | |||
NKRO_ENABLE = yes # Enable N-Key Rollover | |||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | |||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | |||
AUDIO_ENABLE = no # Audio output | |||
SPACE_CADET_ENABLE = no # Unneeded feature. | |||
LAYOUTS = 60_ansi | |||
# special sauce for this keyboard | |||
DEBOUNCE_TYPE = sym_eager_pk # Debounce using eager_pk. | |||
CUSTOM_MATRIX = lite # Custom matrix that polls at 7000hz instead of a measly 2000hz. | |||
LTO_ENABLE = yes # smaller binary | |||
SRC += matrix.c | |||
# Also remember to open tmk's rules.mk and set compilation optimization to 3 |
@ -1,51 +0,0 @@ | |||
/* Copyright 2019 Alex Ong | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#include "xealousbrown.h" | |||
#ifdef BENCHMARK_MATRIX | |||
# include "timer.h" | |||
# include <stdint.h> | |||
# include <stdbool.h> | |||
# include "wait.h" | |||
# include "util.h" | |||
# include "matrix.h" | |||
# include "quantum.h" | |||
static int scans = 0; | |||
static uint16_t last_print_out = 0; | |||
static int last_timer = 0; | |||
void matrix_scan_user(void) { | |||
scans++; | |||
uint16_t timer = timer_read(); | |||
if (timer != last_timer && timer != last_timer + 1) { | |||
print("MS:\n"); | |||
print_dec(timer); | |||
print("->"); | |||
print_dec(last_timer); | |||
print("\n"); | |||
} | |||
last_timer = timer; | |||
if ((timer % 1000 == 0) && (timer != last_print_out)) { | |||
print("Scans: "); | |||
print_dec(scans); | |||
print("\n"); | |||
scans = 0; | |||
last_print_out = timer; | |||
} | |||
} | |||
#endif |
@ -1,32 +0,0 @@ | |||
/* Copyright 2019 Alex Ong | |||
* | |||
* This program is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
#pragma once | |||
#include "quantum.h" | |||
#define LAYOUT_60_ansi( \ | |||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K4C, \ | |||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K3C, \ | |||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \ | |||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \ | |||
K40, K41, K42, K45, K46, K47, K48, K49 \ | |||
) { \ | |||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C }, \ | |||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C }, \ | |||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C }, \ | |||
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C }, \ | |||
{ K40, K41, K42, KC_NO, KC_NO, K45, K46, K47, K48, K49, KC_NO, KC_NO, K4C } \ | |||
} |