aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2020-01-22 13:21:47 +1100
committerDrashna Jaelre <drashna@live.com>2020-01-21 18:21:47 -0800
commitba264c69c28dd36ab8bd7eda1ba19ecf51eae6a9 (patch)
tree17ee56b0444b4bf25d5a6e205dac28e2e8c045d9
parent8e500c36709d6b3c1d1906db22d635ea55f74e70 (diff)
downloadqmk_firmware-ba264c69c28dd36ab8bd7eda1ba19ecf51eae6a9.tar.gz
qmk_firmware-ba264c69c28dd36ab8bd7eda1ba19ecf51eae6a9.zip
[Keyboard] Cospad refactor (#7957)
* Cospad refactor * Add num lock indicator code * Add led_init_ports() * Revert change to matrix position blanks * Define BACKLIGHT_ON_STATE explicitly, in anticipation of PR6749
-rw-r--r--keyboards/cospad/config.h192
-rw-r--r--keyboards/cospad/cospad.c23
-rw-r--r--keyboards/cospad/cospad.h163
-rw-r--r--keyboards/cospad/info.json192
-rw-r--r--keyboards/cospad/keymaps/default/keymap.c103
-rw-r--r--keyboards/cospad/readme.md17
-rw-r--r--keyboards/cospad/rules.mk24
7 files changed, 441 insertions, 273 deletions
diff --git a/keyboards/cospad/config.h b/keyboards/cospad/config.h
index 9844f2724..cfc2d59f6 100644
--- a/keyboards/cospad/config.h
+++ b/keyboards/cospad/config.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com> 2Copyright 2020
3 3
4This program is free software: you can redistribute it and/or modify 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 5it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21
22/* USB Device descriptor parameter */ 22/* USB Device descriptor parameter */
23#define VENDOR_ID 0xFEED 23#define VENDOR_ID 0xFEED
24#define PRODUCT_ID 0x6060 24#define PRODUCT_ID 0xB1E5
25#define DEVICE_VER 0x0001 25#define DEVICE_VER 0x0001
26#define MANUFACTURER KPREPUBLIC 26#define MANUFACTURER KPrepublic
27#define PRODUCT COSPAD 27#define PRODUCT Cospad
28#define DESCRIPTION QMK keyboard firmware for COSPAD 28#define DESCRIPTION 6x4 numpad with underglow and backlighting
29 29
30/* key matrix size */ 30/* key matrix size */
31#define MATRIX_ROWS 6 31#define MATRIX_ROWS 6
@@ -40,22 +40,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
40 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) 40 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
41 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) 41 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
42 * 42 *
43*/ 43 */
44#define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 } 44#define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 }
45#define MATRIX_COL_PINS { F0, F1, E6, C7 } 45#define MATRIX_COL_PINS { F0, F1, E6, C7 }
46#define UNUSED_PINS 46#define UNUSED_PINS
47 47
48/* COL2ROW or ROW2COL */ 48/* COL2ROW, ROW2COL */
49#define DIODE_DIRECTION COL2ROW 49#define DIODE_DIRECTION COL2ROW
50 50
51/* Backlight configuration */ 51/*
52 * Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
53 */
54#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
55
52#define BACKLIGHT_PIN F7 56#define BACKLIGHT_PIN F7
53#define BACKLIGHT_LEVELS 1 57// #define BACKLIGHT_BREATHING
58#define BACKLIGHT_LEVELS 3
59#define BACKLIGHT_ON_STATE 0
54 60
55/* Underlight configuration */
56#define RGB_DI_PIN F6 61#define RGB_DI_PIN F6
57#define RGBLED_NUM 4 62#ifdef RGB_DI_PIN
58#define RGBLIGHT_ANIMATIONS 63 #define RGBLED_NUM 4
64// #define RGBLIGHT_HUE_STEP 8
65// #define RGBLIGHT_SAT_STEP 8
66// #define RGBLIGHT_VAL_STEP 8
67// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
68// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
69// /*== all animations enable ==*/
70 #define RGBLIGHT_ANIMATIONS
71// /*== or choose animations ==*/
72// #define RGBLIGHT_EFFECT_BREATHING
73// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
74// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
75// #define RGBLIGHT_EFFECT_SNAKE
76// #define RGBLIGHT_EFFECT_KNIGHT
77// #define RGBLIGHT_EFFECT_CHRISTMAS
78// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
79// #define RGBLIGHT_EFFECT_RGB_TEST
80// #define RGBLIGHT_EFFECT_ALTERNATING
81// /*== customize breathing effect ==*/
82// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
83// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
84// /*==== use exp() and sin() ====*/
85// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
86// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
87#endif
59 88
60/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ 89/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
61#define DEBOUNCE 5 90#define DEBOUNCE 5
@@ -64,10 +93,89 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
64//#define MATRIX_HAS_GHOST 93//#define MATRIX_HAS_GHOST
65 94
66/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ 95/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
67//#define LOCKING_SUPPORT_ENABLE 96#define LOCKING_SUPPORT_ENABLE
68/* Locking resynchronize hack */ 97/* Locking resynchronize hack */
69#define LOCKING_RESYNC_ENABLE 98#define LOCKING_RESYNC_ENABLE
70 99
100/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
101 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
102 */
103// #define GRAVE_ESC_CTRL_OVERRIDE
104
105/*
106 * Force NKRO
107 *
108 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
109 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
110 * makefile for this to work.)
111 *
112 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
113 * until the next keyboard reset.
114 *
115 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
116 * fully operational during normal computer usage.
117 *
118 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
119 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
120 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
121 * power-up.
122 *
123 */
124//#define FORCE_NKRO
125
126/*
127 * Magic Key Options
128 *
129 * Magic keys are hotkey commands that allow control over firmware functions of
130 * the keyboard. They are best used in combination with the HID Listen program,
131 * found here: https://www.pjrc.com/teensy/hid_listen.html
132 *
133 * The options below allow the magic key functionality to be changed. This is
134 * useful if your keyboard/keypad is missing keys and you want magic key support.
135 *
136 */
137
138/* key combination for magic key command */
139/* defined by default; to change, uncomment and set to the combination you want */
140// #define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)
141
142/* control how magic key switches layers */
143//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
144//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
145//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
146
147/* override magic key keymap */
148//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
149//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
150//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
151//#define MAGIC_KEY_HELP H
152//#define MAGIC_KEY_HELP_ALT SLASH
153//#define MAGIC_KEY_DEBUG D
154//#define MAGIC_KEY_DEBUG_MATRIX X
155//#define MAGIC_KEY_DEBUG_KBD K
156//#define MAGIC_KEY_DEBUG_MOUSE M
157//#define MAGIC_KEY_VERSION V
158//#define MAGIC_KEY_STATUS S
159//#define MAGIC_KEY_CONSOLE C
160//#define MAGIC_KEY_LAYER0 0
161//#define MAGIC_KEY_LAYER0_ALT GRAVE
162//#define MAGIC_KEY_LAYER1 1
163//#define MAGIC_KEY_LAYER2 2
164//#define MAGIC_KEY_LAYER3 3
165//#define MAGIC_KEY_LAYER4 4
166//#define MAGIC_KEY_LAYER5 5
167//#define MAGIC_KEY_LAYER6 6
168//#define MAGIC_KEY_LAYER7 7
169//#define MAGIC_KEY_LAYER8 8
170//#define MAGIC_KEY_LAYER9 9
171//#define MAGIC_KEY_BOOTLOADER B
172//#define MAGIC_KEY_BOOTLOADER_ALT ESC
173//#define MAGIC_KEY_LOCK CAPS
174//#define MAGIC_KEY_EEPROM E
175//#define MAGIC_KEY_EEPROM_CLEAR BSPACE
176//#define MAGIC_KEY_NKRO N
177//#define MAGIC_KEY_SLEEP_LED Z
178
71/* 179/*
72 * Feature disable options 180 * Feature disable options
73 * These options are also useful to firmware size reduction. 181 * These options are also useful to firmware size reduction.
@@ -83,8 +191,62 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
83//#define NO_ACTION_LAYER 191//#define NO_ACTION_LAYER
84//#define NO_ACTION_TAPPING 192//#define NO_ACTION_TAPPING
85//#define NO_ACTION_ONESHOT 193//#define NO_ACTION_ONESHOT
86//#define NO_ACTION_MACRO 194
87//#define NO_ACTION_FUNCTION 195/* disable these deprecated features by default */
196#ifndef LINK_TIME_OPTIMIZATION_ENABLE
197 #define NO_ACTION_MACRO
198 #define NO_ACTION_FUNCTION
199#endif
200/*
201 * MIDI options
202 */
203
204/* Prevent use of disabled MIDI features in the keymap */
205//#define MIDI_ENABLE_STRICT 1
206
207/* enable basic MIDI features:
208 - MIDI notes can be sent when in Music mode is on
209*/
210//#define MIDI_BASIC
211
212/* enable advanced MIDI features:
213 - MIDI notes can be added to the keymap
214 - Octave shift and transpose
215 - Virtual sustain, portamento, and modulation wheel
216 - etc.
217*/
218//#define MIDI_ADVANCED
219
220/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
221//#define MIDI_TONE_KEYCODE_OCTAVES 1
222
223/*
224 * HD44780 LCD Display Configuration
225 */
226/*
227#define LCD_LINES 2 //< number of visible lines of the display
228#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
229
230#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
231
232#if LCD_IO_MODE
233#define LCD_PORT PORTB //< port for the LCD lines
234#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
235#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
236#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
237#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
238#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
239#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
240#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
241#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
242#define LCD_RS_PORT LCD_PORT //< port for RS line
243#define LCD_RS_PIN 3 //< pin for RS line
244#define LCD_RW_PORT LCD_PORT //< port for RW line
245#define LCD_RW_PIN 2 //< pin for RW line
246#define LCD_E_PORT LCD_PORT //< port for Enable line
247#define LCD_E_PIN 1 //< pin for Enable line
248#endif
249*/
88 250
89/* Bootmagic Lite key configuration */ 251/* Bootmagic Lite key configuration */
90// #define BOOTMAGIC_LITE_ROW 0 252// #define BOOTMAGIC_LITE_ROW 0
diff --git a/keyboards/cospad/cospad.c b/keyboards/cospad/cospad.c
index e7ef71f87..c1f3a7047 100644
--- a/keyboards/cospad/cospad.c
+++ b/keyboards/cospad/cospad.c
@@ -1,5 +1,4 @@
1 1/* Copyright 2020
2/* Copyright 2019
3 * 2 *
4 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -16,18 +15,18 @@
16 */ 15 */
17#include "cospad.h" 16#include "cospad.h"
18 17
19#ifdef BACKLIGHT_ENABLE 18void keyboard_pre_init_kb(void) {
20 19 led_init_ports();
21void backlight_init_ports(void) { 20 keyboard_pre_init_user();
22 setPinOutput(F7);
23} 21}
24 22
25void backlight_set(uint8_t level) { 23void led_init_ports(void) {
26 writePin(F7, !!level); 24 setPinOutput(B2);
27} 25}
28 26
29void backlight_task(void) { 27bool led_update_kb(led_t led_state) {
30 // do nothing - as default implementation of software PWM does not work 28 if (led_update_user(led_state)) {
29 writePin(B2, !led_state.num_lock);
30 }
31 return true;
31} 32}
32
33#endif //BACKLIGHT_ENABLE
diff --git a/keyboards/cospad/cospad.h b/keyboards/cospad/cospad.h
index ad3ca0d6b..fc52204ed 100644
--- a/keyboards/cospad/cospad.h
+++ b/keyboards/cospad/cospad.h
@@ -1,5 +1,4 @@
1 1/* Copyright 2020
2/* Copyright 2019
3 * 2 *
4 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -14,12 +13,14 @@
14 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 15 */
16
17#pragma once 17#pragma once
18 18
19#include "quantum.h" 19#include "quantum.h"
20
20#define ___ KC_NO 21#define ___ KC_NO
21 22
22/* This a shortcut to help you visually see your layout. 23/* This is a shortcut to help you visually see your layout.
23 * 24 *
24 * The first section contains all of the arguments representing the physical 25 * The first section contains all of the arguments representing the physical
25 * layout of the board and position of the keys. 26 * layout of the board and position of the keys.
@@ -28,100 +29,100 @@
28 * represents the switch matrix. 29 * represents the switch matrix.
29 */ 30 */
30 31
31/* COSPAD ortho matrix layout 32/* 6x4 ortholinear layout
32 * ,-------------------. 33 * ,-------------------.
33 * | 00 | 01 | 02 | 03 | 34 * | 00 | 01 | 02 | 03 |
34 * |----|----|----|----| 35 * |----|----|----|----|
35 * | 10 | 11 | 12 | 13 | 36 * | 10 | 11 | 12 | 13 |
36 * |----|----|----|----| 37 * |----|----|----|----|
37 * | 20 | 21 | 22 | 23 | 38 * | 20 | 21 | 22 | 23 |
38 * |----|----|----|----| 39 * |----|----|----|----|
39 * | 30 | 31 | 32 | 33 | 40 * | 30 | 31 | 32 | 33 |
40 * |----|----|----|----| 41 * |----|----|----|----|
41 * | 40 | 41 | 42 | 43 | 42 * | 40 | 41 | 42 | 43 |
42 * |----|----|----|----| 43 * |----|----|----|----|
43 * | 50 | 51 | 52 | 53 | 44 * | 50 | 51 | 52 | 53 |
44 * `-------------------' 45 * `-------------------'
45 */ 46 */
46#define LAYOUT_ortho_6x4( \ 47#define LAYOUT_ortho_6x4( \
47 k00, k01, k02, k03, \ 48 k00, k01, k02, k03, \
48 k10, k11, k12, k13, \ 49 k10, k11, k12, k13, \
49 k20, k21, k22, k23, \ 50 k20, k21, k22, k23, \
50 k30, k31, k32, k33, \ 51 k30, k31, k32, k33, \
51 k40, k41, k42, k43, \ 52 k40, k41, k42, k43, \
52 k50, k51, k52, k53 \ 53 k50, k51, k52, k53 \
53) \ 54) \
54{ \ 55{ \
55 {k00, k01, k02, k03}, \ 56 { k00, k01, k02, k03 }, \
56 {k10, k11, k12, k13}, \ 57 { k10, k11, k12, k13 }, \
57 {k20, k21, k22, k23}, \ 58 { k20, k21, k22, k23 }, \
58 {k30, k31, k32, k33}, \ 59 { k30, k31, k32, k33 }, \
59 {k40, k41, k42, k43}, \ 60 { k40, k41, k42, k43 }, \
60 {k50, k51, k52, k53} \ 61 { k50, k51, k52, k53 } \
61} 62}
62 63
63/* COSPAD gamepad matrix layout 64/* 6x4 gamepad layout
64 * ,-------------------. 65 * ,-------------------.
65 * | 00 | 01 | 02 | 03 | 66 * | 00 | 01 | 02 | 03 |
66 * |----|----|----|----| 67 * |----|----|----|----|
67 * | 10 | 11 | 12 | 13 | 68 * | 10 | 11 | 12 | 13 |
68 * |----|----|----|----| 69 * |----|----|----|----|
69 * | 20 | 21 | 22 | | 70 * | 20 | 21 | 22 | |
70 * |----|----|----| 23 | 71 * |----|----|----| 23 |
71 * | 30 | 31 | 32 | | 72 * | 30 | 31 | 32 | |
72 * |----|----|----|----| 73 * |----|----|----|----|
73 * | 40 | 41 | 42 | 43 | 74 * | 40 | 41 | 42 | 43 |
74 * |----|----|----|----| 75 * |----|----|----|----|
75 * | 50 | 51 | 52 | 53 | 76 * | 50 | 51 | 52 | 53 |
76 * `-------------------' 77 * `-------------------'
77 */ 78 */
78#define LAYOUT_gamepad_6x4( \ 79#define LAYOUT_gamepad_6x4( \
79 k00, k01, k02, k03, \ 80 k00, k01, k02, k03, \
80 k10, k11, k12, k13, \ 81 k10, k11, k12, k13, \
81 k20, k21, k22, \ 82 k20, k21, k22, \
82 k30, k31, k32, k23, \ 83 k30, k31, k32, k23, \
83 k40, k41, k42, k43, \ 84 k40, k41, k42, k43, \
84 k50, k51, k52, k53 \ 85 k50, k51, k52, k53 \
85) \ 86) \
86{ \ 87{ \
87 {k00, k01, k02, k03}, \ 88 { k00, k01, k02, k03 }, \
88 {k10, k11, k12, k13}, \ 89 { k10, k11, k12, k13 }, \
89 {k20, k21, k22, k23}, \ 90 { k20, k21, k22, k23 }, \
90 {k30, k31, k32, ___}, \ 91 { k30, k31, k32, ___ }, \
91 {k40, k41, k42, k43}, \ 92 { k40, k41, k42, k43 }, \
92 {k50, k51, k52, k53} \ 93 { k50, k51, k52, k53 } \
93} 94}
94 95
95/* COSPAD numpad matrix layout 96/* 6x4 numpad layout
96 * ,-------------------. 97 * ,-------------------.
97 * | 00 | 01 | 02 | 03 | 98 * | 00 | 01 | 02 | 03 |
98 * |----|----|----|----| 99 * |----|----|----|----|
99 * | 10 | 11 | 12 | 13 | 100 * | 10 | 11 | 12 | 13 |
100 * |----|----|----|----| 101 * |----|----|----|----|
101 * | 20 | 21 | 22 | | 102 * | 20 | 21 | 22 | |
102 * |----|----|----| 23 | 103 * |----|----|----| 23 |
103 * | 30 | 31 | 32 | | 104 * | 30 | 31 | 32 | |
104 * |----|----|----|----| 105 * |----|----|----|----|
105 * | 40 | 41 | 42 | | 106 * | 40 | 41 | 42 | |
106 * |----|----|----| 43 | 107 * |----|----|----| 43 |
107 * | 50 | 52 | | 108 * | 50 | 52 | |
108 * `-------------------' 109 * `-------------------'
109 */ 110 */
110#define LAYOUT_numpad_6x4( \ 111#define LAYOUT_numpad_6x4( \
111 k00, k01, k02, k03, \ 112 k00, k01, k02, k03, \
112 k10, k11, k12, k13, \ 113 k10, k11, k12, k13, \
113 k20, k21, k22, \ 114 k20, k21, k22, \
114 k30, k31, k32, k23, \ 115 k30, k31, k32, k23, \
115 k40, k41, k42, \ 116 k40, k41, k42, \
116 k50, k52, k43 \ 117 k50, k52, k43 \
117) \ 118) \
118{ \ 119{ \
119 {k00, k01, k02, k03}, \ 120 { k00, k01, k02, k03 }, \
120 {k10, k11, k12, k13}, \ 121 { k10, k11, k12, k13 }, \
121 {k20, k21, k22, k23}, \ 122 { k20, k21, k22, k23 }, \
122 {k30, k31, k32, ___}, \ 123 { k30, k31, k32, ___ }, \
123 {k40, k41, k42, k43}, \ 124 { k40, k41, k42, k43 }, \
124 {k50, ___, k52, ___} \ 125 { k50, ___, k52, ___ } \
125} 126}
126 127
127// Add backwards compatibility for existing keymaps 128// Add backwards compatibility for existing keymaps
diff --git a/keyboards/cospad/info.json b/keyboards/cospad/info.json
index c17f44f52..83bf81c14 100644
--- a/keyboards/cospad/info.json
+++ b/keyboards/cospad/info.json
@@ -1,95 +1,107 @@
1{ 1{
2 "keyboard_name": "Cospad", 2 "keyboard_name": "Cospad",
3 "keyboard_folder": "cospad", 3 "url": "",
4 "url": "", 4 "maintainer": "qmk",
5 "maintainer": "qmk", 5 "width": 4,
6 "width": 4, 6 "height": 6,
7 "height": 6, 7 "layouts": {
8 "layouts": { 8 "LAYOUT_numpad_6x4": {
9 "LAYOUT_numpad_6x4": { 9 "key_count": 21,
10 "key_count": 21, 10 "layout": [
11 "layout": [ 11 {"x":0, "y":0},
12 {"label":"Esc", "x":0, "y":0}, 12 {"x":1, "y":0},
13 {"label":"Tab", "x":1, "y":0}, 13 {"x":2, "y":0},
14 {"label":"Fn", "x":2, "y":0}, 14 {"x":3, "y":0},
15 {"label":"Back", "x":3, "y":0},
16 {"label":"Num Lock", "x":0, "y":1},
17 {"label":"/", "x":1, "y":1},
18 {"label":"*", "x":2, "y":1},
19 {"label":"-", "x":3, "y":1},
20 {"label":"7", "x":0, "y":2},
21 {"label":"8", "x":1, "y":2},
22 {"label":"9", "x":2, "y":2},
23 {"label":"4", "x":0, "y":3},
24 {"label":"5", "x":1, "y":3},
25 {"label":"6", "x":2, "y":3},
26 {"label":"+", "x":3, "y":2, "h":2},
27 {"label":"1", "x":0, "y":4},
28 {"label":"2", "x":1, "y":4},
29 {"label":"3", "x":2, "y":4},
30 {"label":"0", "x":0, "y":5, "w":2},
31 {"label":".", "x":2, "y":5},
32 {"label":"Enter", "x":3, "y":4, "h":2}
33 ]
34 },
35 15
36 "LAYOUT_gamepad_6x4": { 16 {"x":0, "y":1},
37 "key_count": 23, 17 {"x":1, "y":1},
38 "layout": [ 18 {"x":2, "y":1},
39 {"label":"k00", "x":0, "y":0}, 19 {"x":3, "y":1},
40 {"label":"k01", "x":1, "y":0},
41 {"label":"k02", "x":2, "y":0},
42 {"label":"k03", "x":3, "y":0},
43 {"label":"k10", "x":0, "y":1},
44 {"label":"k11", "x":1, "y":1},
45 {"label":"k12", "x":2, "y":1},
46 {"label":"k13", "x":3, "y":1},
47 {"label":"k20", "x":0, "y":2},
48 {"label":"k21", "x":1, "y":2},
49 {"label":"k22", "x":2, "y":2},
50 {"label":"k30", "x":0, "y":3},
51 {"label":"k31", "x":1, "y":3},
52 {"label":"k32", "x":2, "y":3},
53 {"label":"k23", "x":3, "y":2, "h":2},
54 {"label":"k40", "x":0, "y":4},
55 {"label":"k41", "x":1, "y":4},
56 {"label":"k42", "x":2, "y":4},
57 {"label":"k43", "x":3, "y":4},
58 {"label":"k50", "x":0, "y":5},
59 {"label":"k51", "x":1, "y":5},
60 {"label":"k52", "x":2, "y":5},
61 {"label":"k53", "x":3, "y":5}
62 ]
63 },
64 20
65 "LAYOUT_ortho_6x4": { 21 {"x":0, "y":2},
66 "key_count": 24, 22 {"x":1, "y":2},
67 "layout": [ 23 {"x":2, "y":2},
68 {"label":"k00", "x":0, "y":0}, 24
69 {"label":"k01", "x":1, "y":0}, 25 {"x":0, "y":3},
70 {"label":"k02", "x":2, "y":0}, 26 {"x":1, "y":3},
71 {"label":"k03", "x":3, "y":0}, 27 {"x":2, "y":3},
72 {"label":"k10", "x":0, "y":1}, 28 {"x":3, "y":2, "h":2},
73 {"label":"k11", "x":1, "y":1}, 29
74 {"label":"k12", "x":2, "y":1}, 30 {"x":0, "y":4},
75 {"label":"k13", "x":3, "y":1}, 31 {"x":1, "y":4},
76 {"label":"k20", "x":0, "y":2}, 32 {"x":2, "y":4},
77 {"label":"k21", "x":1, "y":2}, 33
78 {"label":"k22", "x":2, "y":2}, 34 {"x":0, "y":5, "w":2},
79 {"label":"k23", "x":3, "y":2}, 35 {"x":2, "y":5},
80 {"label":"k30", "x":0, "y":3}, 36 {"x":3, "y":4, "h":2}
81 {"label":"k31", "x":1, "y":3}, 37 ]
82 {"label":"k32", "x":2, "y":3}, 38 },
83 {"label":"k33", "x":3, "y":3}, 39 "LAYOUT_gamepad_6x4": {
84 {"label":"k40", "x":0, "y":4}, 40 "key_count": 23,
85 {"label":"k41", "x":1, "y":4}, 41 "layout": [
86 {"label":"k42", "x":2, "y":4}, 42 {"x":0, "y":0},
87 {"label":"k43", "x":3, "y":4}, 43 {"x":1, "y":0},
88 {"label":"k50", "x":0, "y":5}, 44 {"x":2, "y":0},
89 {"label":"k51", "x":1, "y":5}, 45 {"x":3, "y":0},
90 {"label":"k52", "x":2, "y":5}, 46
91 {"label":"k53", "x":3, "y":5} 47 {"x":0, "y":1},
92 ] 48 {"x":1, "y":1},
49 {"x":2, "y":1},
50 {"x":3, "y":1},
51
52 {"x":0, "y":2},
53 {"x":1, "y":2},
54 {"x":2, "y":2},
55
56 {"x":0, "y":3},
57 {"x":1, "y":3},
58 {"x":2, "y":3},
59 {"x":3, "y":2, "h":2},
60
61 {"x":0, "y":4},
62 {"x":1, "y":4},
63 {"x":2, "y":4},
64 {"x":3, "y":4},
65
66 {"x":0, "y":5},
67 {"x":1, "y":5},
68 {"x":2, "y":5},
69 {"x":3, "y":5}
70 ]
71 },
72 "LAYOUT_ortho_6x4": {
73 "key_count": 24,
74 "layout": [
75 {"x":0, "y":0},
76 {"x":1, "y":0},
77 {"x":2, "y":0},
78 {"x":3, "y":0},
79
80 {"x":0, "y":1},
81 {"x":1, "y":1},
82 {"x":2, "y":1},
83 {"x":3, "y":1},
84
85 {"x":0, "y":2},
86 {"x":1, "y":2},
87 {"x":2, "y":2},
88 {"x":3, "y":2},
89
90 {"x":0, "y":3},
91 {"x":1, "y":3},
92 {"x":2, "y":3},
93 {"x":3, "y":3},
94
95 {"x":0, "y":4},
96 {"x":1, "y":4},
97 {"x":2, "y":4},
98 {"x":3, "y":4},
99
100 {"x":0, "y":5},
101 {"x":1, "y":5},
102 {"x":2, "y":5},
103 {"x":3, "y":5}
104 ]
105 }
93 } 106 }
94 }
95} 107}
diff --git a/keyboards/cospad/keymaps/default/keymap.c b/keyboards/cospad/keymaps/default/keymap.c
index adcca112d..06b06d41f 100644
--- a/keyboards/cospad/keymaps/default/keymap.c
+++ b/keyboards/cospad/keymaps/default/keymap.c
@@ -1,60 +1,57 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3// Each layer gets a name for readability, which is then used in the keymap matrix below. 3// Defines names for use in layer keycodes and the keymap
4// The underscores don't mean anything - you can have a layer called STUFF or any other name. 4enum layer_names {
5// Layer names don't all need to be of the same length, obviously, and you can also skip them 5 _BL,
6// entirely and just use numbers. 6 _FL
7enum layers {
8 _BL = 0,
9 _FL
10}; 7};
11 8
12const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 9const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
13/* Keymap _BL: (Base Layer) Default Layer 10 /* Keymap _BL: (Base Layer) Default Layer
14 * ,-------------------. 11 * ,-------------------.
15 * |Esc |TAB | FN | BS | 12 * |Esc |TAB | FN | BS |
16 * |----|----|----|----| 13 * |----|----|----|----|
17 * | NL | / | * | - | 14 * | NL | / | * | - |
18 * |----|----|----|----| 15 * |----|----|----|----|
19 * | 7 | 8 | 9 | | 16 * | 7 | 8 | 9 | |
20 * |----|----|----| + | 17 * |----|----|----| + |
21 * | 4 | 5 | 6 | | 18 * | 4 | 5 | 6 | |
22 * |----|----|----|----| 19 * |----|----|----|----|
23 * | 1 | 2 | 3 | | 20 * | 1 | 2 | 3 | |
24 * |----|----|----| En | 21 * |----|----|----| En |
25 * | 0 | . | | 22 * | 0 | . | |
26 * `-------------------' 23 * `-------------------'
27 */ 24 */
28 [_BL] = LAYOUT_numpad_6x4( 25 [_BL] = LAYOUT_numpad_6x4(
29 KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ 26 KC_ESC, KC_TAB, MO(_FL), KC_BSPC,
30 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ 27 KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
31 KC_P7, KC_P8, KC_P9, \ 28 KC_P7, KC_P8, KC_P9,
32 KC_P4, KC_P5, KC_P6, KC_PPLS, \ 29 KC_P4, KC_P5, KC_P6, KC_PPLS,
33 KC_P1, KC_P2, KC_P3, \ 30 KC_P1, KC_P2, KC_P3,
34 KC_P0, KC_PDOT, KC_PENT 31 KC_P0, KC_PDOT, KC_PENT
35 ), 32 ),
36 33
37/* Keymap _FL: Function Layer 34 /* Keymap _FL: Function Layer
38 * ,-------------------. 35 * ,-------------------.
39 * |RGBT| | | | 36 * |RGBT| | | |
40 * |----|----|----|----| 37 * |----|----|----|----|
41 * |RGBM|RGBP|BTOG| | 38 * |RGBM|RGBP|BTOG| |
42 * |----|----|----|----| 39 * |----|----|----|----|
43 * |HUD |HUI |BON | | 40 * |HUD |HUI |BON | |
44 * |----|----|----| | 41 * |----|----|----| |
45 * |SAD |SAI |BOFF| | 42 * |SAD |SAI |BOFF| |
46 * |----|----|----|----| 43 * |----|----|----|----|
47 * |VAD |VAS |BSTP| | 44 * |VAD |VAS |BSTP| |
48 * |----|----|----| | 45 * |----|----|----| |
49 * | |RST | | 46 * | |RST | |
50 * `-------------------' 47 * `-------------------'
51 */ 48 */
52 [_FL] = LAYOUT_numpad_6x4( 49 [_FL] = LAYOUT_numpad_6x4(
53 RGB_TOG, _______, _______, _______, \ 50 RGB_TOG, _______, _______, _______,
54 RGB_MOD, RGB_M_P, BL_TOGG, _______, \ 51 RGB_MOD, RGB_M_P, BL_TOGG, _______,
55 RGB_HUD, RGB_HUI, BL_ON, \ 52 RGB_HUD, RGB_HUI, BL_ON,
56 RGB_SAD, RGB_SAI, BL_OFF, _______, \ 53 RGB_SAD, RGB_SAI, BL_OFF, _______,
57 RGB_VAD, RGB_VAI, BL_STEP, \ 54 RGB_VAD, RGB_VAI, BL_STEP,
58 _______, RESET, _______ 55 _______, RESET, _______
59 ), 56 )
60}; 57};
diff --git a/keyboards/cospad/readme.md b/keyboards/cospad/readme.md
index 2e9add691..9bb3dfdc0 100644
--- a/keyboards/cospad/readme.md
+++ b/keyboards/cospad/readme.md
@@ -1,18 +1,15 @@
1COSPAD 1# Cospad
2===
3 2
4A DIY Keypad Kit sold by KPRepublic, runs TKG natively. 3A DIY keypad kit sold by KPRepublic, runs TKG natively.
5 4
6Keyboard Maintainer: QMK Community 5* Keyboard Maintainer: QMK Community
7Hardware Supported: COSPAD 6* Hardware Supported: Cospad PCB
8Hardware Availability: [KPrepublic on Aliexpress](https://aliexpress.com/item/cospad-Custom-Mechanical-Keyboard-Kit-up-tp-24-keys-Supports-TKG-TOOLS-Underglow-RGB-PCB-20/32818383873.html) 7* Hardware Availability: [KPrepublic on Aliexpress](https://aliexpress.com/item/cospad-Custom-Mechanical-Keyboard-Kit-up-tp-24-keys-Supports-TKG-TOOLS-Underglow-RGB-PCB-20/32818383873.html)
9
10Only supports on and off for the backlight leds, as they are not connected to a PWM pin.
11 8
12Supported Layouts: 9Supported Layouts:
13 10
14![Numpad Layout of COSPAD](https://i.imgur.com/t03lXJ4.png) 11![Numpad layouts](https://i.imgur.com/t03lXJ4.png)
15![Ortholinear Layout of COSPAD](https://i.imgur.com/mliUcCc.png) 12![Ortholinear layouts](https://i.imgur.com/mliUcCc.png)
16 13
17Make example for this keyboard (after setting up your build environment): 14Make example for this keyboard (after setting up your build environment):
18 15
diff --git a/keyboards/cospad/rules.mk b/keyboards/cospad/rules.mk
index 075320a22..61243fd37 100644
--- a/keyboards/cospad/rules.mk
+++ b/keyboards/cospad/rules.mk
@@ -12,23 +12,23 @@ MCU = atmega32u4
12BOOTLOADER = atmel-dfu 12BOOTLOADER = atmel-dfu
13 13
14# Build Options 14# Build Options
15# comment out to disable the options. 15# change yes to no to disable
16# 16#
17BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) 17BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
18MOUSEKEY_ENABLE = no # Mouse keys(+4700) 18MOUSEKEY_ENABLE = no # Mouse keys
19EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 19EXTRAKEY_ENABLE = yes # Audio control and System control
20CONSOLE_ENABLE = no # Console for debug(+400) 20CONSOLE_ENABLE = no # Console for debug
21COMMAND_ENABLE = no # Commands for debug and configuration 21COMMAND_ENABLE = no # Commands for debug and configuration
22NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 22# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
23SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
24# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
25NKRO_ENABLE = yes # USB Nkey Rollover
23BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 26BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
24BACKLIGHT_CUSTOM_DRIVER = yes 27RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
25RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) 28MIDI_ENABLE = no # MIDI support
26MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
27UNICODE_ENABLE = no # Unicode
28BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 29BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
29AUDIO_ENABLE = no # Audio output on port C6 30AUDIO_ENABLE = no # Audio output on port C6
30FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches 31FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
31HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) 32HD44780_ENABLE = no # Enable support for HD44780 based LCDs
32
33 33
34LAYOUTS = numpad_6x4 ortho_6x4 34LAYOUTS = numpad_6x4 ortho_6x4