aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/miniaxe/config.h245
-rw-r--r--keyboards/miniaxe/info.json12
-rw-r--r--keyboards/miniaxe/keymaps/default/keymap.c159
-rw-r--r--keyboards/miniaxe/keymaps/underglow/keymap.c159
-rw-r--r--keyboards/miniaxe/keymaps/underglow/rules.mk2
-rw-r--r--keyboards/miniaxe/matrix.c596
-rw-r--r--keyboards/miniaxe/miniaxe.c43
-rw-r--r--keyboards/miniaxe/miniaxe.h50
-rw-r--r--keyboards/miniaxe/readme.md16
-rw-r--r--keyboards/miniaxe/rules.mk88
10 files changed, 1370 insertions, 0 deletions
diff --git a/keyboards/miniaxe/config.h b/keyboards/miniaxe/config.h
new file mode 100644
index 000000000..13608feab
--- /dev/null
+++ b/keyboards/miniaxe/config.h
@@ -0,0 +1,245 @@
1/*
2Copyright 2018 ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x3939
25#define DEVICE_VER 0x0001
26#define MANUFACTURER ENDO Katsuhiro
27#define PRODUCT MiniAxe
28#define DESCRIPTION Yet another split keyboard
29
30/* key matrix size */
31#define MATRIX_ROWS 8
32#define MATRIX_COLS 5
33
34/*
35 * Keyboard Matrix Assignments
36 *
37 * Change this to how you wired your keyboard
38 * COLS: AVR pins used for columns, left to right
39 * ROWS: AVR pins used for rows, top to bottom
40 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
41 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
42 * NO_DIODE = switches are directly connected to AVR pins
43 *
44*/
45// #define MATRIX_ROW_PINS { D0, D5 }
46// #define MATRIX_COL_PINS { F1, F0, B0 }
47#define NO_PIN 0xFF
48#define MATRIX_ROW_COL_PINS { \
49 { F1, E6, B0, B2, B3 }, \
50 { F5, F0, B1, B7, D2 }, \
51 { F6, F7, C7, D5, D3 }, \
52 { B5, C6, B6, NO_PIN, NO_PIN } \
53}
54#define UNUSED_PINS
55
56/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
57#define DIODE_DIRECTION CUSTOM_MATRIX
58
59// #define BACKLIGHT_PIN B7
60// #define BACKLIGHT_BREATHING
61// #define BACKLIGHT_LEVELS 3
62
63/* Uncomment below if use underglow */
64#define RGB_DI_PIN F4
65#ifdef RGB_DI_PIN
66#define RGBLIGHT_ANIMATIONS
67#define RGBLED_NUM 6
68#define RGBLIGHT_HUE_STEP 8
69#define RGBLIGHT_SAT_STEP 8
70#define RGBLIGHT_VAL_STEP 8
71#endif
72
73/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
74#define DEBOUNCING_DELAY 5
75
76/* define if matrix has ghost (lacks anti-ghosting diodes) */
77//#define MATRIX_HAS_GHOST
78
79/* number of backlight levels */
80
81/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
82#define LOCKING_SUPPORT_ENABLE
83/* Locking resynchronize hack */
84#define LOCKING_RESYNC_ENABLE
85
86/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
87 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
88 */
89// #define GRAVE_ESC_CTRL_OVERRIDE
90
91/*
92 * Force NKRO
93 *
94 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
95 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
96 * makefile for this to work.)
97 *
98 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
99 * until the next keyboard reset.
100 *
101 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
102 * fully operational during normal computer usage.
103 *
104 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
105 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
106 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
107 * power-up.
108 *
109 */
110//#define FORCE_NKRO
111
112/*
113 * Magic Key Options
114 *
115 * Magic keys are hotkey commands that allow control over firmware functions of
116 * the keyboard. They are best used in combination with the HID Listen program,
117 * found here: https://www.pjrc.com/teensy/hid_listen.html
118 *
119 * The options below allow the magic key functionality to be changed. This is
120 * useful if your keyboard/keypad is missing keys and you want magic key support.
121 *
122 */
123
124/* key combination for magic key command */
125#define IS_COMMAND() ( \
126 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
127)
128
129/* control how magic key switches layers */
130//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
131//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
132//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
133
134/* override magic key keymap */
135//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
136//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
137//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
138//#define MAGIC_KEY_HELP1 H
139//#define MAGIC_KEY_HELP2 SLASH
140//#define MAGIC_KEY_DEBUG D
141//#define MAGIC_KEY_DEBUG_MATRIX X
142//#define MAGIC_KEY_DEBUG_KBD K
143//#define MAGIC_KEY_DEBUG_MOUSE M
144//#define MAGIC_KEY_VERSION V
145//#define MAGIC_KEY_STATUS S
146//#define MAGIC_KEY_CONSOLE C
147//#define MAGIC_KEY_LAYER0_ALT1 ESC
148//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
149//#define MAGIC_KEY_LAYER0 0
150//#define MAGIC_KEY_LAYER1 1
151//#define MAGIC_KEY_LAYER2 2
152//#define MAGIC_KEY_LAYER3 3
153//#define MAGIC_KEY_LAYER4 4
154//#define MAGIC_KEY_LAYER5 5
155//#define MAGIC_KEY_LAYER6 6
156//#define MAGIC_KEY_LAYER7 7
157//#define MAGIC_KEY_LAYER8 8
158//#define MAGIC_KEY_LAYER9 9
159//#define MAGIC_KEY_BOOTLOADER PAUSE
160//#define MAGIC_KEY_LOCK CAPS
161//#define MAGIC_KEY_EEPROM E
162//#define MAGIC_KEY_NKRO N
163//#define MAGIC_KEY_SLEEP_LED Z
164
165/*
166 * Feature disable options
167 * These options are also useful to firmware size reduction.
168 */
169
170/* disable debug print */
171//#define NO_DEBUG
172
173/* disable print */
174//#define NO_PRINT
175
176/* disable action features */
177//#define NO_ACTION_LAYER
178//#define NO_ACTION_TAPPING
179//#define NO_ACTION_ONESHOT
180//#define NO_ACTION_MACRO
181//#define NO_ACTION_FUNCTION
182
183/*
184 * MIDI options
185 */
186
187/* Prevent use of disabled MIDI features in the keymap */
188//#define MIDI_ENABLE_STRICT 1
189
190/* enable basic MIDI features:
191 - MIDI notes can be sent when in Music mode is on
192*/
193//#define MIDI_BASIC
194
195/* enable advanced MIDI features:
196 - MIDI notes can be added to the keymap
197 - Octave shift and transpose
198 - Virtual sustain, portamento, and modulation wheel
199 - etc.
200*/
201//#define MIDI_ADVANCED
202
203/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
204//#define MIDI_TONE_KEYCODE_OCTAVES 1
205
206/*
207 * HD44780 LCD Display Configuration
208 */
209/*
210#define LCD_LINES 2 //< number of visible lines of the display
211#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
212
213#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
214
215#if LCD_IO_MODE
216#define LCD_PORT PORTB //< port for the LCD lines
217#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
218#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
219#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
220#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
221#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
222#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
223#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
224#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
225#define LCD_RS_PORT LCD_PORT //< port for RS line
226#define LCD_RS_PIN 3 //< pin for RS line
227#define LCD_RW_PORT LCD_PORT //< port for RW line
228#define LCD_RW_PIN 2 //< pin for RW line
229#define LCD_E_PORT LCD_PORT //< port for Enable line
230#define LCD_E_PIN 1 //< pin for Enable line
231#endif
232*/
233
234/* Bootmagic Lite key configuration */
235// #define BOOTMAGIC_LITE_ROW 0
236// #define BOOTMAGIC_LITE_COLUMN 0
237
238/* Serial settings */
239#define USE_SERIAL
240//#define EE_HANDS
241#define I2C_MASTER_LEFT
242//#define I2C_MASTER_RIGHT
243
244#define DISABLE_JTAG
245
diff --git a/keyboards/miniaxe/info.json b/keyboards/miniaxe/info.json
new file mode 100644
index 000000000..5fee787b5
--- /dev/null
+++ b/keyboards/miniaxe/info.json
@@ -0,0 +1,12 @@
1{
2 "keyboard_name": "MiniAxe",
3 "url": "",
4 "maintainer": "ka2hiro",
5 "width": 11,
6 "height": 4,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [{"label":"Q", "x":0, "y":0}, {"label":"W", "x":1, "y":0}, {"label":"E", "x":2, "y":0}, {"label":"R", "x":3, "y":0}, {"label":"T", "x":4, "y":0}, {"label":"Y", "x":6, "y":0}, {"label":"U", "x":7, "y":0}, {"label":"I", "x":8, "y":0}, {"label":"O", "x":9, "y":0}, {"label":"P", "x":10, "y":0}, {"label":"A", "x":0, "y":1}, {"label":"S", "x":1, "y":1}, {"label":"D", "x":2, "y":1}, {"label":"F", "x":3, "y":1}, {"label":"G", "x":4, "y":1}, {"label":"J", "x":6, "y":1}, {"label":"J", "x":7, "y":1}, {"label":"K", "x":8, "y":1}, {"label":"L", "x":9, "y":1}, {"label":";", "x":10, "y":1}, {"label":"Z", "x":0, "y":2}, {"label":"X", "x":1, "y":2}, {"label":"C", "x":2, "y":2}, {"label":"V", "x":3, "y":2}, {"label":"B", "x":4, "y":2}, {"label":"N", "x":6, "y":2}, {"label":"M", "x":7, "y":2}, {"label":",", "x":8, "y":2}, {"label":".", "x":9, "y":2}, {"label":"/", "x":10, "y":2}, {"label":"Cmd", "x":2, "y":3}, {"label":"&dArr;", "x":3, "y":3}, {"label":"Ctrl", "x":4, "y":3}, {"x":6, "y":3}, {"label":"&uArr;", "x":7, "y":3}, {"label":"Opt", "x":8, "y":3}]
10 }
11 }
12}
diff --git a/keyboards/miniaxe/keymaps/default/keymap.c b/keyboards/miniaxe/keymaps/default/keymap.c
new file mode 100644
index 000000000..4b405e202
--- /dev/null
+++ b/keyboards/miniaxe/keymaps/default/keymap.c
@@ -0,0 +1,159 @@
1/* Copyright 2018 ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18// Defines the keycodes used by our macros in process_record_user
19#define _QWERTY 0
20#define _LOWER 1
21#define _RAISE 2
22#define _ADJUST 16
23
24enum custom_keycodes {
25 QWERTY = SAFE_RANGE,
26 LOWER,
27 RAISE,
28 ADJUST,
29};
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32
33/* Qwerty
34 *
35 * ,----------------------------------. ,----------------------------------.
36 * | Q | W | E | R | T | | Y | U | I | O | P |
37 * |------+------+------+------+------| |------+------+------+------+------|
38 * | A | S | D | F | G | | H | J | K | L | ; |
39 * |------+------+------+------+------| |------+------+------+------+------|
40 * | Z | X | C | V | B | | N | M | , | . | / |
41 * `-------------+------+------+------| |------+------+------+------+------'
42 * | GUI | LOWER|Ctrl/Esc| |Spc/Sft| RAISE|Alt/BkSp |
43 * `--------------------' `--------------------'
44 */
45[_QWERTY] = LAYOUT( \
46 KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \
47 KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \
48 KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
49 KC_LGUI, LOWER, MT(MOD_LCTL, KC_ESC), MT(MOD_LSFT, KC_SPC), RAISE, MT(MOD_LALT, KC_BSPC) \
50),
51
52/* Raise
53 *
54 * ,----------------------------------. ,----------------------------------.
55 * | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
56 * |------+------+------+------+------| |------+------+------+------+------|
57 * | Tab | _ | + | | | ~ | | : | " | > | { | } |
58 * |------+------+------+------+------| |------+------+------+------+------|
59 * | Caps| - | = | \ | ` | | ; | ' | < | [ | ] |
60 * `-------------+------+------+------| |------+------+------+------+------'
61 * | | LOWER| | | Esc | RAISE| |
62 * `--------------------' `--------------------'
63 */
64[_RAISE] = LAYOUT( \
65 KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
66 KC_TAB, KC_UNDS, KC_PLUS, KC_PIPE, KC_TILD, KC_COLN, KC_DQUO, KC_GT, KC_LCBR, KC_RCBR, \
67 KC_CAPS, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_SCLN, KC_QUOT, KC_LT, KC_LBRC, KC_RBRC, \
68 _______, _______, _______, _______, _______, _______\
69),
70
71/* Lower
72 *
73 * ,----------------------------------. ,----------------------------------.
74 * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
75 * |------+------+------+------+------| |------+------+------+------+------|
76 * | Tab | | | | | | Left | Down | Up | Right| Enter|
77 * |------+------+------+------+------| |------+------+------+------+------|
78 * | Ctrl| ` | GUI | Alt | Del | | BkSp | PgUp | PgDn | \ | ' |
79 * `-------------+------+------+------| |------+------+------+------+------'
80 * | | LOWER| | | | RAISE| |
81 * `--------------------' `--------------------'
82 */
83[_LOWER] = LAYOUT( \
84 KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \
85 KC_TAB, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_ENT, \
86 KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, KC_DEL, KC_BSPC, KC_PGUP, KC_PGDN, KC_BSLS, KC_QUOT, \
87 _______, _______, _______, _______, _______, _______ \
88),
89
90
91/* Adjust (Lower + Raise)
92 *
93 * ,----------------------------------. ,----------------------------------.
94 * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
95 * |------+------+------+------+------| |------+------+------+------+------|
96 * | F11 | F12 | | | | | | | | | |
97 * |------+------+------+------+------| |------+------+------+------+------|
98 * | Reset| | | | | | Prev | Next | Vol- | Vol+ | Play |
99 * `-------------+------+------+------| |------+------+------+------+------'
100 * | | LOWER| | | | RAISE| |
101 * `--------------------' `--------------------'
102 */
103[_ADJUST] = LAYOUT( \
104 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \
105 KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, _______, _______, \
106 RESET, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, \
107 _______, _______, _______, _______, _______, _______ \
108)
109};
110
111bool process_record_user(uint16_t keycode, keyrecord_t *record) {
112 switch (keycode) {
113 case QWERTY:
114 if (record->event.pressed) {
115 // persistant_default_layer_set(1UL<<_QWERTY);
116 set_single_persistent_default_layer(_QWERTY);
117 }
118 return false;
119 break;
120 case LOWER:
121 if (record->event.pressed) {
122 layer_on(_LOWER);
123 update_tri_layer(_LOWER, _RAISE, _ADJUST);
124 } else {
125 layer_off(_LOWER);
126 update_tri_layer(_LOWER, _RAISE, _ADJUST);
127 }
128 return false;
129 break;
130 case RAISE:
131 if (record->event.pressed) {
132 layer_on(_RAISE);
133 update_tri_layer(_LOWER, _RAISE, _ADJUST);
134 } else {
135 layer_off(_RAISE);
136 update_tri_layer(_LOWER, _RAISE, _ADJUST);
137 }
138 return false;
139 break;
140 case ADJUST:
141 if (record->event.pressed) {
142 layer_on(_ADJUST);
143 } else {
144 layer_off(_ADJUST);
145 }
146 return false;
147 break;
148 }
149 return true;
150}
151
152void matrix_init_user(void) {
153}
154
155void matrix_scan_user(void) {
156}
157
158void led_set_user(uint8_t usb_led) {
159}
diff --git a/keyboards/miniaxe/keymaps/underglow/keymap.c b/keyboards/miniaxe/keymaps/underglow/keymap.c
new file mode 100644
index 000000000..6325b2056
--- /dev/null
+++ b/keyboards/miniaxe/keymaps/underglow/keymap.c
@@ -0,0 +1,159 @@
1/* Copyright 2018 ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17
18// Defines the keycodes used by our macros in process_record_user
19#define _QWERTY 0
20#define _LOWER 1
21#define _RAISE 2
22#define _ADJUST 16
23
24enum custom_keycodes {
25 QWERTY = SAFE_RANGE,
26 LOWER,
27 RAISE,
28 ADJUST,
29};
30
31const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32
33/* Qwerty
34 *
35 * ,----------------------------------. ,----------------------------------.
36 * | Q | W | E | R | T | | Y | U | I | O | P |
37 * |------+------+------+------+------| |------+------+------+------+------|
38 * | A | S | D | F | G | | H | J | K | L | ; |
39 * |------+------+------+------+------| |------+------+------+------+------|
40 * | Z | X | C | V | B | | N | M | , | . | / |
41 * `-------------+------+------+------| |------+------+------+------+------'
42 * | GUI | LOWER|Ctrl/Esc| |Spc/Sft| RAISE|Alt/BkSp |
43 * `--------------------' `--------------------'
44 */
45[_QWERTY] = LAYOUT( \
46 KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \
47 KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \
48 KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
49 KC_LGUI, LOWER, MT(MOD_LCTL, KC_ESC), MT(MOD_LSFT, KC_SPC), RAISE, MT(MOD_LALT, KC_BSPC) \
50),
51
52/* Raise
53 *
54 * ,----------------------------------. ,----------------------------------.
55 * | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
56 * |------+------+------+------+------| |------+------+------+------+------|
57 * | Tab | _ | + | | | ~ | | : | " | > | { | } |
58 * |------+------+------+------+------| |------+------+------+------+------|
59 * | Caps| - | = | \ | ` | | ; | ' | < | [ | ] |
60 * `-------------+------+------+------| |------+------+------+------+------'
61 * | | LOWER| | | Esc | RAISE| |
62 * `--------------------' `--------------------'
63 */
64[_RAISE] = LAYOUT( \
65 KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
66 KC_TAB, KC_UNDS, KC_PLUS, KC_PIPE, KC_TILD, KC_COLN, KC_DQUO, KC_GT, KC_LCBR, KC_RCBR, \
67 KC_CAPS, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, KC_SCLN, KC_QUOT, KC_LT, KC_LBRC, KC_RBRC, \
68 _______, _______, _______, _______, _______, _______\
69),
70
71/* Lower
72 *
73 * ,----------------------------------. ,----------------------------------.
74 * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
75 * |------+------+------+------+------| |------+------+------+------+------|
76 * | Tab | | | | Play | | Left | Down | Up | Right| Enter|
77 * |------+------+------+------+------| |------+------+------+------+------|
78 * | Ctrl| ` | GUI | Alt | Del | | BkSp | PgUp | PgDn | \ | ' |
79 * `-------------+------+------+------| |------+------+------+------+------'
80 * | | LOWER| | | | RAISE| |
81 * `--------------------' `--------------------'
82 */
83[_LOWER] = LAYOUT( \
84 KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \
85 KC_TAB, _______, _______, _______, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_ENT, \
86 KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, KC_DEL, KC_BSPC, KC_PGUP, KC_PGDN, KC_BSLS, KC_QUOT, \
87 _______, _______, _______, _______, _______, _______ \
88),
89
90
91/* Adjust (Lower + Raise)
92 *
93 * ,----------------------------------. ,----------------------------------.
94 * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
95 * |------+------+------+------+------| |------+------+------+------+------|
96 * | F11 | F12 | |RGBSAI|RGBSAD| |RGBVAI|RGBVAD| | | |
97 * |------+------+------+------+------| |------+------+------+------+------|
98 * | Reset|RGBTOG|RGBMOD|RGBHUI|RGBHUD| | Prev | Next | Vol- | Vol+ | Play |
99 * `-------------+------+------+------| |------+------+------+------+------'
100 * | | LOWER| | | | RAISE| |
101 * `--------------------' `--------------------'
102 */
103[_ADJUST] = LAYOUT( \
104 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \
105 KC_F11, KC_F12, RGB_RMOD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, \
106 RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_MPRV, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, \
107 _______, _______, _______, _______, _______, _______ \
108)
109};
110
111bool process_record_user(uint16_t keycode, keyrecord_t *record) {
112 switch (keycode) {
113 case QWERTY:
114 if (record->event.pressed) {
115 // persistant_default_layer_set(1UL<<_QWERTY);
116 set_single_persistent_default_layer(_QWERTY);
117 }
118 return false;
119 break;
120 case LOWER:
121 if (record->event.pressed) {
122 layer_on(_LOWER);
123 update_tri_layer(_LOWER, _RAISE, _ADJUST);
124 } else {
125 layer_off(_LOWER);
126 update_tri_layer(_LOWER, _RAISE, _ADJUST);
127 }
128 return false;
129 break;
130 case RAISE:
131 if (record->event.pressed) {
132 layer_on(_RAISE);
133 update_tri_layer(_LOWER, _RAISE, _ADJUST);
134 } else {
135 layer_off(_RAISE);
136 update_tri_layer(_LOWER, _RAISE, _ADJUST);
137 }
138 return false;
139 break;
140 case ADJUST:
141 if (record->event.pressed) {
142 layer_on(_ADJUST);
143 } else {
144 layer_off(_ADJUST);
145 }
146 return false;
147 break;
148 }
149 return true;
150}
151
152void matrix_init_user(void) {
153}
154
155void matrix_scan_user(void) {
156}
157
158void led_set_user(uint8_t usb_led) {
159}
diff --git a/keyboards/miniaxe/keymaps/underglow/rules.mk b/keyboards/miniaxe/keymaps/underglow/rules.mk
new file mode 100644
index 000000000..64fa91ded
--- /dev/null
+++ b/keyboards/miniaxe/keymaps/underglow/rules.mk
@@ -0,0 +1,2 @@
1RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
2
diff --git a/keyboards/miniaxe/matrix.c b/keyboards/miniaxe/matrix.c
new file mode 100644
index 000000000..55c458e1f
--- /dev/null
+++ b/keyboards/miniaxe/matrix.c
@@ -0,0 +1,596 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include "wait.h"
25#include "print.h"
26#include "debug.h"
27#include "util.h"
28#include "matrix.h"
29#include "split_util.h"
30#include "pro_micro.h"
31#include "config.h"
32#include "timer.h"
33#include "split_flags.h"
34
35#ifdef RGBLIGHT_ENABLE
36# include "rgblight.h"
37#endif
38#ifdef BACKLIGHT_ENABLE
39# include "backlight.h"
40 extern backlight_config_t backlight_config;
41#endif
42
43#if defined(USE_I2C) || defined(EH)
44# include "i2c.h"
45#else // USE_SERIAL
46# include "serial.h"
47#endif
48
49#ifndef DEBOUNCING_DELAY
50# define DEBOUNCING_DELAY 5
51#endif
52
53#if (DEBOUNCING_DELAY > 0)
54 static uint16_t debouncing_time;
55 static bool debouncing = false;
56#endif
57
58#if (MATRIX_COLS <= 8)
59# define print_matrix_header() print("\nr/c 01234567\n")
60# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
61# define matrix_bitpop(i) bitpop(matrix[i])
62# define ROW_SHIFTER ((uint8_t)1)
63#else
64# error "Currently only supports 8 COLS"
65#endif
66static matrix_row_t matrix_debouncing[MATRIX_ROWS];
67
68#define ERROR_DISCONNECT_COUNT 5
69
70#define ROWS_PER_HAND (MATRIX_ROWS/2)
71
72static uint8_t error_count = 0;
73
74#if ((DIODE_DIRECTION == COL2ROW) || (DIODE_DIRECTION == ROW2COL))
75static uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
76static uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
77#elif (DIODE_DIRECTION == CUSTOM_MATRIX)
78static uint8_t row_col_pins[MATRIX_ROWS][MATRIX_COLS] = MATRIX_ROW_COL_PINS;
79#endif
80
81/* matrix state(1:on, 0:off) */
82static matrix_row_t matrix[MATRIX_ROWS];
83static matrix_row_t matrix_debouncing[MATRIX_ROWS];
84
85#if (DIODE_DIRECTION == COL2ROW)
86 static void init_cols(void);
87 static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
88 static void unselect_rows(void);
89 static void select_row(uint8_t row);
90 static void unselect_row(uint8_t row);
91#elif (DIODE_DIRECTION == ROW2COL)
92 static void init_rows(void);
93 static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
94 static void unselect_cols(void);
95 static void unselect_col(uint8_t col);
96 static void select_col(uint8_t col);
97#elif (DIODE_DIRECTION == CUSTOM_MATRIX)
98 static void init_cols_rows(void);
99 static bool read_cols(matrix_row_t current_matrix[], uint8_t current_row);
100#endif
101
102__attribute__ ((weak))
103void matrix_init_kb(void) {
104 matrix_init_user();
105}
106
107__attribute__ ((weak))
108void matrix_scan_kb(void) {
109 matrix_scan_user();
110}
111
112__attribute__ ((weak))
113void matrix_init_user(void) {
114}
115
116__attribute__ ((weak))
117void matrix_scan_user(void) {
118}
119
120__attribute__ ((weak))
121void matrix_slave_scan_user(void) {
122}
123
124inline
125uint8_t matrix_rows(void)
126{
127 return MATRIX_ROWS;
128}
129
130inline
131uint8_t matrix_cols(void)
132{
133 return MATRIX_COLS;
134}
135
136void matrix_init(void)
137{
138#ifdef DISABLE_JTAG
139 // JTAG disable for PORT F. write JTD bit twice within four cycles.
140 MCUCR |= (1<<JTD);
141 MCUCR |= (1<<JTD);
142#endif
143
144 debug_enable = true;
145 debug_matrix = true;
146 debug_mouse = true;
147
148 // Set pinout for right half if pinout for that half is defined
149 if (!isLeftHand) {
150#ifdef MATRIX_ROW_PINS_RIGHT
151 const uint8_t row_pins_right[MATRIX_ROWS] = MATRIX_ROW_PINS_RIGHT;
152 for (uint8_t i = 0; i < MATRIX_ROWS; i++)
153 row_pins[i] = row_pins_right[i];
154#endif
155#ifdef MATRIX_COL_PINS_RIGHT
156 const uint8_t col_pins_right[MATRIX_COLS] = MATRIX_COL_PINS_RIGHT;
157 for (uint8_t i = 0; i < MATRIX_COLS; i++)
158 col_pins[i] = col_pins_right[i];
159#endif
160 }
161
162 // initialize row and col
163#if (DIODE_DIRECTION == COL2ROW)
164 unselect_rows();
165 init_cols();
166#elif (DIODE_DIRECTION == ROW2COL)
167 unselect_cols();
168 init_rows();
169#elif (DIODE_DIRECTION == CUSTOM_MATRIX)
170 init_cols_rows();
171#endif
172
173 // initialize matrix state: all keys off
174 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
175 matrix[i] = 0;
176 matrix_debouncing[i] = 0;
177 }
178
179 matrix_init_quantum();
180
181}
182
183uint8_t _matrix_scan(void)
184{
185 int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
186#if (DIODE_DIRECTION == COL2ROW)
187 // Set row, read cols
188 for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
189# if (DEBOUNCING_DELAY > 0)
190 bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
191
192 if (matrix_changed) {
193 debouncing = true;
194 debouncing_time = timer_read();
195 }
196
197# else
198 read_cols_on_row(matrix+offset, current_row);
199# endif
200
201 }
202
203#elif (DIODE_DIRECTION == ROW2COL)
204 // Set col, read rows
205 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
206# if (DEBOUNCING_DELAY > 0)
207 bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
208 if (matrix_changed) {
209 debouncing = true;
210 debouncing_time = timer_read();
211 }
212# else
213 read_rows_on_col(matrix+offset, current_col);
214# endif
215
216 }
217
218#elif (DIODE_DIRECTION == CUSTOM_MATRIX)
219 // Set row, read cols
220 for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
221# if (DEBOUNCING_DELAY > 0)
222 bool matrix_changed = read_cols(matrix_debouncing+offset, current_row);
223 if (matrix_changed) {
224 debouncing = true;
225 debouncing_time = timer_read();
226 }
227# else
228 read_cols(matrix+offset, current_row);
229# endif
230 }
231#endif
232
233# if (DEBOUNCING_DELAY > 0)
234 if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
235 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
236 matrix[i+offset] = matrix_debouncing[i+offset];
237 }
238 debouncing = false;
239 }
240# endif
241
242 return 1;
243}
244
245#if defined(USE_I2C) || defined(EH)
246
247// Get rows from other half over i2c
248int i2c_transaction(void) {
249 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
250 int err = 0;
251
252 // write backlight info
253 #ifdef BACKLIGHT_ENABLE
254 if (BACKLIT_DIRTY) {
255 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
256 if (err) goto i2c_error;
257
258 // Backlight location
259 err = i2c_master_write(I2C_BACKLIT_START);
260 if (err) goto i2c_error;
261
262 // Write backlight
263 i2c_master_write(get_backlight_level());
264
265 BACKLIT_DIRTY = false;
266 }
267 #endif
268
269 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
270 if (err) goto i2c_error;
271
272 // start of matrix stored at I2C_KEYMAP_START
273 err = i2c_master_write(I2C_KEYMAP_START);
274 if (err) goto i2c_error;
275
276 // Start read
277 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
278 if (err) goto i2c_error;
279
280 if (!err) {
281 int i;
282 for (i = 0; i < ROWS_PER_HAND-1; ++i) {
283 matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
284 }
285 matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
286 i2c_master_stop();
287 } else {
288i2c_error: // the cable is disconnceted, or something else went wrong
289 i2c_reset_state();
290 return err;
291 }
292
293 #ifdef RGBLIGHT_ENABLE
294 if (RGB_DIRTY) {
295 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
296 if (err) goto i2c_error;
297
298 // RGB Location
299 err = i2c_master_write(I2C_RGB_START);
300 if (err) goto i2c_error;
301
302 uint32_t dword = eeconfig_read_rgblight();
303
304 // Write RGB
305 err = i2c_master_write_data(&dword, 4);
306 if (err) goto i2c_error;
307
308 RGB_DIRTY = false;
309 i2c_master_stop();
310 }
311 #endif
312
313 return 0;
314}
315
316#else // USE_SERIAL
317
318int serial_transaction(void) {
319 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
320
321 if (serial_update_buffers()) {
322 return 1;
323 }
324
325 for (int i = 0; i < ROWS_PER_HAND; ++i) {
326 matrix[slaveOffset+i] = serial_slave_buffer[i];
327 }
328
329 #ifdef RGBLIGHT_ENABLE
330 // Code to send RGB over serial goes here (not implemented yet)
331 #endif
332
333 #ifdef BACKLIGHT_ENABLE
334 // Write backlight level for slave to read
335 serial_master_buffer[SERIAL_BACKLIT_START] = backlight_config.enable ? backlight_config.level : 0;
336 #endif
337
338 return 0;
339}
340#endif
341
342uint8_t matrix_scan(void)
343{
344 uint8_t ret = _matrix_scan();
345
346#if defined(USE_I2C) || defined(EH)
347 if( i2c_transaction() ) {
348#else // USE_SERIAL
349 if( serial_transaction() ) {
350#endif
351
352 error_count++;
353
354 if (error_count > ERROR_DISCONNECT_COUNT) {
355 // reset other half if disconnected
356 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
357 for (int i = 0; i < ROWS_PER_HAND; ++i) {
358 matrix[slaveOffset+i] = 0;
359 }
360 }
361 } else {
362 error_count = 0;
363 }
364 matrix_scan_quantum();
365 return ret;
366}
367
368void matrix_slave_scan(void) {
369 _matrix_scan();
370
371 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
372
373#if defined(USE_I2C) || defined(EH)
374 for (int i = 0; i < ROWS_PER_HAND; ++i) {
375 i2c_slave_buffer[I2C_KEYMAP_START+i] = matrix[offset+i];
376 }
377#else // USE_SERIAL
378 for (int i = 0; i < ROWS_PER_HAND; ++i) {
379 serial_slave_buffer[i] = matrix[offset+i];
380 }
381#endif
382 matrix_slave_scan_user();
383}
384
385bool matrix_is_modified(void)
386{
387 if (debouncing) return false;
388 return true;
389}
390
391inline
392bool matrix_is_on(uint8_t row, uint8_t col)
393{
394 return (matrix[row] & ((matrix_row_t)1<<col));
395}
396
397inline
398matrix_row_t matrix_get_row(uint8_t row)
399{
400 return matrix[row];
401}
402
403void matrix_print(void)
404{
405 print("\nr/c 0123456789ABCDEF\n");
406 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
407 phex(row); print(": ");
408 pbin_reverse16(matrix_get_row(row));
409 print("\n");
410 }
411}
412
413uint8_t matrix_key_count(void)
414{
415 uint8_t count = 0;
416 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
417 count += bitpop16(matrix[i]);
418 }
419 return count;
420}
421
422#if (DIODE_DIRECTION == COL2ROW)
423
424static void init_cols(void)
425{
426 for(uint8_t x = 0; x < MATRIX_COLS; x++) {
427 uint8_t pin = col_pins[x];
428 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
429 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
430 }
431}
432
433static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
434{
435 // Store last value of row prior to reading
436 matrix_row_t last_row_value = current_matrix[current_row];
437
438 // Clear data in matrix row
439 current_matrix[current_row] = 0;
440
441 // Select row and wait for row selecton to stabilize
442 select_row(current_row);
443 wait_us(30);
444
445 // For each col...
446 for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
447
448 // Select the col pin to read (active low)
449 uint8_t pin = col_pins[col_index];
450 uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
451
452 // Populate the matrix row with the state of the col pin
453 current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
454 }
455
456 // Unselect row
457 unselect_row(current_row);
458
459 return (last_row_value != current_matrix[current_row]);
460}
461
462static void select_row(uint8_t row)
463{
464 uint8_t pin = row_pins[row];
465 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
466 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
467}
468
469static void unselect_row(uint8_t row)
470{
471 uint8_t pin = row_pins[row];
472 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
473 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
474}
475
476static void unselect_rows(void)
477{
478 for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
479 uint8_t pin = row_pins[x];
480 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
481 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
482 }
483}
484
485#elif (DIODE_DIRECTION == ROW2COL)
486
487static void init_rows(void)
488{
489 for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
490 uint8_t pin = row_pins[x];
491 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
492 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
493 }
494}
495
496static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
497{
498 bool matrix_changed = false;
499
500 // Select col and wait for col selecton to stabilize
501 select_col(current_col);
502 wait_us(30);
503
504 // For each row...
505 for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
506 {
507
508 // Store last value of row prior to reading
509 matrix_row_t last_row_value = current_matrix[row_index];
510
511 // Check row pin state
512 if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
513 {
514 // Pin LO, set col bit
515 current_matrix[row_index] |= (ROW_SHIFTER << current_col);
516 }
517 else
518 {
519 // Pin HI, clear col bit
520 current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
521 }
522
523 // Determine if the matrix changed state
524 if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
525 {
526 matrix_changed = true;
527 }
528 }
529
530 // Unselect col
531 unselect_col(current_col);
532
533 return matrix_changed;
534}
535
536static void select_col(uint8_t col)
537{
538 uint8_t pin = col_pins[col];
539 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
540 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
541}
542
543static void unselect_col(uint8_t col)
544{
545 uint8_t pin = col_pins[col];
546 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
547 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
548}
549
550static void unselect_cols(void)
551{
552 for(uint8_t x = 0; x < MATRIX_COLS; x++) {
553 uint8_t pin = col_pins[x];
554 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
555 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
556 }
557}
558
559#elif (DIODE_DIRECTION == CUSTOM_MATRIX)
560
561static void init_cols_rows(void)
562{
563 for(int row = 0; row < MATRIX_ROWS; row++) {
564 for(int col = 0; col < MATRIX_COLS; col++) {
565 uint8_t pin = row_col_pins[row][col];
566 if(pin == NO_PIN) {
567 continue;
568 }
569 // DDxn set 0 for input
570 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF);
571 // PORTxn set 1 for input/pullup
572 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF);
573 }
574 }
575}
576
577static bool read_cols(matrix_row_t current_matrix[], uint8_t current_row)
578{
579 matrix_row_t last_row_value = current_matrix[current_row];
580 current_matrix[current_row] = 0;
581
582 for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
583 uint8_t pin = row_col_pins[current_row][col_index];
584 if(pin == NO_PIN) {
585 current_matrix[current_row] |= 0;
586 }
587 else {
588 uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
589 current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
590 }
591 }
592
593 return (last_row_value != current_matrix[current_row]);
594}
595
596#endif
diff --git a/keyboards/miniaxe/miniaxe.c b/keyboards/miniaxe/miniaxe.c
new file mode 100644
index 000000000..965ada9a1
--- /dev/null
+++ b/keyboards/miniaxe/miniaxe.c
@@ -0,0 +1,43 @@
1/* Copyright 2018 ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "miniaxe.h"
17
18void matrix_init_kb(void) {
19 // put your keyboard start-up code here
20 // runs once when the firmware starts up
21
22 matrix_init_user();
23}
24
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31
32bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
33 // put your per-action keyboard code here
34 // runs for every action, just before processing by the firmware
35
36 return process_record_user(keycode, record);
37}
38
39void led_set_kb(uint8_t usb_led) {
40 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
41
42 led_set_user(usb_led);
43}
diff --git a/keyboards/miniaxe/miniaxe.h b/keyboards/miniaxe/miniaxe.h
new file mode 100644
index 000000000..a0130ad28
--- /dev/null
+++ b/keyboards/miniaxe/miniaxe.h
@@ -0,0 +1,50 @@
1/* Copyright 2018 ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef MINIAXE_H
17#define MINIAXE_H
18
19#include "quantum.h"
20
21/* This a shortcut to help you visually see your layout.
22 *
23 * The first section contains all of the arguments representing the physical
24 * layout of the board and position of the keys.
25 *
26 * The second converts the arguments into a two-dimensional array which
27 * represents the switch matrix.
28 */
29
30// readability
31#define ___ KC_NO
32
33#define LAYOUT( \
34 L01, L02, L03, L04, L05, R01, R02, R03, R04, R05, \
35 L06, L07, L08, L09, L10, R06, R07, R08, R09, R10, \
36 L11, L12, L13, L14, L15, R11, R12, R13, R14, R15, \
37 L16, L17, L18, R16, R17, R18 \
38 ) \
39 { \
40 { L01, L02, L03, L04, L05 }, \
41 { L06, L07, L08, L09, L10 }, \
42 { L11, L12, L13, L14, L15 }, \
43 { L16, L17, L18, ___, ___ }, \
44 { R01, R02, R03, R04, R05 }, \
45 { R06, R07, R08, R09, R10 }, \
46 { R11, R12, R13, R14, R15 }, \
47 { R16, R17, R18, ___, ___ } \
48 }
49
50#endif
diff --git a/keyboards/miniaxe/readme.md b/keyboards/miniaxe/readme.md
new file mode 100644
index 000000000..57ed01a91
--- /dev/null
+++ b/keyboards/miniaxe/readme.md
@@ -0,0 +1,16 @@
1MiniAxe
2===
3
4![MiniAxe](https://i.imgur.com/1ApzrCz.jpg)
5
6Yet another split ortholinear keyboard with 3x5+3 keys.
7
8Keyboard Maintainer: [ka2hiro](https://github.com/ka2hiro) [@ka2hiro](https://twitter.com/ka2hiro)
9Hardware Supported: MiniAxe PCB, ATMEGA32U4
10Hardware Availability: [@ka2hiro](https://twitter.com/ka2hiro)
11
12Make example for this keyboard (after setting up your build environment):
13
14 make miniaxe:default:dfu
15
16See 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).
diff --git a/keyboards/miniaxe/rules.mk b/keyboards/miniaxe/rules.mk
new file mode 100644
index 000000000..96e27686b
--- /dev/null
+++ b/keyboards/miniaxe/rules.mk
@@ -0,0 +1,88 @@
1SRC += matrix.c
2
3# MCU name
4#MCU = at90usb1286
5MCU = atmega32u4
6
7# Processor frequency.
8# This will define a symbol, F_CPU, in all source code files equal to the
9# processor frequency in Hz. You can then use this symbol in your source code to
10# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
11# automatically to create a 32-bit value in your source code.
12#
13# This will be an integer division of F_USB below, as it is sourced by
14# F_USB after it has run through any CPU prescalers. Note that this value
15# does not *change* the processor frequency - it should merely be updated to
16# reflect the processor speed set externally so that the code can use accurate
17# software delays.
18F_CPU = 16000000
19
20
21#
22# LUFA specific
23#
24# Target architecture (see library "Board Types" documentation).
25ARCH = AVR8
26
27# Input clock frequency.
28# This will define a symbol, F_USB, in all source code files equal to the
29# input clock frequency (before any prescaling is performed) in Hz. This value may
30# differ from F_CPU if prescaling is used on the latter, and is required as the
31# raw input clock is fed directly to the PLL sections of the AVR for high speed
32# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
33# at the end, this will be done automatically to create a 32-bit value in your
34# source code.
35#
36# If no clock division is performed on the input clock inside the AVR (via the
37# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
38F_USB = $(F_CPU)
39
40# Interrupt driven control endpoint task(+60)
41OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
42
43
44# Bootloader selection
45# Teensy halfkay
46# Pro Micro caterina
47# Atmel DFU atmel-dfu
48# LUFA DFU lufa-dfu
49# QMK DFU qmk-dfu
50# atmega32a bootloadHID
51BOOTLOADER = atmel-dfu
52
53
54# If you don't know the bootloader type, then you can specify the
55# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
56# Teensy halfKay 512
57# Teensy++ halfKay 1024
58# Atmel DFU loader 4096
59# LUFA bootloader 4096
60# USBaspLoader 2048
61# OPT_DEFS += -DBOOTLOADER_SIZE=4096
62
63
64# Build Options
65# change yes to no to disable
66#
67BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
68MOUSEKEY_ENABLE = no # Mouse keys(+4700)
69EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
70CONSOLE_ENABLE = no # Console for debug(+400)
71COMMAND_ENABLE = no # Commands for debug and configuration
72# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
73SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
74# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
75NKRO_ENABLE = no # USB Nkey Rollover
76BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
77RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
78MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
79UNICODE_ENABLE = no # Unicode
80BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
81AUDIO_ENABLE = no # Audio output on port C6
82FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
83HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
84
85DEBUG_ENABLE = no
86CUSTOM_MATRIX = yes # Use custom matrix code
87SPLIT_KEYBOARD = yes # Use shared split_common code
88