aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryulei <yuleiz@gmail.com>2020-10-02 07:07:14 +0800
committerGitHub <noreply@github.com>2020-10-02 00:07:14 +0100
commit8070b1ba8862f1a98bafd0b0dc0889f7659ea456 (patch)
tree61a7038f47c2857a6385b544217b69000f93d7c0
parent726499553c3ab0324274a66df63571a5a355d5df (diff)
downloadqmk_firmware-8070b1ba8862f1a98bafd0b0dc0889f7659ea456.tar.gz
qmk_firmware-8070b1ba8862f1a98bafd0b0dc0889f7659ea456.zip
Added replacement pcb for the matrix cain keyboard (#10436)
* added replacement pcb for the matrix cain keyboard * update usb descriptor * fixed led polarity * Update keyboards/matrix/cain/cain.c Co-authored-by: Joel Challis <git@zvecr.com> * Update keyboards/matrix/cain/rules.mk Co-authored-by: Ryan <fauxpark@gmail.com> * Apply suggestions from code review Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * rename from cain to cain_re * Update keyboards/matrix/cain_re/readme.md Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
-rw-r--r--keyboards/matrix/cain_re/cain_re.c40
-rw-r--r--keyboards/matrix/cain_re/cain_re.h40
-rw-r--r--keyboards/matrix/cain_re/config.h58
-rw-r--r--keyboards/matrix/cain_re/info.json12
-rw-r--r--keyboards/matrix/cain_re/keymaps/default/keymap.c40
-rw-r--r--keyboards/matrix/cain_re/readme.md15
-rw-r--r--keyboards/matrix/cain_re/rules.mk22
7 files changed, 227 insertions, 0 deletions
diff --git a/keyboards/matrix/cain_re/cain_re.c b/keyboards/matrix/cain_re/cain_re.c
new file mode 100644
index 000000000..e8d0a2b80
--- /dev/null
+++ b/keyboards/matrix/cain_re/cain_re.c
@@ -0,0 +1,40 @@
1/**
2 * cain_re.c
3 *
4 Copyright 2020 astro <yuleiz@gmail.com>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "cain_re.h"
21
22void matrix_init_kb(void)
23{
24 setPinOutput(NUM_PIN);
25 setPinOutput(CAPS_PIN);
26 setPinOutput(SCROLL_PIN);
27
28 matrix_init_user();
29}
30
31bool led_update_kb(led_t led_state)
32{
33 bool res = led_update_user(led_state);
34 if (res) {
35 writePin(NUM_PIN, led_state.num_lock);
36 writePin(CAPS_PIN, led_state.caps_lock);
37 writePin(SCROLL_PIN, led_state.scroll_lock);
38 }
39 return res;
40}
diff --git a/keyboards/matrix/cain_re/cain_re.h b/keyboards/matrix/cain_re/cain_re.h
new file mode 100644
index 000000000..0228177e1
--- /dev/null
+++ b/keyboards/matrix/cain_re/cain_re.h
@@ -0,0 +1,40 @@
1/**
2 * cain_re.h
3 *
4 Copyright 2020 astro <yuleiz@gmail.com>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#pragma once
20
21#include "quantum.h"
22
23#define LAYOUT_all( \
24 k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, k014, k015, \
25 k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117, k118, k119, k120, \
26 k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, k216, k217, k218, k219, k220, \
27 k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, k314, k315, k316, \
28 k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, k414, k415, k416, \
29 k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513 \
30) { \
31 { k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011}, \
32 { k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111}, \
33 { k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211}, \
34 { k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311}, \
35 { k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411}, \
36 { k012, k113, k112, k212, k213, k312, k412, k413, k414, k415, k316, k315}, \
37 { k114, k115, k116, k117, k217, k216, k215, k214, k313, k314, k416, KC_NO}, \
38 { k013, k014, k015, k120, k119, k118, k218, k219, k220, k511, k512, k513}, \
39 { k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, KC_NO} \
40}
diff --git a/keyboards/matrix/cain_re/config.h b/keyboards/matrix/cain_re/config.h
new file mode 100644
index 000000000..6bacf1c94
--- /dev/null
+++ b/keyboards/matrix/cain_re/config.h
@@ -0,0 +1,58 @@
1/**
2 * config.h
3 *
4 Copyright 2020 astro <yuleiz@gmail.com>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "config_common.h"
23
24/* USB Device descriptor parameter */
25#define VENDOR_ID 0x4D58 // MX
26#define PRODUCT_ID 0x0106 // cain
27#define DEVICE_VER 0x0001
28#define MANUFACTURER Matrix LAB
29#define PRODUCT Matrix Cain Keyboard
30
31/* key matrix size */
32#define MATRIX_ROWS 9
33#define MATRIX_COLS 12
34
35/* key matrix pins */
36#define MATRIX_ROW_PINS { F0, C7, C6, D5, D2, D4, D7, B7, D1 }
37#define MATRIX_COL_PINS { F1, F4, F5, F6, B5, B6, B3, B2, B1, D0, B4, D6}
38#define UNUSED_PINS
39
40/* COL2ROW or ROW2COL */
41#define DIODE_DIRECTION COL2ROW
42
43#define RGB_DI_PIN E6
44
45#ifdef RGB_DI_PIN
46#define RGBLIGHT_ANIMATIONS
47
48#define RGBLED_NUM 14
49#define RGBLIGHT_HUE_STEP 8
50#define RGBLIGHT_SAT_STEP 8
51#define RGBLIGHT_VAL_STEP 8
52#define RGBLIGHT_SLEEP
53#define RGBLIGHT_LED_MAP { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 2, 3 }
54#endif
55
56#define CAPS_PIN D3
57#define NUM_PIN F7
58#define SCROLL_PIN B0
diff --git a/keyboards/matrix/cain_re/info.json b/keyboards/matrix/cain_re/info.json
new file mode 100644
index 000000000..3f65b7de7
--- /dev/null
+++ b/keyboards/matrix/cain_re/info.json
@@ -0,0 +1,12 @@
1{
2 "keyboard_name": "Matrix Cain Keyboard",
3 "url": "",
4 "maintainer": "qmk",
5 "width": 23,
6 "height": 6.5,
7 "layouts": {
8 "LAYOUT_all": {
9 "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"F1", "x":2, "y":0}, {"label":"F2", "x":3, "y":0}, {"label":"F3", "x":4, "y":0}, {"label":"F4", "x":5, "y":0}, {"label":"F5", "x":6.5, "y":0}, {"label":"F6", "x":7.5, "y":0}, {"label":"F7", "x":8.5, "y":0}, {"label":"F8", "x":9.5, "y":0}, {"label":"F9", "x":11, "y":0}, {"label":"F10", "x":12, "y":0}, {"label":"F11", "x":13, "y":0}, {"label":"F12", "x":14, "y":0}, {"label":"PrtSc", "x":20, "y":0}, {"label":"Scroll Lock", "x":21, "y":0}, {"label":"Pause", "x":22, "y":0}, {"label":"~", "x":0, "y":1.5}, {"label":"!", "x":1, "y":1.5}, {"label":"@", "x":2, "y":1.5}, {"label":"#", "x":3, "y":1.5}, {"label":"$", "x":4, "y":1.5}, {"label":"%", "x":5, "y":1.5}, {"label":"^", "x":6, "y":1.5}, {"label":"&", "x":7, "y":1.5}, {"label":"*", "x":8, "y":1.5}, {"label":"(", "x":9, "y":1.5}, {"label":")", "x":10, "y":1.5}, {"label":"_", "x":11, "y":1.5}, {"label":"+", "x":12, "y":1.5}, {"label":"Backspace", "x":13, "y":1.5, "w":2}, {"label":"Num Lock", "x":15.5, "y":1.5}, {"label":"/", "x":16.5, "y":1.5}, {"label":"*", "x":17.5, "y":1.5}, {"label":"-", "x":18.5, "y":1.5}, {"label":"Insert", "x":20, "y":1.5}, {"label":"Home", "x":21, "y":1.5}, {"label":"PgUp", "x":22, "y":1.5}, {"label":"Tab", "x":0, "y":2.5, "w":1.5}, {"label":"Q", "x":1.5, "y":2.5}, {"label":"W", "x":2.5, "y":2.5}, {"label":"E", "x":3.5, "y":2.5}, {"label":"R", "x":4.5, "y":2.5}, {"label":"T", "x":5.5, "y":2.5}, {"label":"Y", "x":6.5, "y":2.5}, {"label":"U", "x":7.5, "y":2.5}, {"label":"I", "x":8.5, "y":2.5}, {"label":"O", "x":9.5, "y":2.5}, {"label":"P", "x":10.5, "y":2.5}, {"label":"{", "x":11.5, "y":2.5}, {"label":"}", "x":12.5, "y":2.5}, {"label":"|", "x":13.5, "y":2.5, "w":1.5}, {"label":"7", "x":15.5, "y":2.5}, {"label":"8", "x":16.5, "y":2.5}, {"label":"9", "x":17.5, "y":2.5}, {"label":"+", "x":18.5, "y":2.5}, {"label":"Delete", "x":20, "y":2.5}, {"label":"End", "x":21, "y":2.5}, {"label":"PgDn", "x":22, "y":2.5}, {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, {"label":"A", "x":1.75, "y":3.5}, {"label":"S", "x":2.75, "y":3.5}, {"label":"D", "x":3.75, "y":3.5}, {"label":"F", "x":4.75, "y":3.5}, {"label":"G", "x":5.75, "y":3.5}, {"label":"H", "x":6.75, "y":3.5}, {"label":"J", "x":7.75, "y":3.5}, {"label":"K", "x":8.75, "y":3.5}, {"label":"L", "x":9.75, "y":3.5}, {"label":":", "x":10.75, "y":3.5}, {"label":"\"", "x":11.75, "y":3.5}, {"label":"Enter", "x":12.75, "y":3.5, "w":2.25}, {"label":"4", "x":15.5, "y":3.5}, {"label":"5", "x":16.5, "y":3.5}, {"label":"6", "x":17.5, "y":3.5}, {"label":"+", "x":18.5, "y":3.5}, {"label":"Shift", "x":0, "y":4.5, "w":2.25}, {"label":"Z", "x":2.25, "y":4.5}, {"label":"X", "x":3.25, "y":4.5}, {"label":"C", "x":4.25, "y":4.5}, {"label":"V", "x":5.25, "y":4.5}, {"label":"B", "x":6.25, "y":4.5}, {"label":"N", "x":7.25, "y":4.5}, {"label":"M", "x":8.25, "y":4.5}, {"label":"<", "x":9.25, "y":4.5}, {"label":">", "x":10.25, "y":4.5}, {"label":"?", "x":11.25, "y":4.5}, {"label":"Shift", "x":12.25, "y":4.5, "w":2.75}, {"label":"1", "x":15.5, "y":4.5}, {"label":"2", "x":16.5, "y":4.5}, {"label":"3", "x":17.5, "y":4.5}, {"label":"Enter", "x":18.5, "y":4.5}, {"label":"\u2191", "x":21, "y":4.5}, {"label":"Ctrl", "x":0, "y":5.5, "w":1.5}, {"label":"Win", "x":1.5, "y":5.5}, {"label":"Alt", "x":2.5, "y":5.5, "w":1.5}, {"x":4, "y":5.5, "w":7}, {"label":"Alt", "x":11, "y":5.5, "w":1.5}, {"label":"Win", "x":12.5, "y":5.5}, {"label":"Ctrl", "x":13.5, "y":5.5, "w":1.5}, {"label":"0", "x":15.5, "y":5.5}, {"label":"0", "x":16.5, "y":5.5}, {"label":".", "x":17.5, "y":5.5}, {"label":"Enter", "x":18.5, "y":5.5}, {"label":"\u2190", "x":20, "y":5.5}, {"label":"\u2193", "x":21, "y":5.5}, {"label":"\u2192", "x":22, "y":5.5}]
10 }
11 }
12}
diff --git a/keyboards/matrix/cain_re/keymaps/default/keymap.c b/keyboards/matrix/cain_re/keymaps/default/keymap.c
new file mode 100644
index 000000000..1f2d3b4e2
--- /dev/null
+++ b/keyboards/matrix/cain_re/keymaps/default/keymap.c
@@ -0,0 +1,40 @@
1/**
2 * keymap.c
3 *
4 Copyright 2020 astro <yuleiz@gmail.com>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include QMK_KEYBOARD_H
21
22const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
23 [0]=LAYOUT_all(
24 KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, LT(1,KC_PAUS),
25
26 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_INS, KC_HOME, KC_PGUP,
27 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_DEL, KC_END, KC_PGDN,
28 KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS,
29 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_P1, KC_P2, KC_P3, KC_PENT, KC_UP,
30 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_P0, KC_P0, KC_PDOT, KC_PENT, KC_LEFT, KC_DOWN, KC_RGHT),
31
32 [1]=LAYOUT_all(
33 KC_MUTE, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
34
35 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,_______,_______,_______,_______, _______, _______,
36 KC_NLCK, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, _______,_______,_______,_______,_______, _______, _______,
37 RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,_______,_______,_______,
38 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,_______,_______,_______, KC_VOLU,
39 _______, _______, _______, KC_MPLY, _______, _______, _______, _______,_______,_______,_______, KC_MPRV, KC_VOLD, KC_MNXT),
40};
diff --git a/keyboards/matrix/cain_re/readme.md b/keyboards/matrix/cain_re/readme.md
new file mode 100644
index 000000000..13c86ea54
--- /dev/null
+++ b/keyboards/matrix/cain_re/readme.md
@@ -0,0 +1,15 @@
1# Matrix Cain replacement PCB
2
3This was the replacement PCB for the Matrix Cain keyboard.
4
5This firmware **DOES NOT** support the original PCB shipped with the Cain keyboard.
6
7* Keyboard Maintainer: [astro](https://github.com/yulei)
8* Hardware Supported: Matrix Cain keyboard
9* Hardware Availability: Matrix Lab
10
11Make example for this keyboard (after setting up your build environment):
12
13 make matrix/cain_re:default
14
15See 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/matrix/cain_re/rules.mk b/keyboards/matrix/cain_re/rules.mk
new file mode 100644
index 000000000..9bbb324e7
--- /dev/null
+++ b/keyboards/matrix/cain_re/rules.mk
@@ -0,0 +1,22 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = full # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = yes # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output