aboutsummaryrefslogtreecommitdiff
path: root/keyboards/massdrop/ctrl
diff options
context:
space:
mode:
authormechmerlin <mechmerlin@gmail.com>2018-08-29 13:27:03 -0700
committerJack Humbert <jack.humb@gmail.com>2018-08-29 16:38:12 -0400
commit6794a5c9dcf12c7b528c46dfd48d8f7157bc585f (patch)
treeb9215de27ae6aca467c1249cdfb684c4425ab5b5 /keyboards/massdrop/ctrl
parent621ce29a53e9e94e085fbd86c0b7134e9df4bfe5 (diff)
downloadqmk_firmware-6794a5c9dcf12c7b528c46dfd48d8f7157bc585f.tar.gz
qmk_firmware-6794a5c9dcf12c7b528c46dfd48d8f7157bc585f.zip
move massdrop boards into its own directory for configurator visibility
Diffstat (limited to 'keyboards/massdrop/ctrl')
-rw-r--r--keyboards/massdrop/ctrl/config.h79
-rw-r--r--keyboards/massdrop/ctrl/config_led.h191
-rw-r--r--keyboards/massdrop/ctrl/ctrl.h32
-rw-r--r--keyboards/massdrop/ctrl/keymaps/default/keymap.c203
-rw-r--r--keyboards/massdrop/ctrl/led_programs.c120
-rw-r--r--keyboards/massdrop/ctrl/matrix.c182
-rw-r--r--keyboards/massdrop/ctrl/matrix.h77
-rw-r--r--keyboards/massdrop/ctrl/readme.md15
-rw-r--r--keyboards/massdrop/ctrl/rules.mk32
9 files changed, 931 insertions, 0 deletions
diff --git a/keyboards/massdrop/ctrl/config.h b/keyboards/massdrop/ctrl/config.h
new file mode 100644
index 000000000..1ab7f93cd
--- /dev/null
+++ b/keyboards/massdrop/ctrl/config.h
@@ -0,0 +1,79 @@
1/*
2Copyright 2015 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#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0x04D8
24#define PRODUCT_ID 0xEED2
25#define DEVICE_VER 0x0101
26
27#define MANUFACTURER "Massdrop Inc."
28#define PRODUCT "CTRL Keyboard"
29#define SERIAL_NUM "Unavailable"
30
31/* key matrix size */
32#define MATRIX_ROWS 11
33#define MATRIX_COLS 8
34
35#define PA 0
36#define PB 1
37
38#define MATRIX_ROW_PORTS PB, PB, PB, PB, PB, PB, PA, PA, PB, PB, PB
39#define MATRIX_ROW_PINS 4, 5, 6, 7, 8, 9, 10, 11, 10, 11, 12
40
41#define MATRIX_COL_PORTS PA, PA, PA, PA, PA, PA, PA, PA
42#define MATRIX_COL_PINS 0, 1, 2, 3, 4, 5, 6, 7
43
44/* Print boot debug codes using debug LED when M28 and M30 shorted */
45#define DEBUG_BOOT_TRACING
46
47/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
48#define DEBOUNCING_DELAY 5
49
50/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
51//#define LOCKING_SUPPORT_ENABLE
52/* Locking resynchronize hack */
53//#define LOCKING_RESYNC_ENABLE
54
55/* key combination for command */
56#define IS_COMMAND() ( \
57 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
58)
59
60/* Force boot in NKRO mode */
61//#define FORCE_NKRO
62
63/*
64 * Feature disable options
65 * These options are also useful to firmware size reduction.
66 */
67
68/* disable debug print */
69//#define NO_DEBUG
70
71/* disable print */
72//#define NO_PRINT
73
74/* disable action features */
75//#define NO_ACTION_LAYER
76//#define NO_ACTION_TAPPING
77//#define NO_ACTION_ONESHOT
78//#define NO_ACTION_MACRO
79//#define NO_ACTION_FUNCTION
diff --git a/keyboards/massdrop/ctrl/config_led.h b/keyboards/massdrop/ctrl/config_led.h
new file mode 100644
index 000000000..65563daa3
--- /dev/null
+++ b/keyboards/massdrop/ctrl/config_led.h
@@ -0,0 +1,191 @@
1/*
2Copyright 2018 Massdrop Inc.
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_led_h_
19#define _config_led_h_
20
21//Define number of ISSI3733 drivers being used (1...16)
22#define ISSI3733_DRIVER_COUNT 2
23
24//Hardware address of each driver (Refer to ISSI3733 pdf "Table 1 Slave Address" and keyboard schematic)
25#define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE }
26
27//LED I2C bus speed
28#define I2C_HZ 580000
29
30//Count of LED bodies
31#define ISSI3733_LED_COUNT 119
32
33//Default Global Current Register value (Default brightness 0 - 255)
34#define ISSI3733_GCR_DEFAULT 128
35
36#define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus
37#define LED_GCR_STEP 10 //GCR increment/decrement value
38
39//Automatic power rollback and recovery
40#define V5_HIGH 2540 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
41#define V5_LOW 2480 //5V low level (LED power rolled back to stay above this limit)
42#define V5_CAT 2200 //5V catastrophic level (Host USB port potential to shut down)
43
44#define ANIMATION_SPEED_STEP 1
45
46#define BREATHE_MIN_STEP 0
47#define BREATHE_MAX_STEP 255
48
49//LED Mapping - More practically generated from a spreadsheet program
50//id: ID of the LED (Sync with PCB callouts)
51//x: Physical X coordinate of LED (units do not matter)
52//y: Physical Y coordinate of LED (units do not matter)
53//drv: 1-Based index of ISSI3773_DRIVER_ADDRESSES
54//cs: Matrix wiring CS col (1-16)
55//swr: Matrix wiring SW Red row (1-12)
56//swg: Matrix wiring SW Green row (1-12)
57//swb: Matrix wiring SW Blue row (1-12)
58//scan: Associated key scancode if any
59//Note: Origin 0,0 may be located anywhere as the software will do the final layout
60#define ISSI3733_LED_MAP { \
61 { .id = 1, .x = 0, .y = 0, .adr = { .drv = 2, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 0 }, \
62 { .id = 2, .x = 1.5, .y = 0, .adr = { .drv = 2, .cs = 3, .swr = 5, .swg = 4, .swb = 6 }, .scan = 1 }, \
63 { .id = 3, .x = 2.25, .y = 0, .adr = { .drv = 2, .cs = 4, .swr = 5, .swg = 4, .swb = 6 }, .scan = 2 }, \
64 { .id = 4, .x = 3, .y = 0, .adr = { .drv = 2, .cs = 5, .swr = 5, .swg = 4, .swb = 6 }, .scan = 3 }, \
65 { .id = 5, .x = 3.75, .y = 0, .adr = { .drv = 2, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 4 }, \
66 { .id = 6, .x = 4.875, .y = 0, .adr = { .drv = 2, .cs = 7, .swr = 5, .swg = 4, .swb = 6 }, .scan = 5 }, \
67 { .id = 7, .x = 5.625, .y = 0, .adr = { .drv = 2, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 6 }, \
68 { .id = 8, .x = 6.375, .y = 0, .adr = { .drv = 1, .cs = 1, .swr = 5, .swg = 4, .swb = 6 }, .scan = 7 }, \
69 { .id = 9, .x = 7.125, .y = 0, .adr = { .drv = 1, .cs = 2, .swr = 5, .swg = 4, .swb = 6 }, .scan = 90 }, \
70 { .id = 10, .x = 8.25, .y = 0, .adr = { .drv = 1, .cs = 3, .swr = 5, .swg = 4, .swb = 6 }, .scan = 91 }, \
71 { .id = 11, .x = 9, .y = 0, .adr = { .drv = 1, .cs = 4, .swr = 5, .swg = 4, .swb = 6 }, .scan = 92 }, \
72 { .id = 12, .x = 9.75, .y = 0, .adr = { .drv = 1, .cs = 5, .swr = 5, .swg = 4, .swb = 6 }, .scan = 93 }, \
73 { .id = 13, .x = 10.5, .y = 0, .adr = { .drv = 1, .cs = 6, .swr = 5, .swg = 4, .swb = 6 }, .scan = 94 }, \
74 { .id = 14, .x = 11.625, .y = 0, .adr = { .drv = 1, .cs = 7, .swr = 5, .swg = 4, .swb = 6 }, .scan = 95 }, \
75 { .id = 15, .x = 12.375, .y = 0, .adr = { .drv = 1, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 96 }, \
76 { .id = 16, .x = 13.125, .y = 0, .adr = { .drv = 1, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 97 }, \
77 { .id = 17, .x = 0, .y = -1.125, .adr = { .drv = 2, .cs = 1, .swr = 8, .swg = 7, .swb = 9 }, .scan = 15 }, \
78 { .id = 18, .x = 0.75, .y = -1.125, .adr = { .drv = 2, .cs = 2, .swr = 8, .swg = 7, .swb = 9 }, .scan = 16 }, \
79 { .id = 19, .x = 1.5, .y = -1.125, .adr = { .drv = 2, .cs = 3, .swr = 8, .swg = 7, .swb = 9 }, .scan = 17 }, \
80 { .id = 20, .x = 2.25, .y = -1.125, .adr = { .drv = 2, .cs = 4, .swr = 8, .swg = 7, .swb = 9 }, .scan = 18 }, \
81 { .id = 21, .x = 3, .y = -1.125, .adr = { .drv = 2, .cs = 5, .swr = 8, .swg = 7, .swb = 9 }, .scan = 19 }, \
82 { .id = 22, .x = 3.75, .y = -1.125, .adr = { .drv = 2, .cs = 6, .swr = 8, .swg = 7, .swb = 9 }, .scan = 20 }, \
83 { .id = 23, .x = 4.5, .y = -1.125, .adr = { .drv = 2, .cs = 7, .swr = 8, .swg = 7, .swb = 9 }, .scan = 21 }, \
84 { .id = 24, .x = 5.25, .y = -1.125, .adr = { .drv = 2, .cs = 8, .swr = 8, .swg = 7, .swb = 9 }, .scan = 22 }, \
85 { .id = 25, .x = 6, .y = -1.125, .adr = { .drv = 1, .cs = 1, .swr = 8, .swg = 7, .swb = 9 }, .scan = 105 }, \
86 { .id = 26, .x = 6.75, .y = -1.125, .adr = { .drv = 1, .cs = 2, .swr = 8, .swg = 7, .swb = 9 }, .scan = 106 }, \
87 { .id = 27, .x = 7.5, .y = -1.125, .adr = { .drv = 1, .cs = 3, .swr = 8, .swg = 7, .swb = 9 }, .scan = 107 }, \
88 { .id = 28, .x = 8.25, .y = -1.125, .adr = { .drv = 1, .cs = 4, .swr = 8, .swg = 7, .swb = 9 }, .scan = 108 }, \
89 { .id = 29, .x = 9, .y = -1.125, .adr = { .drv = 1, .cs = 5, .swr = 8, .swg = 7, .swb = 9 }, .scan = 109 }, \
90 { .id = 30, .x = 10.125, .y = -1.125, .adr = { .drv = 1, .cs = 6, .swr = 8, .swg = 7, .swb = 9 }, .scan = 110 }, \
91 { .id = 31, .x = 11.625, .y = -1.125, .adr = { .drv = 1, .cs = 7, .swr = 8, .swg = 7, .swb = 9 }, .scan = 111 }, \
92 { .id = 32, .x = 12.375, .y = -1.125, .adr = { .drv = 1, .cs = 8, .swr = 8, .swg = 7, .swb = 9 }, .scan = 112 }, \
93 { .id = 33, .x = 13.125, .y = -1.125, .adr = { .drv = 1, .cs = 9, .swr = 8, .swg = 7, .swb = 9 }, .scan = 142 }, \
94 { .id = 34, .x = 0.188, .y = -1.875, .adr = { .drv = 2, .cs = 1, .swr = 11, .swg = 10, .swb = 12 }, .scan = 30 }, \
95 { .id = 35, .x = 1.125, .y = -1.875, .adr = { .drv = 2, .cs = 2, .swr = 11, .swg = 10, .swb = 12 }, .scan = 31 }, \
96 { .id = 36, .x = 1.875, .y = -1.875, .adr = { .drv = 2, .cs = 3, .swr = 11, .swg = 10, .swb = 12 }, .scan = 32 }, \
97 { .id = 37, .x = 2.625, .y = -1.875, .adr = { .drv = 2, .cs = 4, .swr = 11, .swg = 10, .swb = 12 }, .scan = 33 }, \
98 { .id = 38, .x = 3.375, .y = -1.875, .adr = { .drv = 2, .cs = 5, .swr = 11, .swg = 10, .swb = 12 }, .scan = 34 }, \
99 { .id = 39, .x = 4.125, .y = -1.875, .adr = { .drv = 2, .cs = 6, .swr = 11, .swg = 10, .swb = 12 }, .scan = 35 }, \
100 { .id = 40, .x = 4.875, .y = -1.875, .adr = { .drv = 2, .cs = 7, .swr = 11, .swg = 10, .swb = 12 }, .scan = 36 }, \
101 { .id = 41, .x = 5.625, .y = -1.875, .adr = { .drv = 2, .cs = 8, .swr = 11, .swg = 10, .swb = 12 }, .scan = 37 }, \
102 { .id = 42, .x = 6.375, .y = -1.875, .adr = { .drv = 1, .cs = 1, .swr = 11, .swg = 10, .swb = 12 }, .scan = 120 }, \
103 { .id = 43, .x = 7.125, .y = -1.875, .adr = { .drv = 1, .cs = 2, .swr = 11, .swg = 10, .swb = 12 }, .scan = 121 }, \
104 { .id = 44, .x = 7.875, .y = -1.875, .adr = { .drv = 1, .cs = 3, .swr = 11, .swg = 10, .swb = 12 }, .scan = 122 }, \
105 { .id = 45, .x = 8.625, .y = -1.875, .adr = { .drv = 1, .cs = 4, .swr = 11, .swg = 10, .swb = 12 }, .scan = 123 }, \
106 { .id = 46, .x = 9.375, .y = -1.875, .adr = { .drv = 1, .cs = 5, .swr = 11, .swg = 10, .swb = 12 }, .scan = 124 }, \
107 { .id = 47, .x = 10.312, .y = -1.875, .adr = { .drv = 1, .cs = 6, .swr = 11, .swg = 10, .swb = 12 }, .scan = 125 }, \
108 { .id = 48, .x = 11.625, .y = -1.875, .adr = { .drv = 1, .cs = 7, .swr = 11, .swg = 10, .swb = 12 }, .scan = 126 }, \
109 { .id = 49, .x = 12.375, .y = -1.875, .adr = { .drv = 1, .cs = 8, .swr = 11, .swg = 10, .swb = 12 }, .scan = 127 }, \
110 { .id = 50, .x = 13.125, .y = -1.875, .adr = { .drv = 1, .cs = 9, .swr = 11, .swg = 10, .swb = 12 }, .scan = 141 }, \
111 { .id = 51, .x = 0.281, .y = -2.625, .adr = { .drv = 2, .cs = 1, .swr = 5, .swg = 4, .swb = 6 }, .scan = 45 }, \
112 { .id = 52, .x = 1.313, .y = -2.625, .adr = { .drv = 2, .cs = 2, .swr = 5, .swg = 4, .swb = 6 }, .scan = 46 }, \
113 { .id = 53, .x = 2.063, .y = -2.625, .adr = { .drv = 2, .cs = 13, .swr = 11, .swg = 10, .swb = 12 }, .scan = 47 }, \
114 { .id = 54, .x = 2.812, .y = -2.625, .adr = { .drv = 2, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 48 }, \
115 { .id = 55, .x = 3.562, .y = -2.625, .adr = { .drv = 2, .cs = 11, .swr = 11, .swg = 10, .swb = 12 }, .scan = 49 }, \
116 { .id = 56, .x = 4.312, .y = -2.625, .adr = { .drv = 2, .cs = 6, .swr = 5, .swg = 4, .swb = 6 }, .scan = 50 }, \
117 { .id = 57, .x = 5.062, .y = -2.625, .adr = { .drv = 2, .cs = 10, .swr = 11, .swg = 10, .swb = 12 }, .scan = 51 }, \
118 { .id = 58, .x = 5.812, .y = -2.625, .adr = { .drv = 2, .cs = 9, .swr = 11, .swg = 10, .swb = 12 }, .scan = 52 }, \
119 { .id = 59, .x = 6.562, .y = -2.625, .adr = { .drv = 1, .cs = 16, .swr = 11, .swg = 10, .swb = 12 }, .scan = 135 }, \
120 { .id = 60, .x = 7.312, .y = -2.625, .adr = { .drv = 1, .cs = 15, .swr = 11, .swg = 10, .swb = 12 }, .scan = 136 }, \
121 { .id = 61, .x = 8.062, .y = -2.625, .adr = { .drv = 1, .cs = 14, .swr = 11, .swg = 10, .swb = 12 }, .scan = 137 }, \
122 { .id = 62, .x = 8.812, .y = -2.625, .adr = { .drv = 1, .cs = 13, .swr = 11, .swg = 10, .swb = 12 }, .scan = 138 }, \
123 { .id = 63, .x = 10.031, .y = -2.625, .adr = { .drv = 1, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 139 }, \
124 { .id = 64, .x = 0.469, .y = -3.375, .adr = { .drv = 2, .cs = 14, .swr = 5, .swg = 4, .swb = 6 }, .scan = 60 }, \
125 { .id = 65, .x = 1.688, .y = -3.375, .adr = { .drv = 2, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 61 }, \
126 { .id = 66, .x = 2.438, .y = -3.375, .adr = { .drv = 2, .cs = 12, .swr = 8, .swg = 7, .swb = 9 }, .scan = 62 }, \
127 { .id = 67, .x = 3.188, .y = -3.375, .adr = { .drv = 2, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 63 }, \
128 { .id = 68, .x = 3.938, .y = -3.375, .adr = { .drv = 2, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 64 }, \
129 { .id = 69, .x = 4.688, .y = -3.375, .adr = { .drv = 2, .cs = 10, .swr = 5, .swg = 4, .swb = 6 }, .scan = 65 }, \
130 { .id = 70, .x = 5.438, .y = -3.375, .adr = { .drv = 2, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 66 }, \
131 { .id = 71, .x = 6.188, .y = -3.375, .adr = { .drv = 2, .cs = 9, .swr = 8, .swg = 7, .swb = 9 }, .scan = 67 }, \
132 { .id = 72, .x = 6.938, .y = -3.375, .adr = { .drv = 1, .cs = 16, .swr = 8, .swg = 7, .swb = 9 }, .scan = 150 }, \
133 { .id = 73, .x = 7.688, .y = -3.375, .adr = { .drv = 1, .cs = 15, .swr = 8, .swg = 7, .swb = 9 }, .scan = 151 }, \
134 { .id = 74, .x = 8.438, .y = -3.375, .adr = { .drv = 1, .cs = 14, .swr = 8, .swg = 7, .swb = 9 }, .scan = 152 }, \
135 { .id = 75, .x = 9.844, .y = -3.375, .adr = { .drv = 1, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 153 }, \
136 { .id = 76, .x = 12.375, .y = -3.375, .adr = { .drv = 1, .cs = 11, .swr = 8, .swg = 7, .swb = 9 }, .scan = 140 }, \
137 { .id = 77, .x = 0.094, .y = -4.125, .adr = { .drv = 2, .cs = 14, .swr = 11, .swg = 10, .swb = 12 }, .scan = 75 }, \
138 { .id = 78, .x = 1.031, .y = -4.125, .adr = { .drv = 2, .cs = 14, .swr = 8, .swg = 7, .swb = 9 }, .scan = 76 }, \
139 { .id = 79, .x = 1.969, .y = -4.125, .adr = { .drv = 2, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 77 }, \
140 { .id = 80, .x = 4.781, .y = -4.125, .adr = { .drv = 2, .cs = 10, .swr = 8, .swg = 7, .swb = 9 }, .scan = 78 }, \
141 { .id = 81, .x = 7.594, .y = -4.125, .adr = { .drv = 1, .cs = 16, .swr = 5, .swg = 4, .swb = 6 }, .scan = 79 }, \
142 { .id = 82, .x = 8.531, .y = -4.125, .adr = { .drv = 1, .cs = 15, .swr = 5, .swg = 4, .swb = 6 }, .scan = 80 }, \
143 { .id = 83, .x = 9.469, .y = -4.125, .adr = { .drv = 1, .cs = 14, .swr = 5, .swg = 4, .swb = 6 }, .scan = 81 }, \
144 { .id = 84, .x = 10.406, .y = -4.125, .adr = { .drv = 1, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 82 }, \
145 { .id = 85, .x = 11.625, .y = -4.125, .adr = { .drv = 1, .cs = 12, .swr = 8, .swg = 7, .swb = 9 }, .scan = 154 }, \
146 { .id = 86, .x = 12.375, .y = -4.125, .adr = { .drv = 1, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 155 }, \
147 { .id = 87, .x = 13.125, .y = -4.125, .adr = { .drv = 1, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 156 }, \
148 { .id = 88, .x = 13.433, .y = -4.43, .adr = { .drv = 1, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
149 { .id = 89, .x = 12.285, .y = -4.535, .adr = { .drv = 1, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
150 { .id = 90, .x = 11.14, .y = -4.535, .adr = { .drv = 1, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
151 { .id = 91, .x = 9.995, .y = -4.535, .adr = { .drv = 1, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
152 { .id = 92, .x = 8.85, .y = -4.535, .adr = { .drv = 1, .cs = 15, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
153 { .id = 93, .x = 7.705, .y = -4.535, .adr = { .drv = 1, .cs = 16, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
154 { .id = 94, .x = 6.56, .y = -4.535, .adr = { .drv = 2, .cs = 9, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
155 { .id = 95, .x = 5.415, .y = -4.535, .adr = { .drv = 2, .cs = 10, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
156 { .id = 96, .x = 4.27, .y = -4.535, .adr = { .drv = 2, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
157 { .id = 97, .x = 3.125, .y = -4.535, .adr = { .drv = 2, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
158 { .id = 98, .x = 1.98, .y = -4.535, .adr = { .drv = 2, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
159 { .id = 99, .x = 0.835, .y = -4.535, .adr = { .drv = 2, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
160 { .id = 100, .x = -0.307, .y = -4.43, .adr = { .drv = 2, .cs = 15, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
161 { .id = 101, .x = -0.41, .y = -3.245, .adr = { .drv = 2, .cs = 15, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
162 { .id = 102, .x = -0.41, .y = -2.06, .adr = { .drv = 2, .cs = 15, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
163 { .id = 103, .x = -0.41, .y = -0.875, .adr = { .drv = 2, .cs = 15, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
164 { .id = 104, .x = -0.308, .y = 0.31, .adr = { .drv = 2, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
165 { .id = 105, .x = 0.835, .y = 0.415, .adr = { .drv = 2, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
166 { .id = 106, .x = 1.98, .y = 0.415, .adr = { .drv = 2, .cs = 4, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
167 { .id = 107, .x = 3.125, .y = 0.415, .adr = { .drv = 2, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
168 { .id = 108, .x = 4.27, .y = 0.415, .adr = { .drv = 2, .cs = 7, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
169 { .id = 109, .x = 5.415, .y = 0.415, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
170 { .id = 110, .x = 6.56, .y = 0.415, .adr = { .drv = 1, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
171 { .id = 111, .x = 7.705, .y = 0.415, .adr = { .drv = 1, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
172 { .id = 112, .x = 8.85, .y = 0.415, .adr = { .drv = 1, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
173 { .id = 113, .x = 9.995, .y = 0.415, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
174 { .id = 114, .x = 11.14, .y = 0.415, .adr = { .drv = 1, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
175 { .id = 115, .x = 12.285, .y = 0.415, .adr = { .drv = 1, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
176 { .id = 116, .x = 13.432, .y = 0.31, .adr = { .drv = 1, .cs = 10, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
177 { .id = 117, .x = 13.535, .y = -0.875, .adr = { .drv = 1, .cs = 10, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
178 { .id = 118, .x = 13.535, .y = -2.06, .adr = { .drv = 1, .cs = 10, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
179 { .id = 119, .x = 13.535, .y = -3.245, .adr = { .drv = 1, .cs = 10, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
180};
181
182#define USB_LED_INDICATOR_ENABLE //Comment out to disable indicator functionality
183#ifdef USB_LED_INDICATOR_ENABLE //Scan codes refer to actual key matrix codes, not KC_* (255 to disable)
184 #define USB_LED_NUM_LOCK_SCANCODE 255
185 #define USB_LED_CAPS_LOCK_SCANCODE 45
186 #define USB_LED_SCROLL_LOCK_SCANCODE 96
187 #define USB_LED_COMPOSE_SCANCODE 255
188 #define USB_LED_KANA_SCANCODE 255
189#endif //USB_LED_INDICATOR_ENABLE
190
191#endif //_config_led_h_
diff --git a/keyboards/massdrop/ctrl/ctrl.h b/keyboards/massdrop/ctrl/ctrl.h
new file mode 100644
index 000000000..dc7c7eabe
--- /dev/null
+++ b/keyboards/massdrop/ctrl/ctrl.h
@@ -0,0 +1,32 @@
1#pragma once
2
3#include "quantum.h"
4#include "config_led.h"
5#include "matrix.h"
6
7#include "i2c_master.h"
8#include "led_matrix.h" //For led keycodes
9#include "usb/udi_cdc.h"
10#include "usb/usb2422.h"
11
12#define LAYOUT( \
13 K01, K02, K03, K04, K05, K06, K07, K08, K09, K10, K11, K12, K13, K14, K15, \
14 K16, K17, K18, K19, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K30, \
15 K31, K32, K33, K34, K35, K36, K37, K38, K39, K40, K41, K42, K43, K44, K45, \
16 K46, K47, K48, K49, K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K60, \
17 K61, K62, K63, K64, K65, K66, K67, K68, K69, K70, K71, K72, K73, K74, K75, \
18 K76, K77, K78, K79, K80, K81, K82, K83, K84, K85, K86, K87 \
19 \
20) { \
21 { K01, K02, K03, K04, K05, K06, K07, K08 }, \
22 { K17, K18, K19, K20, K21, K22, K23, K24 }, \
23 { K34, K35, K36, K37, K38, K39, K40, K41 }, \
24 { K51, K52, K53, K54, K55, K56, K57, K58 }, \
25 { K64, K65, K66, K67, K68, K69, K70, K71 }, \
26 { K77, K78, K79, K80, K81, K82, K83, K84 }, \
27 { K09, K10, K11, K12, K13, K14, K15, K16 }, \
28 { K25, K26, K27, K28, K29, K30, K31, K32 }, \
29 { K42, K43, K44, K45, K46, K47, K48, K49 }, \
30 { K59, K60, K61, K62, K63, K76, K50, K33 }, \
31 { K72, K73, K74, K75, K85, K86, K87, }, \
32}
diff --git a/keyboards/massdrop/ctrl/keymaps/default/keymap.c b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
new file mode 100644
index 000000000..8e84d4fee
--- /dev/null
+++ b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
@@ -0,0 +1,203 @@
1#include QMK_KEYBOARD_H
2
3enum alt67_keycodes {
4 L_BRI = SAFE_RANGE, //LED Brightness Increase
5 L_BRD, //LED Brightness Decrease
6 L_PTN, //LED Pattern Select Next
7 L_PTP, //LED Pattern Select Previous
8 L_PSI, //LED Pattern Speed Increase
9 L_PSD, //LED Pattern Speed Decrease
10 L_T_MD, //LED Toggle Mode
11 L_T_ONF, //LED Toggle On / Off
12 L_ON, //LED On
13 L_OFF, //LED Off
14 L_T_BR, //LED Toggle Breath Effect
15 L_T_PTD, //LED Toggle Scrolling Pattern Direction
16 U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active
17 U_T_AGCR, //USB Toggle Automatic GCR control
18 DBG_TOG, //DEBUG Toggle On / Off
19 DBG_MTRX, //DEBUG Toggle Matrix Prints
20 DBG_KBD, //DEBUG Toggle Keyboard Prints
21 DBG_MOU, //DEBUG Toggle Mouse Prints
22};
23
24#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
25
26keymap_config_t keymap_config;
27
28const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
29 [0] = LAYOUT(
30 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, KC_PAUS, \
31 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_INS, KC_HOME, KC_PGUP, \
32 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_DEL, KC_END, KC_PGDN, \
33 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, \
34 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_UP, \
35 KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
36 ),
37 [1] = LAYOUT(
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, \
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MSTP, KC_VOLU, \
40 L_T_BR, L_PSD, L_BRI, L_PSI, KC_TRNS, KC_TRNS, KC_TRNS, U_T_AUTO,U_T_AGCR,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_VOLD, \
41 L_T_PTD, L_PTP, L_BRD, L_PTN, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
42 KC_TRNS, L_T_MD, L_T_ONF, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
43 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
44 ),
45 /*
46 [X] = LAYOUT(
47 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
48 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
49 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, TG_NKRO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
52 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
53 ),
54 */
55};
56
57const uint16_t PROGMEM fn_actions[] = {
58
59};
60
61// Runs just one time when the keyboard initializes.
62void matrix_init_user(void) {
63};
64
65// Runs constantly in the background, in a loop.
66void matrix_scan_user(void) {
67};
68
69#define MODS_SHIFT (keyboard_report->mods & MOD_BIT(KC_LSHIFT) || keyboard_report->mods & MOD_BIT(KC_RSHIFT))
70#define MODS_CTRL (keyboard_report->mods & MOD_BIT(KC_LCTL) || keyboard_report->mods & MOD_BIT(KC_RCTRL))
71#define MODS_ALT (keyboard_report->mods & MOD_BIT(KC_LALT) || keyboard_report->mods & MOD_BIT(KC_RALT))
72
73bool process_record_user(uint16_t keycode, keyrecord_t *record) {
74 switch (keycode) {
75 case L_BRI:
76 if (record->event.pressed) {
77 if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX;
78 else gcr_desired += LED_GCR_STEP;
79 if (led_animation_breathing) gcr_breathe = gcr_desired;
80 }
81 return false;
82 case L_BRD:
83 if (record->event.pressed) {
84 if (LED_GCR_STEP > gcr_desired) gcr_desired = 0;
85 else gcr_desired -= LED_GCR_STEP;
86 if (led_animation_breathing) gcr_breathe = gcr_desired;
87 }
88 return false;
89 case L_PTN:
90 if (record->event.pressed) {
91 if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
92 else led_animation_id++;
93 }
94 return false;
95 case L_PTP:
96 if (record->event.pressed) {
97 if (led_animation_id == 0) led_animation_id = led_setups_count - 1;
98 else led_animation_id--;
99 }
100 return false;
101 case L_PSI:
102 if (record->event.pressed) {
103 led_animation_speed += ANIMATION_SPEED_STEP;
104 }
105 return false;
106 case L_PSD:
107 if (record->event.pressed) {
108 led_animation_speed -= ANIMATION_SPEED_STEP;
109 if (led_animation_speed < 0) led_animation_speed = 0;
110 }
111 return false;
112 case L_T_MD:
113 if (record->event.pressed) {
114 led_lighting_mode++;
115 if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL;
116 }
117 return false;
118 case L_T_ONF:
119 if (record->event.pressed) {
120 led_enabled = !led_enabled;
121 I2C3733_Control_Set(led_enabled);
122 }
123 return false;
124 case L_ON:
125 if (record->event.pressed) {
126 led_enabled = 1;
127 I2C3733_Control_Set(led_enabled);
128 }
129 return false;
130 case L_OFF:
131 if (record->event.pressed) {
132 led_enabled = 0;
133 I2C3733_Control_Set(led_enabled);
134 }
135 return false;
136 case L_T_BR:
137 if (record->event.pressed) {
138 led_animation_breathing = !led_animation_breathing;
139 if (led_animation_breathing)
140 {
141 gcr_breathe = gcr_desired;
142 led_animation_breathe_cur = BREATHE_MIN_STEP;
143 breathe_dir = 1;
144 }
145 }
146 return false;
147 case L_T_PTD:
148 if (record->event.pressed) {
149 led_animation_direction = !led_animation_direction;
150 }
151 return false;
152 case U_T_AUTO:
153 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
154 usb_extra_manual = !usb_extra_manual;
155 CDC_print("USB extra port manual mode ");
156 CDC_print(usb_extra_manual ? "enabled" : "disabled");
157 CDC_print("\r\n");
158 }
159 return false;
160 case U_T_AGCR:
161 if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
162 usb_gcr_auto = !usb_gcr_auto;
163 CDC_print("USB GCR auto mode ");
164 CDC_print(usb_gcr_auto ? "enabled" : "disabled");
165 CDC_print("\r\n");
166 }
167 return false;
168 case DBG_TOG:
169 if (record->event.pressed) {
170 debug_enable = !debug_enable;
171 CDC_print("Debug mode ");
172 CDC_print(debug_enable ? "enabled" : "disabled");
173 CDC_print("\r\n");
174 }
175 return false;
176 case DBG_MTRX:
177 if (record->event.pressed) {
178 debug_matrix = !debug_matrix;
179 CDC_print("Debug matrix ");
180 CDC_print(debug_matrix ? "enabled" : "disabled");
181 CDC_print("\r\n");
182 }
183 return false;
184 case DBG_KBD:
185 if (record->event.pressed) {
186 debug_keyboard = !debug_keyboard;
187 CDC_print("Debug keyboard ");
188 CDC_print(debug_keyboard ? "enabled" : "disabled");
189 CDC_print("\r\n");
190 }
191 return false;
192 case DBG_MOU:
193 if (record->event.pressed) {
194 debug_mouse = !debug_mouse;
195 CDC_print("Debug mouse ");
196 CDC_print(debug_mouse ? "enabled" : "disabled");
197 CDC_print("\r\n");
198 }
199 return false;
200 default:
201 return true; //Process all other keycodes normally
202 }
203} \ No newline at end of file
diff --git a/keyboards/massdrop/ctrl/led_programs.c b/keyboards/massdrop/ctrl/led_programs.c
new file mode 100644
index 000000000..ca2701645
--- /dev/null
+++ b/keyboards/massdrop/ctrl/led_programs.c
@@ -0,0 +1,120 @@
1/*
2Copyright 2018 Massdrop Inc.
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#include "ctrl.h"
19#include "led_matrix.h"
20
21//Teal <-> Salmon
22led_setup_t leds_teal_salmon[] = {
23 { .hs = 0, .he = 33, .rs = 24, .re = 24, .gs = 215, .ge = 215, .bs = 204, .be = 204, .ef = EF_NONE },
24 { .hs = 33, .he = 66, .rs = 24, .re = 255, .gs = 215, .ge = 114, .bs = 204, .be = 118, .ef = EF_NONE },
25 { .hs = 66, .he = 100, .rs = 255, .re = 255, .gs = 114, .ge = 114, .bs = 118, .be = 118, .ef = EF_NONE },
26 { .end = 1 },
27};
28
29//Yellow
30led_setup_t leds_yellow[] = {
31 { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_NONE },
32 { .end = 1 },
33};
34
35//Off
36led_setup_t leds_off[] = {
37 { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_NONE },
38 { .end = 1 },
39};
40
41//Red
42led_setup_t leds_red[] = {
43 { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_NONE },
44 { .end = 1 },
45};
46
47//Green
48led_setup_t leds_green[] = {
49 { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_NONE },
50 { .end = 1 },
51};
52
53//Blue
54led_setup_t leds_blue[] = {
55 { .hs = 0, .he = 100, .rs = 0, .re = 0, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_NONE },
56 { .end = 1 },
57};
58
59//White
60led_setup_t leds_white[] = {
61 { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 255, .be = 255, .ef = EF_NONE },
62 { .end = 1 },
63};
64
65//White with moving red stripe
66led_setup_t leds_white_with_red_stripe[] = {
67 { .hs = 0, .he = 100, .rs = 255, .re = 255, .gs = 255, .ge = 255, .bs = 255, .be = 255, .ef = EF_NONE },
68 { .hs = 0, .he = 15, .rs = 0, .re = 0, .gs = 0, .ge = 255, .bs = 0, .be = 255, .ef = EF_SCR_R | EF_SUBTRACT },
69 { .hs = 15, .he = 30, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 0, .ef = EF_SCR_R | EF_SUBTRACT },
70 { .end = 1 },
71};
72
73//Black with moving red stripe
74led_setup_t leds_black_with_red_stripe[] = {
75 { .hs = 0, .he = 15, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_SCR_R },
76 { .hs = 15, .he = 30, .rs = 255, .re = 0, .gs = 0, .ge = 0, .bs = 0, .be = 0, .ef = EF_SCR_R },
77 { .end = 1 },
78};
79
80//Rainbow no scrolling
81led_setup_t leds_rainbow_ns[] = {
82 { .hs = 0, .he = 16.67, .rs = 255, .re = 255, .gs = 0, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER },
83 { .hs = 16.67, .he = 33.33, .rs = 255, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER },
84 { .hs = 33.33, .he = 50, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 255, .ef = EF_OVER },
85 { .hs = 50, .he = 66.67, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER },
86 { .hs = 66.67, .he = 83.33, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER },
87 { .hs = 83.33, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 0, .ef = EF_OVER },
88 { .end = 1 },
89};
90
91//Rainbow scrolling
92led_setup_t leds_rainbow_s[] = {
93 { .hs = 0, .he = 16.67, .rs = 255, .re = 255, .gs = 0, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER | EF_SCR_R },
94 { .hs = 16.67, .he = 33.33, .rs = 255, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 0, .ef = EF_OVER | EF_SCR_R },
95 { .hs = 33.33, .he = 50, .rs = 0, .re = 0, .gs = 255, .ge = 255, .bs = 0, .be = 255, .ef = EF_OVER | EF_SCR_R },
96 { .hs = 50, .he = 66.67, .rs = 0, .re = 0, .gs = 255, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER | EF_SCR_R },
97 { .hs = 66.67, .he = 83.33, .rs = 0, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 255, .ef = EF_OVER | EF_SCR_R },
98 { .hs = 83.33, .he = 100, .rs = 255, .re = 255, .gs = 0, .ge = 0, .bs = 255, .be = 0, .ef = EF_OVER | EF_SCR_R },
99 { .end = 1 },
100};
101
102//Add new LED animations here using one from above as example
103//The last entry must be { .end = 1 }
104//Add the new animation name to the list below following its format
105
106void *led_setups[] = {
107 leds_rainbow_s,
108 leds_rainbow_ns,
109 leds_teal_salmon,
110 leds_yellow,
111 leds_red,
112 leds_green,
113 leds_blue,
114 leds_white,
115 leds_white_with_red_stripe,
116 leds_black_with_red_stripe,
117 leds_off
118};
119
120const uint8_t led_setups_count = sizeof(led_setups) / sizeof(led_setups[0]);
diff --git a/keyboards/massdrop/ctrl/matrix.c b/keyboards/massdrop/ctrl/matrix.c
new file mode 100644
index 000000000..6f306962e
--- /dev/null
+++ b/keyboards/massdrop/ctrl/matrix.c
@@ -0,0 +1,182 @@
1/*
2Copyright 2018 Massdrop Inc.
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#include "ctrl.h"
19
20#include "d51_util.h"
21#include "debug.h"
22#include "clks.h"
23#include <string.h>
24
25matrix_row_t mlatest[MATRIX_ROWS];
26matrix_row_t mlast[MATRIX_ROWS];
27matrix_row_t mdebounced[MATRIX_ROWS];
28
29uint8_t row_ports[] = { MATRIX_ROW_PORTS };
30uint8_t row_pins[] = { MATRIX_ROW_PINS };
31uint8_t col_ports[] = { MATRIX_COL_PORTS };
32uint8_t col_pins[] = { MATRIX_COL_PINS };
33uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate
34
35__attribute__ ((weak))
36void matrix_init_kb(void) {
37 matrix_init_user();
38}
39
40__attribute__ ((weak))
41void matrix_scan_kb(void) {
42 matrix_scan_user();
43}
44
45__attribute__ ((weak))
46void matrix_init_user(void) {
47}
48
49__attribute__ ((weak))
50void matrix_scan_user(void) {
51}
52
53void matrix_init(void)
54{
55 memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t));
56 memset(mlast, 0, MATRIX_ROWS * sizeof(matrix_row_t));
57 memset(mdebounced, 0, MATRIX_ROWS * sizeof(matrix_row_t));
58
59 row_masks[PA] = 0;
60 row_masks[PB] = 0;
61
62 uint8_t row;
63 for (row = 0; row < MATRIX_ROWS; row++)
64 {
65 PORT->Group[row_ports[row]].DIRCLR.reg = 1 << row_pins[row]; //Input
66 PORT->Group[row_ports[row]].OUTCLR.reg = 1 << row_pins[row]; //Low
67 PORT->Group[row_ports[row]].PINCFG[row_pins[row]].bit.INEN = 1; //Input Enable,
68 PORT->Group[row_ports[row]].PINCFG[row_pins[row]].bit.PULLEN = 1; //Pull Enable
69 row_masks[row_ports[row]] |= 1 << row_pins[row]; //Add pin to proper row mask
70 }
71
72 uint8_t col;
73 for (col = 0; col < MATRIX_COLS; col++)
74 {
75 PORT->Group[col_ports[col]].DIRSET.reg = 1 << col_pins[col]; //Output
76 PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Low
77 }
78
79 matrix_init_quantum();
80}
81
82#define MATRIX_SCAN_DELAY 10 //Delay after setting a col to output (in us)
83
84uint64_t mdebouncing = 0;
85uint8_t matrix_scan(void)
86{
87 uint8_t mchanged;
88 uint8_t row;
89 uint8_t col;
90 uint32_t scans[2]; //PA PB
91
92 if (CLK_get_ms() < mdebouncing) return 1; //mdebouncing == 0 when no debouncing active
93
94 //m15_off; //Profiling scans
95
96 memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t)); //Zero the result buffer
97
98 for (col = 0; col < MATRIX_COLS; col++)
99 {
100 PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
101
102 CLK_delay_us(MATRIX_SCAN_DELAY); //Delay for output
103
104 scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
105 scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data
106
107 PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Clear col output
108
109 for (row = 0; row < MATRIX_ROWS; row++)
110 {
111 //Move scan bits from scans array into proper row bit locations
112 if (scans[row_ports[row]] & (1 << row_pins[row]))
113 mlatest[row] |= 1 << col;
114 }
115 }
116
117 mchanged = 0; //Default to no matrix change since last
118
119 for (row = 0; row < MATRIX_ROWS; row++)
120 {
121 if (mlast[row] != mlatest[row])
122 mchanged = 1;
123 mlast[row] = mlatest[row];
124 }
125
126 if (!mchanged)
127 {
128 for (row = 0; row < MATRIX_ROWS; row++)
129 mdebounced[row] = mlatest[row];
130 mdebouncing = 0;
131 }
132 else
133 {
134 //Begin or extend debounce on change
135 mdebouncing = CLK_get_ms() + DEBOUNCING_DELAY;
136 }
137
138 //m15_on; //Profiling scans
139
140 matrix_scan_quantum();
141
142 return 1;
143}
144
145matrix_row_t matrix_get_row(uint8_t row)
146{
147 return mdebounced[row];
148}
149
150void matrix_print(void)
151{
152 char buf[(MATRIX_COLS+8)*(MATRIX_ROWS+1)] = "R C";
153 char *pbuf = buf+3;
154 uint32_t cols;
155 uint32_t rows;
156 matrix_row_t row;
157
158 for (cols = 1; cols <= MATRIX_COLS; cols++)
159 {
160 *pbuf = (cols%10)+48;
161 pbuf++;
162 }
163 *pbuf = '\r'; pbuf++;
164 *pbuf = '\n'; pbuf++;
165
166 for (rows = 1; rows <= MATRIX_ROWS; rows++)
167 {
168 row = matrix_get_row(rows-1);
169 if (rows < 10) { *pbuf = rows+48; pbuf++; *pbuf = ' '; pbuf++; *pbuf = ' '; pbuf++; }
170 else { *pbuf = (rows/10)+48; pbuf++; *pbuf = (rows%10)+48; pbuf++; *pbuf = ' '; pbuf++; }
171 for (cols = 0; cols < MATRIX_COLS; cols++)
172 {
173 if (row & 1 << cols) *pbuf = 'X';
174 else *pbuf = '.';
175 pbuf++;
176 }
177 *pbuf = '\r'; pbuf++;
178 *pbuf = '\n'; pbuf++;
179 }
180 *pbuf = 0;
181 dprint(buf);
182}
diff --git a/keyboards/massdrop/ctrl/matrix.h b/keyboards/massdrop/ctrl/matrix.h
new file mode 100644
index 000000000..3eab6dece
--- /dev/null
+++ b/keyboards/massdrop/ctrl/matrix.h
@@ -0,0 +1,77 @@
1/*
2Copyright 2011 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#ifndef MATRIX_H
18#define MATRIX_H
19
20#include <stdint.h>
21#include <stdbool.h>
22#include "keyboard.h"
23
24#if (MATRIX_COLS <= 8)
25typedef uint8_t matrix_row_t;
26#elif (MATRIX_COLS <= 16)
27typedef uint16_t matrix_row_t;
28#elif (MATRIX_COLS <= 32)
29typedef uint32_t matrix_row_t;
30#else
31#error "MATRIX_COLS: invalid value"
32#endif
33
34#define MATRIX_IS_ON(row, col) (matrix_get_row(row) && (1<<col))
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* number of matrix rows */
41uint8_t matrix_rows(void);
42/* number of matrix columns */
43uint8_t matrix_cols(void);
44/* should be called at early stage of startup before matrix_init.(optional) */
45void matrix_setup(void);
46/* intialize matrix for scaning. */
47void matrix_init(void);
48/* scan all key states on matrix */
49uint8_t matrix_scan(void);
50/* whether modified from previous scan. used after matrix_scan. */
51bool matrix_is_modified(void) __attribute__ ((deprecated));
52/* whether a switch is on */
53bool matrix_is_on(uint8_t row, uint8_t col);
54/* matrix state on row */
55matrix_row_t matrix_get_row(uint8_t row);
56/* print matrix for debug */
57void matrix_print(void);
58
59/* power control */
60void matrix_power_up(void);
61void matrix_power_down(void);
62
63/* executes code for Quantum */
64void matrix_init_quantum(void);
65void matrix_scan_quantum(void);
66
67void matrix_init_kb(void);
68void matrix_scan_kb(void);
69
70void matrix_init_user(void);
71void matrix_scan_user(void);
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif
diff --git a/keyboards/massdrop/ctrl/readme.md b/keyboards/massdrop/ctrl/readme.md
new file mode 100644
index 000000000..54157c3da
--- /dev/null
+++ b/keyboards/massdrop/ctrl/readme.md
@@ -0,0 +1,15 @@
1# CTRL
2
3![CTRL](https://massdrop-s3.imgix.net/product-images/massdrop-ntkl-mechanical-keyboard/FP/W6zvr0cTR4KVDY5z8rwp_AI7B6588%20copy%20page.jpg?auto=format&fm=jpg&fit=max&w=700&h=467&dpr=1&q=80)
4
5The Massdrop CTRL is a TKL mechanical keyboard featuring dual USB-C connectors, an integrated Hi-Speed USB 2.0 hub, and fully customizable RGB backlighting and underlighting.
6
7Keyboard Maintainer: [Massdrop](https://github.com/massdrop)
8Hardware Supported: Massdrop, Inc. CTRL PCBs utilizing Microchip's ATSAMD51J18A MCU and USB2422 2-Port USB 2.0 Hi-Speed Hub Controller, and ISSI's IS31FL3733 LED Drivers.
9Hardware Availability: [Massdrop CTRL Mechanical Keyboard](https://www.massdrop.com/buy/massdrop-ctrl-mechanical-keyboard)
10
11Make example for this keyboard (after setting up your build environment):
12
13 make ctrl: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). \ No newline at end of file
diff --git a/keyboards/massdrop/ctrl/rules.mk b/keyboards/massdrop/ctrl/rules.mk
new file mode 100644
index 000000000..daf679585
--- /dev/null
+++ b/keyboards/massdrop/ctrl/rules.mk
@@ -0,0 +1,32 @@
1# project specific files
2SRC = led_programs.c
3SRC += matrix.c
4
5#For platform and packs
6ARM_ATSAM = SAMD51J18A
7MCU = cortex-m4
8
9CUSTOM_MATRIX = yes
10
11# Build Options
12# comment out to disable the options.
13#
14BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
15MOUSEKEY_ENABLE = no # Mouse keys(+4700)
16EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
17CONSOLE_ENABLE = no # Console for debug(+400)
18COMMAND_ENABLE = no # Commands for debug and configuration
19# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
20SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
21# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
22NKRO_ENABLE = yes # USB Nkey Rollover
23BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
24RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
25MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
26UNICODE_ENABLE = no # Unicode
27BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
28AUDIO_ENABLE = no # Audio output on port C6
29FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
30HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
31VIRTSER_ENABLE = no # USB Serial Driver
32RAW_ENABLE = no # Raw device