diff options
author | zvecr <git@zvecr.com> | 2019-04-24 19:13:07 +0100 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-04-24 11:13:07 -0700 |
commit | e6f4173aecaedabe3b2550340321520f45227c7f (patch) | |
tree | 52052dc83dc586825f1537424efc42e9cff9f24d /keyboards/cospad | |
parent | eda924d7dc71bd5bc229cc64dcd89a8703ed8582 (diff) | |
download | qmk_firmware-e6f4173aecaedabe3b2550340321520f45227c7f.tar.gz qmk_firmware-e6f4173aecaedabe3b2550340321520f45227c7f.zip |
Refactor cospad to current standards and enable support for backlight keycodes (#5582)
Diffstat (limited to 'keyboards/cospad')
-rw-r--r-- | keyboards/cospad/config.h | 50 | ||||
-rw-r--r-- | keyboards/cospad/cospad.c | 56 | ||||
-rw-r--r-- | keyboards/cospad/cospad.h | 126 | ||||
-rw-r--r-- | keyboards/cospad/info.json | 76 | ||||
-rw-r--r-- | keyboards/cospad/keymaps/default/keymap.c | 120 | ||||
-rw-r--r-- | keyboards/cospad/rules.mk | 43 |
6 files changed, 250 insertions, 221 deletions
diff --git a/keyboards/cospad/config.h b/keyboards/cospad/config.h index 1f7c174e6..b7e7ec384 100644 --- a/keyboards/cospad/config.h +++ b/keyboards/cospad/config.h | |||
@@ -15,8 +15,7 @@ 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/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifndef CONFIG_H | 18 | #pragma once |
19 | #define CONFIG_H | ||
20 | 19 | ||
21 | #include "config_common.h" | 20 | #include "config_common.h" |
22 | 21 | ||
@@ -32,42 +31,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
32 | #define MATRIX_ROWS 6 | 31 | #define MATRIX_ROWS 6 |
33 | #define MATRIX_COLS 4 | 32 | #define MATRIX_COLS 4 |
34 | 33 | ||
35 | // ROWS: Top to bottom, COLS: Left to right | 34 | /* |
36 | 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 | * | ||
43 | */ | ||
37 | #define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 } | 44 | #define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 } |
38 | #define MATRIX_COL_PINS { F0, F1, E6, C7 } | 45 | #define MATRIX_COL_PINS { F0, F1, E6, C7 } |
39 | #define UNUSED_PINS | 46 | #define UNUSED_PINS |
40 | 47 | ||
41 | #define BACKLIGHT_PIN F7 | ||
42 | |||
43 | /* COL2ROW or ROW2COL */ | 48 | /* COL2ROW or ROW2COL */ |
44 | #define DIODE_DIRECTION COL2ROW | 49 | #define DIODE_DIRECTION COL2ROW |
45 | 50 | ||
46 | /* define if matrix has ghost */ | 51 | /* Backlight configuration */ |
47 | //#define MATRIX_HAS_GHOST | 52 | #define BACKLIGHT_PIN F7 |
53 | #define BACKLIGHT_LEVELS 1 | ||
54 | |||
55 | /* Underlight configuration */ | ||
56 | #define RGB_DI_PIN F6 | ||
57 | #define RGBLED_NUM 4 | ||
58 | #define RGBLIGHT_ANIMATIONS | ||
48 | 59 | ||
49 | /* Set 0 if debouncing isn't needed */ | 60 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ |
50 | #define DEBOUNCING_DELAY 5 | 61 | #define DEBOUNCING_DELAY 5 |
51 | 62 | ||
63 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
64 | //#define MATRIX_HAS_GHOST | ||
65 | |||
52 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | 66 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ |
53 | //#define LOCKING_SUPPORT_ENABLE | 67 | //#define LOCKING_SUPPORT_ENABLE |
54 | /* Locking resynchronize hack */ | 68 | /* Locking resynchronize hack */ |
55 | #define LOCKING_RESYNC_ENABLE | 69 | #define LOCKING_RESYNC_ENABLE |
56 | 70 | ||
57 | /* Backlight configuration | ||
58 | */ | ||
59 | #define BACKLIGHT_LEVELS 4 | ||
60 | |||
61 | /* Underlight configuration | ||
62 | */ | ||
63 | |||
64 | #define RGB_DI_PIN F6 | ||
65 | #define RGBLIGHT_ANIMATIONS | ||
66 | #define RGBLED_NUM 4 // Number of LEDs | ||
67 | #define RGBLIGHT_HUE_STEP 10 | ||
68 | #define RGBLIGHT_SAT_STEP 17 | ||
69 | #define RGBLIGHT_VAL_STEP 17 | ||
70 | |||
71 | /* | 71 | /* |
72 | * Feature disable options | 72 | * Feature disable options |
73 | * These options are also useful to firmware size reduction. | 73 | * These options are also useful to firmware size reduction. |
@@ -86,4 +86,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
86 | //#define NO_ACTION_MACRO | 86 | //#define NO_ACTION_MACRO |
87 | //#define NO_ACTION_FUNCTION | 87 | //#define NO_ACTION_FUNCTION |
88 | 88 | ||
89 | #endif | 89 | /* Bootmagic Lite key configuration */ |
90 | // #define BOOTMAGIC_LITE_ROW 0 | ||
91 | // #define BOOTMAGIC_LITE_COLUMN 0 | ||
diff --git a/keyboards/cospad/cospad.c b/keyboards/cospad/cospad.c index 48d752a84..e7ef71f87 100644 --- a/keyboards/cospad/cospad.c +++ b/keyboards/cospad/cospad.c | |||
@@ -1,37 +1,33 @@ | |||
1 | |||
2 | /* Copyright 2019 | ||
3 | * | ||
4 | * 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 | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * 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/>. | ||
16 | */ | ||
1 | #include "cospad.h" | 17 | #include "cospad.h" |
2 | #include "led.h" | ||
3 | 18 | ||
4 | extern inline void cospad_bl_led_on(void); | 19 | #ifdef BACKLIGHT_ENABLE |
5 | extern inline void cospad_bl_led_off(void); | ||
6 | extern inline void cospad_bl_led_togg(void); | ||
7 | 20 | ||
8 | void matrix_init_kb(void) { | 21 | void backlight_init_ports(void) { |
9 | // put your keyboard start-up code here | 22 | setPinOutput(F7); |
10 | // runs once when the firmware starts up | 23 | } |
11 | matrix_init_user(); | ||
12 | led_init_ports(); | ||
13 | }; | ||
14 | |||
15 | void matrix_scan_kb(void) { | ||
16 | // put your looping keyboard code here | ||
17 | // runs every cycle (a lot) | ||
18 | matrix_scan_user(); | ||
19 | }; | ||
20 | 24 | ||
21 | void led_init_ports(void) { | 25 | void backlight_set(uint8_t level) { |
22 | // * Set our LED pins as output | 26 | writePin(F7, !!level); |
23 | DDRB |= (1<<2); | ||
24 | DDRF |= (1<<7); | ||
25 | // * Setting BL LEDs to init as off | ||
26 | PORTF |= (1<<7); | ||
27 | } | 27 | } |
28 | 28 | ||
29 | void led_set_kb(uint8_t usb_led) { | 29 | void backlight_task(void) { |
30 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | 30 | // do nothing - as default implementation of software PWM does not work |
31 | // Turn numlock on | ||
32 | PORTB &= ~(1<<2); | ||
33 | } else { | ||
34 | // Turn numlock off | ||
35 | PORTB |= (1<<2); | ||
36 | } | ||
37 | } | 31 | } |
32 | |||
33 | #endif //BACKLIGHT_ENABLE | ||
diff --git a/keyboards/cospad/cospad.h b/keyboards/cospad/cospad.h index df42b0df1..ad3ca0d6b 100644 --- a/keyboards/cospad/cospad.h +++ b/keyboards/cospad/cospad.h | |||
@@ -1,10 +1,32 @@ | |||
1 | #ifndef COSPAD_H | 1 | |
2 | #define COSPAD_H | 2 | /* Copyright 2019 |
3 | * | ||
4 | * 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 | ||
6 | * the Free Software Foundation, either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * 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/>. | ||
16 | */ | ||
17 | #pragma once | ||
3 | 18 | ||
4 | #include "quantum.h" | 19 | #include "quantum.h" |
20 | #define ___ KC_NO | ||
5 | 21 | ||
6 | // readability | 22 | /* This a shortcut to help you visually see your layout. |
7 | #define XXX KC_NO | 23 | * |
24 | * The first section contains all of the arguments representing the physical | ||
25 | * layout of the board and position of the keys. | ||
26 | * | ||
27 | * The second converts the arguments into a two-dimensional array which | ||
28 | * represents the switch matrix. | ||
29 | */ | ||
8 | 30 | ||
9 | /* COSPAD ortho matrix layout | 31 | /* COSPAD ortho matrix layout |
10 | * ,-------------------. | 32 | * ,-------------------. |
@@ -21,40 +43,6 @@ | |||
21 | * | 50 | 51 | 52 | 53 | | 43 | * | 50 | 51 | 52 | 53 | |
22 | * `-------------------' | 44 | * `-------------------' |
23 | */ | 45 | */ |
24 | |||
25 | /* COSPAD gamepad matrix layout | ||
26 | * ,-------------------. | ||
27 | * | 00 | 01 | 02 | 03 | | ||
28 | * |----|----|----|----| | ||
29 | * | 10 | 11 | 12 | 13 | | ||
30 | * |----|----|----|----| | ||
31 | * | 20 | 21 | 22 | | | ||
32 | * |----|----|----| 23 | | ||
33 | * | 30 | 31 | 32 | | | ||
34 | * |----|----|----|----| | ||
35 | * | 40 | 41 | 42 | 43 | | ||
36 | * |----|----|----|----| | ||
37 | * | 50 | 51 | 52 | 53 | | ||
38 | * `-------------------' | ||
39 | */ | ||
40 | |||
41 | /* COSPAD numpad matrix layout | ||
42 | * ,-------------------. | ||
43 | * | 00 | 01 | 02 | 03 | | ||
44 | * |----|----|----|----| | ||
45 | * | 10 | 11 | 12 | 13 | | ||
46 | * |----|----|----|----| | ||
47 | * | 20 | 21 | 22 | | | ||
48 | * |----|----|----| 23 | | ||
49 | * | 30 | 31 | 32 | | | ||
50 | * |----|----|----|----| | ||
51 | * | 40 | 41 | 42 | | | ||
52 | * |----|----|----| 43 | | ||
53 | * | 50 | 52 | | | ||
54 | * `-------------------' | ||
55 | */ | ||
56 | // The first section contains all of the arguments | ||
57 | // The second converts the arguments into a two-dimensional array | ||
58 | #define LAYOUT_ortho_6x4( \ | 46 | #define LAYOUT_ortho_6x4( \ |
59 | k00, k01, k02, k03, \ | 47 | k00, k01, k02, k03, \ |
60 | k10, k11, k12, k13, \ | 48 | k10, k11, k12, k13, \ |
@@ -72,6 +60,21 @@ | |||
72 | {k50, k51, k52, k53} \ | 60 | {k50, k51, k52, k53} \ |
73 | } | 61 | } |
74 | 62 | ||
63 | /* COSPAD gamepad matrix layout | ||
64 | * ,-------------------. | ||
65 | * | 00 | 01 | 02 | 03 | | ||
66 | * |----|----|----|----| | ||
67 | * | 10 | 11 | 12 | 13 | | ||
68 | * |----|----|----|----| | ||
69 | * | 20 | 21 | 22 | | | ||
70 | * |----|----|----| 23 | | ||
71 | * | 30 | 31 | 32 | | | ||
72 | * |----|----|----|----| | ||
73 | * | 40 | 41 | 42 | 43 | | ||
74 | * |----|----|----|----| | ||
75 | * | 50 | 51 | 52 | 53 | | ||
76 | * `-------------------' | ||
77 | */ | ||
75 | #define LAYOUT_gamepad_6x4( \ | 78 | #define LAYOUT_gamepad_6x4( \ |
76 | k00, k01, k02, k03, \ | 79 | k00, k01, k02, k03, \ |
77 | k10, k11, k12, k13, \ | 80 | k10, k11, k12, k13, \ |
@@ -84,11 +87,26 @@ | |||
84 | {k00, k01, k02, k03}, \ | 87 | {k00, k01, k02, k03}, \ |
85 | {k10, k11, k12, k13}, \ | 88 | {k10, k11, k12, k13}, \ |
86 | {k20, k21, k22, k23}, \ | 89 | {k20, k21, k22, k23}, \ |
87 | {k30, k31, k32, KC_NO}, \ | 90 | {k30, k31, k32, ___}, \ |
88 | {k40, k41, k42, k43}, \ | 91 | {k40, k41, k42, k43}, \ |
89 | {k50, k51, k52, k53} \ | 92 | {k50, k51, k52, k53} \ |
90 | } | 93 | } |
91 | 94 | ||
95 | /* COSPAD numpad matrix layout | ||
96 | * ,-------------------. | ||
97 | * | 00 | 01 | 02 | 03 | | ||
98 | * |----|----|----|----| | ||
99 | * | 10 | 11 | 12 | 13 | | ||
100 | * |----|----|----|----| | ||
101 | * | 20 | 21 | 22 | | | ||
102 | * |----|----|----| 23 | | ||
103 | * | 30 | 31 | 32 | | | ||
104 | * |----|----|----|----| | ||
105 | * | 40 | 41 | 42 | | | ||
106 | * |----|----|----| 43 | | ||
107 | * | 50 | 52 | | | ||
108 | * `-------------------' | ||
109 | */ | ||
92 | #define LAYOUT_numpad_6x4( \ | 110 | #define LAYOUT_numpad_6x4( \ |
93 | k00, k01, k02, k03, \ | 111 | k00, k01, k02, k03, \ |
94 | k10, k11, k12, k13, \ | 112 | k10, k11, k12, k13, \ |
@@ -98,25 +116,15 @@ | |||
98 | k50, k52, k43 \ | 116 | k50, k52, k43 \ |
99 | ) \ | 117 | ) \ |
100 | { \ | 118 | { \ |
101 | {k00, k01, k02, k03}, \ | 119 | {k00, k01, k02, k03}, \ |
102 | {k10, k11, k12, k13}, \ | 120 | {k10, k11, k12, k13}, \ |
103 | {k20, k21, k22, k23}, \ | 121 | {k20, k21, k22, k23}, \ |
104 | {k30, k31, k32, KC_NO}, \ | 122 | {k30, k31, k32, ___}, \ |
105 | {k40, k41, k42, k43}, \ | 123 | {k40, k41, k42, k43}, \ |
106 | {k50, KC_NO, k52, KC_NO} \ | 124 | {k50, ___, k52, ___} \ |
107 | } | 125 | } |
108 | void matrix_init_user(void); | ||
109 | void matrix_scan_user(void); | ||
110 | 126 | ||
111 | inline void cospad_bl_led_on(void) { PORTF &= ~(1<<7); } | 127 | // Add backwards compatibility for existing keymaps |
112 | inline void cospad_bl_led_off(void) { PORTF |= (1<<7); } | 128 | #define cospad_bl_led_on backlight_enable |
113 | 129 | #define cospad_bl_led_off backlight_disable | |
114 | inline void cospad_bl_led_togg(void) { | 130 | #define cospad_bl_led_togg backlight_toggle |
115 | uint8_t bl_mask = PORTF&(1<<7); | ||
116 | if (bl_mask) { | ||
117 | PORTF &= ~(1<<7); | ||
118 | } else { | ||
119 | PORTF |= (1<<7); | ||
120 | } | ||
121 | } | ||
122 | #endif | ||
diff --git a/keyboards/cospad/info.json b/keyboards/cospad/info.json index b34013a47..c17f44f52 100644 --- a/keyboards/cospad/info.json +++ b/keyboards/cospad/info.json | |||
@@ -7,6 +7,7 @@ | |||
7 | "height": 6, | 7 | "height": 6, |
8 | "layouts": { | 8 | "layouts": { |
9 | "LAYOUT_numpad_6x4": { | 9 | "LAYOUT_numpad_6x4": { |
10 | "key_count": 21, | ||
10 | "layout": [ | 11 | "layout": [ |
11 | {"label":"Esc", "x":0, "y":0}, | 12 | {"label":"Esc", "x":0, "y":0}, |
12 | {"label":"Tab", "x":1, "y":0}, | 13 | {"label":"Tab", "x":1, "y":0}, |
@@ -33,35 +34,62 @@ | |||
33 | }, | 34 | }, |
34 | 35 | ||
35 | "LAYOUT_gamepad_6x4": { | 36 | "LAYOUT_gamepad_6x4": { |
37 | "key_count": 23, | ||
36 | "layout": [ | 38 | "layout": [ |
37 | {"label":"k00", "x":5, "y":0}, | 39 | {"label":"k00", "x":0, "y":0}, |
38 | {"label":"k01", "x":5, "y":1}, | 40 | {"label":"k01", "x":1, "y":0}, |
39 | {"label":"k02", "x":5, "y":2}, | 41 | {"label":"k02", "x":2, "y":0}, |
40 | {"label":"k03", "x":5, "y":3}, | 42 | {"label":"k03", "x":3, "y":0}, |
41 | {"label":"k10", "x":4, "y":0}, | 43 | {"label":"k10", "x":0, "y":1}, |
42 | {"label":"k11", "x":4, "y":1}, | 44 | {"label":"k11", "x":1, "y":1}, |
43 | {"label":"k12", "x":4, "y":2}, | 45 | {"label":"k12", "x":2, "y":1}, |
44 | {"label":"k13", "x":4, "y":3}, | 46 | {"label":"k13", "x":3, "y":1}, |
45 | {"label":"k20", "x":3, "y":0}, | 47 | {"label":"k20", "x":0, "y":2}, |
46 | {"label":"k21", "x":3, "y":1}, | 48 | {"label":"k21", "x":1, "y":2}, |
47 | {"label":"k22", "x":3, "y":2}, | 49 | {"label":"k22", "x":2, "y":2}, |
48 | {"label":"k30", "x":2, "y":0}, | 50 | {"label":"k30", "x":0, "y":3}, |
49 | {"label":"k31", "x":2, "y":1}, | 51 | {"label":"k31", "x":1, "y":3}, |
50 | {"label":"k32", "x":2, "y":2}, | 52 | {"label":"k32", "x":2, "y":3}, |
51 | {"label":"k23", "x":2, "y":3, "w":2}, | 53 | {"label":"k23", "x":3, "y":2, "h":2}, |
52 | {"label":"k40", "x":1, "y":0}, | 54 | {"label":"k40", "x":0, "y":4}, |
53 | {"label":"k41", "x":1, "y":1}, | 55 | {"label":"k41", "x":1, "y":4}, |
54 | {"label":"k42", "x":1, "y":2}, | 56 | {"label":"k42", "x":2, "y":4}, |
55 | {"label":"k43", "x":1, "y":3}, | 57 | {"label":"k43", "x":3, "y":4}, |
56 | {"label":"k50", "x":0, "y":0}, | 58 | {"label":"k50", "x":0, "y":5}, |
57 | {"label":"k51", "x":0, "y":1}, | 59 | {"label":"k51", "x":1, "y":5}, |
58 | {"label":"k52", "x":0, "y":2}, | 60 | {"label":"k52", "x":2, "y":5}, |
59 | {"label":"k53", "x":0, "y":3} | 61 | {"label":"k53", "x":3, "y":5} |
60 | ] | 62 | ] |
61 | }, | 63 | }, |
62 | 64 | ||
63 | "LAYOUT_ortho_6x4": { | 65 | "LAYOUT_ortho_6x4": { |
64 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"Tab", "x":1, "y":0}, {"label":"Fn", "x":2, "y":0}, {"label":"Back", "x":3, "y":0}, {"label":"Num Lock", "x":0, "y":1}, {"label":"/", "x":1, "y":1}, {"label":"*", "x":2, "y":1}, {"label":"-", "x":3, "y":1}, {"label":"7", "x":0, "y":2}, {"label":"8", "x":1, "y":2}, {"label":"9", "x":2, "y":2}, {"label":"+", "x":3, "y":2}, {"label":"4", "x":0, "y":3}, {"label":"5", "x":1, "y":3}, {"label":"6", "x":2, "y":3}, {"x":3, "y":3}, {"label":"1", "x":0, "y":4}, {"label":"2", "x":1, "y":4}, {"label":"3", "x":2, "y":4}, {"label":"Enter", "x":3, "y":4}, {"label":"0", "x":0, "y":5}, {"x":1, "y":5}, {"label":".", "x":2, "y":5}, {"x":3, "y":5}] | 66 | "key_count": 24, |
67 | "layout": [ | ||
68 | {"label":"k00", "x":0, "y":0}, | ||
69 | {"label":"k01", "x":1, "y":0}, | ||
70 | {"label":"k02", "x":2, "y":0}, | ||
71 | {"label":"k03", "x":3, "y":0}, | ||
72 | {"label":"k10", "x":0, "y":1}, | ||
73 | {"label":"k11", "x":1, "y":1}, | ||
74 | {"label":"k12", "x":2, "y":1}, | ||
75 | {"label":"k13", "x":3, "y":1}, | ||
76 | {"label":"k20", "x":0, "y":2}, | ||
77 | {"label":"k21", "x":1, "y":2}, | ||
78 | {"label":"k22", "x":2, "y":2}, | ||
79 | {"label":"k23", "x":3, "y":2}, | ||
80 | {"label":"k30", "x":0, "y":3}, | ||
81 | {"label":"k31", "x":1, "y":3}, | ||
82 | {"label":"k32", "x":2, "y":3}, | ||
83 | {"label":"k33", "x":3, "y":3}, | ||
84 | {"label":"k40", "x":0, "y":4}, | ||
85 | {"label":"k41", "x":1, "y":4}, | ||
86 | {"label":"k42", "x":2, "y":4}, | ||
87 | {"label":"k43", "x":3, "y":4}, | ||
88 | {"label":"k50", "x":0, "y":5}, | ||
89 | {"label":"k51", "x":1, "y":5}, | ||
90 | {"label":"k52", "x":2, "y":5}, | ||
91 | {"label":"k53", "x":3, "y":5} | ||
92 | ] | ||
65 | } | 93 | } |
66 | } | 94 | } |
67 | } | 95 | } |
diff --git a/keyboards/cospad/keymaps/default/keymap.c b/keyboards/cospad/keymaps/default/keymap.c index 345e96996..adcca112d 100644 --- a/keyboards/cospad/keymaps/default/keymap.c +++ b/keyboards/cospad/keymaps/default/keymap.c | |||
@@ -1,80 +1,60 @@ | |||
1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
2 | #include "led.h" | ||
3 | 2 | ||
4 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 3 | // Each layer gets a name for readability, which is then used in the keymap matrix below. |
5 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | 4 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. |
6 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | 5 | // Layer names don't all need to be of the same length, obviously, and you can also skip them |
7 | // entirely and just use numbers. | 6 | // entirely and just use numbers. |
8 | #define _BL 0 | 7 | enum layers { |
9 | #define _FL 1 | 8 | _BL = 0, |
9 | _FL | ||
10 | }; | ||
10 | 11 | ||
11 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 12 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
12 | /* Keymap _BL: (Base Layer) Default Layer | 13 | /* Keymap _BL: (Base Layer) Default Layer |
13 | * ,-------------------. | 14 | * ,-------------------. |
14 | * |Esc |TAB | FN | BS | | 15 | * |Esc |TAB | FN | BS | |
15 | * |----|----|----|----| | 16 | * |----|----|----|----| |
16 | * | NL | / | * | - | | 17 | * | NL | / | * | - | |
17 | * |----|----|----|----| | 18 | * |----|----|----|----| |
18 | * | 7 | 8 | 9 | | | 19 | * | 7 | 8 | 9 | | |
19 | * |----|----|----| + | | 20 | * |----|----|----| + | |
20 | * | 4 | 5 | 6 | | | 21 | * | 4 | 5 | 6 | | |
21 | * |----|----|----|----| | 22 | * |----|----|----|----| |
22 | * | 1 | 2 | 3 | | | 23 | * | 1 | 2 | 3 | | |
23 | * |----|----|----| En | | 24 | * |----|----|----| En | |
24 | * | 0 | . | | | 25 | * | 0 | . | | |
25 | * `-------------------' | 26 | * `-------------------' |
26 | */ | 27 | */ |
27 | 28 | [_BL] = LAYOUT_numpad_6x4( | |
28 | [_BL] = LAYOUT_numpad_6x4( | 29 | KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ |
29 | KC_ESC, KC_TAB, MO(_FL), KC_BSPC, \ | 30 | KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ |
30 | KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ | 31 | KC_P7, KC_P8, KC_P9, \ |
31 | KC_P7, KC_P8, KC_P9, \ | 32 | KC_P4, KC_P5, KC_P6, KC_PPLS, \ |
32 | KC_P4, KC_P5, KC_P6, KC_PPLS, \ | 33 | KC_P1, KC_P2, KC_P3, \ |
33 | KC_P1, KC_P2, KC_P3, \ | 34 | KC_P0, KC_PDOT, KC_PENT |
34 | KC_P0, KC_PDOT, KC_PENT), | 35 | ), |
35 | 36 | ||
36 | /* Keymap _FL: Function Layer | 37 | /* Keymap _FL: Function Layer |
37 | * ,-------------------. | 38 | * ,-------------------. |
38 | * |RGBT|TAB | FN | BS | | 39 | * |RGBT| | | | |
39 | * |----|----|----|----| | 40 | * |----|----|----|----| |
40 | * |RGBM|RGBP|BTOG| - | | 41 | * |RGBM|RGBP|BTOG| | |
41 | * |----|----|----|----| | 42 | * |----|----|----|----| |
42 | * |HUD |HUI |BON | | | 43 | * |HUD |HUI |BON | | |
43 | * |----|----|----| + | | 44 | * |----|----|----| | |
44 | * |SAD |SAI |BOFF| | | 45 | * |SAD |SAI |BOFF| | |
45 | * |----|----|----|----| | 46 | * |----|----|----|----| |
46 | * |VAD |VAS | 3 | | | 47 | * |VAD |VAS |BSTP| | |
47 | * |----|----|----| En | | 48 | * |----|----|----| | |
48 | * | 0 |RST | | | 49 | * | |RST | | |
49 | * `-------------------' | 50 | * `-------------------' |
50 | */ | 51 | */ |
51 | [_FL] = LAYOUT_numpad_6x4( | 52 | [_FL] = LAYOUT_numpad_6x4( |
52 | RGB_TOG, KC_TAB, KC_TRNS, KC_BSPC, \ | 53 | RGB_TOG, _______, _______, _______, \ |
53 | RGB_MOD, RGB_M_P, BL_TOGG, KC_PMNS, \ | 54 | RGB_MOD, RGB_M_P, BL_TOGG, _______, \ |
54 | RGB_HUD, RGB_HUI, BL_ON, \ | 55 | RGB_HUD, RGB_HUI, BL_ON, \ |
55 | RGB_SAD, RGB_SAI, BL_OFF, KC_PPLS, \ | 56 | RGB_SAD, RGB_SAI, BL_OFF, _______, \ |
56 | RGB_VAD, RGB_VAI, KC_P3, \ | 57 | RGB_VAD, RGB_VAI, BL_STEP, \ |
57 | KC_P0, RESET, KC_PENT), | 58 | _______, RESET, _______ |
59 | ), | ||
58 | }; | 60 | }; |
59 | |||
60 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
61 | switch (keycode) { | ||
62 | case BL_TOGG: | ||
63 | if (record->event.pressed) { | ||
64 | cospad_bl_led_togg(); | ||
65 | } | ||
66 | return false; | ||
67 | case BL_ON: | ||
68 | if (record->event.pressed) { | ||
69 | cospad_bl_led_on(); | ||
70 | } | ||
71 | return false; | ||
72 | case BL_OFF: | ||
73 | if(record->event.pressed) { | ||
74 | cospad_bl_led_off(); | ||
75 | } | ||
76 | return false; | ||
77 | default: | ||
78 | return true; | ||
79 | } | ||
80 | } | ||
diff --git a/keyboards/cospad/rules.mk b/keyboards/cospad/rules.mk index 3c5913d0d..61c7a5182 100644 --- a/keyboards/cospad/rules.mk +++ b/keyboards/cospad/rules.mk | |||
@@ -1,6 +1,5 @@ | |||
1 | 1 | ||
2 | # MCU name | 2 | # MCU name |
3 | #MCU = at90usb1287 | ||
4 | MCU = atmega32u4 | 3 | MCU = atmega32u4 |
5 | 4 | ||
6 | # Processor frequency. | 5 | # Processor frequency. |
@@ -40,27 +39,43 @@ F_USB = $(F_CPU) | |||
40 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | 39 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT |
41 | 40 | ||
42 | 41 | ||
42 | # Bootloader selection | ||
43 | # Teensy halfkay | ||
44 | # Pro Micro caterina | ||
45 | # Atmel DFU atmel-dfu | ||
46 | # LUFA DFU lufa-dfu | ||
47 | # QMK DFU qmk-dfu | ||
48 | # atmega32a bootloadHID | ||
49 | BOOTLOADER = atmel-dfu | ||
50 | |||
51 | |||
43 | # Boot Section Size in *bytes* | 52 | # Boot Section Size in *bytes* |
44 | # Teensy halfKay 512 | 53 | # Teensy halfKay 512 |
45 | # Teensy++ halfKay 1024 | 54 | # Teensy++ halfKay 1024 |
46 | # Atmel DFU loader 4096 | 55 | # Atmel DFU loader 4096 |
47 | # LUFA bootloader 4096 | 56 | # LUFA bootloader 4096 |
48 | # USBaspLoader 2048 | 57 | # USBaspLoader 2048 |
49 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | 58 | # OPT_DEFS += -DBOOTLOADER_SIZE=4096 |
50 | 59 | ||
51 | 60 | ||
52 | # Build Options | 61 | # Build Options |
53 | # comment out to disable the options. | 62 | # comment out to disable the options. |
54 | # | 63 | # |
55 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | 64 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000) |
56 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) | 65 | MOUSEKEY_ENABLE = no # Mouse keys(+4700) |
57 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | 66 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) |
58 | CONSOLE_ENABLE = no # Console for debug(+400) | 67 | CONSOLE_ENABLE = no # Console for debug(+400) |
59 | COMMAND_ENABLE = no # Commands for debug and configuration | 68 | COMMAND_ENABLE = no # Commands for debug and configuration |
60 | NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | 69 | NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work |
61 | RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) | 70 | BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality |
62 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality (+1150) | 71 | BACKLIGHT_CUSTOM_DRIVER = yes |
63 | MIDI_ENABLE = no # MIDI controls | 72 | RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) |
64 | AUDIO_ENABLE = no | 73 | MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) |
65 | UNICODE_ENABLE = no # Unicode | 74 | UNICODE_ENABLE = no # Unicode |
66 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | 75 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID |
76 | AUDIO_ENABLE = no # Audio output on port C6 | ||
77 | FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches | ||
78 | HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400) | ||
79 | |||
80 | |||
81 | LAYOUTS = numpad_6x4 ortho_6x4 | ||