aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Aloysius <krusli@users.noreply.github.com>2017-10-17 10:31:39 +1100
committerJack Humbert <jack.humb@gmail.com>2017-10-16 13:31:39 -1000
commitb7bb92396286b495e48864b5813e7dafcade93f5 (patch)
tree746a47586fa93610ef2aebd49954d35e3285f8b5
parent0f5928fdf4399f14a500a00936a2cc35225cd3bf (diff)
downloadqmk_firmware-b7bb92396286b495e48864b5813e7dafcade93f5.tar.gz
qmk_firmware-b7bb92396286b495e48864b5813e7dafcade93f5.zip
Add NIU Mini from KBDFans (#1847)
* Add NIU Mini keymap from Planck keymap * Remove old keymap files * Fix README, removed Planck references * Add default layout, move Planck layout to separate folder * Update README
-rw-r--r--keyboards/niu_mini/config.h97
-rwxr-xr-xkeyboards/niu_mini/keymaps/default/keymap.c84
-rw-r--r--keyboards/niu_mini/keymaps/default/readme.md2
-rw-r--r--keyboards/niu_mini/keymaps/planck/config.h32
-rw-r--r--keyboards/niu_mini/keymaps/planck/keymap.c262
-rw-r--r--keyboards/niu_mini/keymaps/planck/readme.md2
-rw-r--r--keyboards/niu_mini/keymaps/planck/rules.mk3
-rw-r--r--keyboards/niu_mini/keymaps/readme.md23
-rw-r--r--keyboards/niu_mini/niu_mini.c19
-rw-r--r--keyboards/niu_mini/niu_mini.h35
-rw-r--r--keyboards/niu_mini/readme.md16
-rw-r--r--keyboards/niu_mini/rules.mk68
12 files changed, 643 insertions, 0 deletions
diff --git a/keyboards/niu_mini/config.h b/keyboards/niu_mini/config.h
new file mode 100644
index 000000000..2f2230616
--- /dev/null
+++ b/keyboards/niu_mini/config.h
@@ -0,0 +1,97 @@
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#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23#define DEVICE_VER 0x0001
24
25/* USB Device descriptor parameter */
26#define VENDOR_ID 0xFEED
27#define PRODUCT_ID 0x6060
28#define MANUFACTURER KBDFans
29#define PRODUCT NIU Mini
30#define DESCRIPTION A compact ortholinear keyboard
31
32/* key matrix size */
33#define MATRIX_ROWS 4
34#define MATRIX_COLS 12
35
36/* NIU Mini PCB default pin-out */
37#define MATRIX_ROW_PINS { D0, D1, D2, D3 }
38#define MATRIX_COL_PINS { F0, F1, F4, F5, F6, F7, B3, B1, B0, D5, B7, C7 }
39#define UNUSED_PINS
40
41/* COL2ROW or ROW2COL */
42#define DIODE_DIRECTION COL2ROW
43
44/* define if matrix has ghost */
45//#define MATRIX_HAS_GHOST
46
47/* number of backlight levels */
48#define BACKLIGHT_PIN B6
49#ifdef BACKLIGHT_PIN
50#define BACKLIGHT_LEVELS 4
51#endif
52
53/* Set 0 if debouncing isn't needed */
54#define DEBOUNCING_DELAY 5
55
56/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
57#define LOCKING_SUPPORT_ENABLE
58
59/* Locking resynchronize hack */
60#define LOCKING_RESYNC_ENABLE
61
62/* key combination for command */
63#define IS_COMMAND() ( \
64 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
65)
66
67/* prevent stuck modifiers */
68#define PREVENT_STUCK_MODIFIERS
69
70#define RGB_DI_PIN E2
71#ifdef RGB_DI_PIN
72#define RGBLIGHT_ANIMATIONS
73#define RGBLED_NUM 14
74#define RGBLIGHT_HUE_STEP 8
75#define RGBLIGHT_SAT_STEP 8
76#define RGBLIGHT_VAL_STEP 8
77#endif
78
79/*
80 * Feature disable options
81 * These options are also useful to firmware size reduction.
82 */
83
84/* disable debug print */
85//#define NO_DEBUG
86
87/* disable print */
88//#define NO_PRINT
89
90/* disable action features */
91//#define NO_ACTION_LAYER
92//#define NO_ACTION_TAPPING
93//#define NO_ACTION_ONESHOT
94//#define NO_ACTION_MACRO
95//#define NO_ACTION_FUNCTION
96
97#endif
diff --git a/keyboards/niu_mini/keymaps/default/keymap.c b/keyboards/niu_mini/keymaps/default/keymap.c
new file mode 100755
index 000000000..20e90f6e9
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/default/keymap.c
@@ -0,0 +1,84 @@
1#include "niu_mini.h"
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4
5 [0] = {
6 {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
7 {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
8 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_ENT},
9 {KC_LCTL, KC_LGUI, KC_1, KC_2, KC_3, KC_SPC, MO(2), MO(1), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT}
10 // NOTE MO(2) does not correspond to an actual key since the NIU only comes
11 // in MIT layout
12 },
13
14 [1] = {
15 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS},
16 {KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
17 {KC_TRNS, BL_TOGG, BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
18 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
19 },
20
21 [2] = {
22 {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS},
23 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
24 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS},
25 {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
26 }
27};
28
29const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
30 keyevent_t event = record->event;
31
32 switch (id) {
33 case 1:
34 // do nothing for now
35 if (event.pressed) {
36 ;
37 }
38 }
39 return MACRO_NONE;
40}
41
42void matrix_init_user(void) {
43}
44
45void matrix_scan_user(void) {
46}
47
48bool process_record_user(uint16_t keycode, keyrecord_t *record) {
49 return true;
50}
51
52void led_set_user(uint8_t usb_led) {
53
54 if (usb_led & (1 << USB_LED_NUM_LOCK)) {
55
56 } else {
57
58 }
59
60 if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
61
62 } else {
63
64 }
65
66 if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
67
68 } else {
69
70 }
71
72 if (usb_led & (1 << USB_LED_COMPOSE)) {
73
74 } else {
75
76 }
77
78 if (usb_led & (1 << USB_LED_KANA)) {
79
80 } else {
81
82 }
83
84}
diff --git a/keyboards/niu_mini/keymaps/default/readme.md b/keyboards/niu_mini/keymaps/default/readme.md
new file mode 100644
index 000000000..a2f2aa2f4
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/default/readme.md
@@ -0,0 +1,2 @@
1# Default layout
2Default layout that shipped with the NIU mini
diff --git a/keyboards/niu_mini/keymaps/planck/config.h b/keyboards/niu_mini/keymaps/planck/config.h
new file mode 100644
index 000000000..26387986d
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/planck/config.h
@@ -0,0 +1,32 @@
1#ifndef CONFIG_USER_H
2#define CONFIG_USER_H
3
4#include "../../config.h"
5
6#define MUSIC_MASK (keycode != KC_NO)
7
8/*
9 * MIDI options
10 */
11
12/* Prevent use of disabled MIDI features in the keymap */
13//#define MIDI_ENABLE_STRICT 1
14
15/* enable basic MIDI features:
16 - MIDI notes can be sent when in Music mode is on
17*/
18
19#define MIDI_BASIC
20
21/* enable advanced MIDI features:
22 - MIDI notes can be added to the keymap
23 - Octave shift and transpose
24 - Virtual sustain, portamento, and modulation wheel
25 - etc.
26*/
27//#define MIDI_ADVANCED
28
29/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
30//#define MIDI_TONE_KEYCODE_OCTAVES 2
31
32#endif
diff --git a/keyboards/niu_mini/keymaps/planck/keymap.c b/keyboards/niu_mini/keymaps/planck/keymap.c
new file mode 100644
index 000000000..a4ffad9c9
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/planck/keymap.c
@@ -0,0 +1,262 @@
1/* Copyright 2015-2017 Jack Humbert
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
17#include "niu_mini.h"
18#include "action_layer.h"
19
20extern keymap_config_t keymap_config;
21
22enum layers {
23 _QWERTY,
24 _COLEMAK,
25 _DVORAK,
26 _LOWER,
27 _RAISE,
28 _PLOVER,
29 _ADJUST
30};
31
32enum keycodes {
33 QWERTY = SAFE_RANGE,
34 COLEMAK,
35 DVORAK,
36 PLOVER,
37 LOWER,
38 RAISE,
39 BACKLIT,
40 EXT_PLV
41};
42
43const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
44
45/* Qwerty
46 * ,-----------------------------------------------------------------------------------.
47 * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
48 * |------+------+------+------+------+-------------+------+------+------+------+------|
49 * | Esc | A | S | D | F | G | H | J | K | L | ; | " |
50 * |------+------+------+------+------+------|------+------+------+------+------+------|
51 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
52 * |------+------+------+------+------+------+------+------+------+------+------+------|
53 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
54 * `-----------------------------------------------------------------------------------'
55 */
56[_QWERTY] = {
57 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
58 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
59 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
60 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
61},
62
63/* Colemak
64 * ,-----------------------------------------------------------------------------------.
65 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
66 * |------+------+------+------+------+-------------+------+------+------+------+------|
67 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
68 * |------+------+------+------+------+------|------+------+------+------+------+------|
69 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
70 * |------+------+------+------+------+------+------+------+------+------+------+------|
71 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
72 * `-----------------------------------------------------------------------------------'
73 */
74[_COLEMAK] = {
75 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
76 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
77 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
78 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
79},
80
81/* Dvorak
82 * ,-----------------------------------------------------------------------------------.
83 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
84 * |------+------+------+------+------+-------------+------+------+------+------+------|
85 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
86 * |------+------+------+------+------+------|------+------+------+------+------+------|
87 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
88 * |------+------+------+------+------+------+------+------+------+------+------+------|
89 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
90 * `-----------------------------------------------------------------------------------'
91 */
92[_DVORAK] = {
93 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
94 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
95 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
96 {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
97},
98
99/* Lower
100 * ,-----------------------------------------------------------------------------------.
101 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
102 * |------+------+------+------+------+-------------+------+------+------+------+------|
103 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
104 * |------+------+------+------+------+------|------+------+------+------+------+------|
105 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | |
106 * |------+------+------+------+------+------+------+------+------+------+------+------|
107 * | | | | | | | | Next | Vol- | Vol+ | Play |
108 * `-----------------------------------------------------------------------------------'
109 */
110[_LOWER] = {
111 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
112 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
113 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______},
114 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
115},
116
117/* Raise
118 * ,-----------------------------------------------------------------------------------.
119 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
120 * |------+------+------+------+------+-------------+------+------+------+------+------|
121 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
122 * |------+------+------+------+------+------|------+------+------+------+------+------|
123 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | |
124 * |------+------+------+------+------+------+------+------+------+------+------+------|
125 * | | | | | | | | Next | Vol- | Vol+ | Play |
126 * `-----------------------------------------------------------------------------------'
127 */
128[_RAISE] = {
129 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
130 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
131 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______},
132 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
133},
134
135/* Plover layer (http://opensteno.org)
136 * ,-----------------------------------------------------------------------------------.
137 * | # | # | # | # | # | # | # | # | # | # | # | # |
138 * |------+------+------+------+------+-------------+------+------+------+------+------|
139 * | | S | T | P | H | * | * | F | P | L | T | D |
140 * |------+------+------+------+------+------|------+------+------+------+------+------|
141 * | | S | K | W | R | * | * | R | B | G | S | Z |
142 * |------+------+------+------+------+------+------+------+------+------+------+------|
143 * | Exit | | | A | O | | E | U | | | |
144 * `-----------------------------------------------------------------------------------'
145 */
146
147[_PLOVER] = {
148 {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 },
149 {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC},
150 {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
151 {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX}
152},
153
154/* Adjust (Lower + Raise)
155 * ,-----------------------------------------------------------------------------------.
156 * | | Reset| | | | | | | | | | Del |
157 * |------+------+------+------+------+-------------+------+------+------+------+------|
158 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
159 * |------+------+------+------+------+------|------+------+------+------+------+------|
160 * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
161 * |------+------+------+------+------+------+------+------+------+------+------+------|
162 * | | | | | | | | | | | |
163 * `-----------------------------------------------------------------------------------'
164 */
165[_ADJUST] = {
166 {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL },
167 {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
168 {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
169 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
170}
171
172
173};
174
175#ifdef AUDIO_ENABLE
176 float plover_song[][2] = SONG(PLOVER_SOUND);
177 float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
178#endif
179
180bool process_record_user(uint16_t keycode, keyrecord_t *record) {
181 switch (keycode) {
182 case QWERTY:
183 if (record->event.pressed) {
184 print("mode just switched to qwerty and this is a huge string\n");
185 set_single_persistent_default_layer(_QWERTY);
186 }
187 return false;
188 break;
189 case COLEMAK:
190 if (record->event.pressed) {
191 set_single_persistent_default_layer(_COLEMAK);
192 }
193 return false;
194 break;
195 case DVORAK:
196 if (record->event.pressed) {
197 set_single_persistent_default_layer(_DVORAK);
198 }
199 return false;
200 break;
201 case LOWER:
202 if (record->event.pressed) {
203 layer_on(_LOWER);
204 update_tri_layer(_LOWER, _RAISE, _ADJUST);
205 } else {
206 layer_off(_LOWER);
207 update_tri_layer(_LOWER, _RAISE, _ADJUST);
208 }
209 return false;
210 break;
211 case RAISE:
212 if (record->event.pressed) {
213 layer_on(_RAISE);
214 update_tri_layer(_LOWER, _RAISE, _ADJUST);
215 } else {
216 layer_off(_RAISE);
217 update_tri_layer(_LOWER, _RAISE, _ADJUST);
218 }
219 return false;
220 break;
221 case BACKLIT:
222 if (record->event.pressed) {
223 register_code(KC_RSFT);
224 #ifdef BACKLIGHT_ENABLE
225 backlight_step();
226 #endif
227 } else {
228 unregister_code(KC_RSFT);
229 }
230 return false;
231 break;
232 case PLOVER:
233 if (record->event.pressed) {
234 #ifdef AUDIO_ENABLE
235 stop_all_notes();
236 PLAY_SONG(plover_song);
237 #endif
238 layer_off(_RAISE);
239 layer_off(_LOWER);
240 layer_off(_ADJUST);
241 layer_on(_PLOVER);
242 if (!eeconfig_is_enabled()) {
243 eeconfig_init();
244 }
245 keymap_config.raw = eeconfig_read_keymap();
246 keymap_config.nkro = 1;
247 eeconfig_update_keymap(keymap_config.raw);
248 }
249 return false;
250 break;
251 case EXT_PLV:
252 if (record->event.pressed) {
253 #ifdef AUDIO_ENABLE
254 PLAY_SONG(plover_gb_song);
255 #endif
256 layer_off(_PLOVER);
257 }
258 return false;
259 break;
260 }
261 return true;
262}
diff --git a/keyboards/niu_mini/keymaps/planck/readme.md b/keyboards/niu_mini/keymaps/planck/readme.md
new file mode 100644
index 000000000..de9680b49
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/planck/readme.md
@@ -0,0 +1,2 @@
1# The Default Planck Layout
2
diff --git a/keyboards/niu_mini/keymaps/planck/rules.mk b/keyboards/niu_mini/keymaps/planck/rules.mk
new file mode 100644
index 000000000..457a3d01d
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/planck/rules.mk
@@ -0,0 +1,3 @@
1ifndef QUANTUM_DIR
2 include ../../../../Makefile
3endif
diff --git a/keyboards/niu_mini/keymaps/readme.md b/keyboards/niu_mini/keymaps/readme.md
new file mode 100644
index 000000000..804a657e7
--- /dev/null
+++ b/keyboards/niu_mini/keymaps/readme.md
@@ -0,0 +1,23 @@
1# How to add your own keymap
2
3Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
4
5 _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
6
7\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
8
9and contain the following files:
10
11* `keymap.c`
12* `readme.md` *recommended*
13* `config.h` *optional*, found automatically when compiling
14* `Makefile` *optional*, found automatically when compling
15
16When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
17
18 * **folder_name** description
19
20# List of keymaps
21
22- **default** default layout from KBDFans
23- **planck** Planck default layout
diff --git a/keyboards/niu_mini/niu_mini.c b/keyboards/niu_mini/niu_mini.c
new file mode 100644
index 000000000..f1607df55
--- /dev/null
+++ b/keyboards/niu_mini/niu_mini.c
@@ -0,0 +1,19 @@
1#include "niu_mini.h"
2
3#ifdef ONEHAND_ENABLE
4__attribute__ ((weak))
5const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
6 {{11, 0}, {10, 0}, {9, 0}, {8, 0}, {7, 0}, {6, 0}, {5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}},
7 {{11, 1}, {10, 1}, {9, 1}, {8, 1}, {7, 1}, {6, 1}, {5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}},
8 {{11, 2}, {10, 2}, {9, 2}, {8, 2}, {7, 2}, {6, 2}, {5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}},
9 {{11, 3}, {10, 3}, {9, 3}, {8, 3}, {7, 3}, {6, 3}, {5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}},
10};
11#endif
12
13void matrix_init_kb(void) {
14 // Turn status LED on
15 DDRE |= (1<<6);
16 PORTE |= (1<<6);
17
18 matrix_init_user();
19}
diff --git a/keyboards/niu_mini/niu_mini.h b/keyboards/niu_mini/niu_mini.h
new file mode 100644
index 000000000..f4a55272a
--- /dev/null
+++ b/keyboards/niu_mini/niu_mini.h
@@ -0,0 +1,35 @@
1#ifndef NIU_MINI_H
2#define NIU_MINI_H
3
4#include "quantum.h"
5
6#define MIT( \
7 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
8 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
9 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
10 k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \
11) \
12{ \
13 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
14 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
15 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
16 { k30, k31, k32, k33, k34, k35, k35, k37, k38, k39, k3a, k3b } \
17}
18
19#define GRID( \
20 k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
21 k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
22 k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
23 k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
24) \
25{ \
26 { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
27 { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
28 { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
29 { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
30}
31
32#define KEYMAP GRID
33#define LAYOUT_ortho_4x12 GRID
34
35#endif
diff --git a/keyboards/niu_mini/readme.md b/keyboards/niu_mini/readme.md
new file mode 100644
index 000000000..71bfae273
--- /dev/null
+++ b/keyboards/niu_mini/readme.md
@@ -0,0 +1,16 @@
1NIU Mini
2===
3
4![NIU Mini](https://cdn.shopify.com/s/files/1/1473/3902/files/40__01.jpg)
5
6A compact 40% (12x4) ortholinear keyboard kit sold by KBDFans.
7
8Keyboard Maintainer: QMK Community
9Hardware Supported: NIU Mini PCB
10Hardware Availability: [KBDFans](https://kbdfans.myshopify.com/)
11
12Make example for this keyboard (after setting up your build environment):
13
14 make niu_mini:default
15
16See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
diff --git a/keyboards/niu_mini/rules.mk b/keyboards/niu_mini/rules.mk
new file mode 100644
index 000000000..7c7e98121
--- /dev/null
+++ b/keyboards/niu_mini/rules.mk
@@ -0,0 +1,68 @@
1# MCU name
2#MCU = at90usb1287
3MCU = atmega32u4
4
5# Processor frequency.
6# This will define a symbol, F_CPU, in all source code files equal to the
7# processor frequency in Hz. You can then use this symbol in your source code to
8# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
9# automatically to create a 32-bit value in your source code.
10#
11# This will be an integer division of F_USB below, as it is sourced by
12# F_USB after it has run through any CPU prescalers. Note that this value
13# does not *change* the processor frequency - it should merely be updated to
14# reflect the processor speed set externally so that the code can use accurate
15# software delays.
16F_CPU = 16000000
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40
41# Boot Section Size in *bytes*
42# Teensy halfKay 512
43# Teensy++ halfKay 1024
44# Atmel DFU loader 4096
45# LUFA bootloader 4096
46# USBaspLoader 2048
47OPT_DEFS += -DBOOTLOADER_SIZE=4096
48
49# Build Options
50# change to "no" to disable the options, or define them in the Makefile in
51# the appropriate keymap folder that will get included automatically
52#
53BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
54MOUSEKEY_ENABLE = no # Mouse keys(+4700)
55EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
56CONSOLE_ENABLE = yes # Console for debug(+400)
57COMMAND_ENABLE = no # Commands for debug and configuration
58NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
59BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
60MIDI_ENABLE = no # MIDI controls
61AUDIO_ENABLE = yes # Audio output on port C6
62UNICODE_ENABLE = no # Unicode
63BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
64RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
65API_SYSEX_ENABLE = no
66
67# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
68SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend