aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-04-15 00:29:50 -0400
committerDrashna Jaelre <drashna@live.com>2019-04-14 21:29:50 -0700
commitffc82ebdb2ee00c14dd225eb057d209d4584a623 (patch)
tree8b6fdf04546b52ce810e28bf1183e35ec628cc7e
parent49746830402cc0e1c0227c6c3c06ebc22fcd016c (diff)
downloadqmk_firmware-ffc82ebdb2ee00c14dd225eb057d209d4584a623.tar.gz
qmk_firmware-ffc82ebdb2ee00c14dd225eb057d209d4584a623.zip
[Keyboard] Zen keyboard update for Rev2 (#5522)
* Updated Zen keyboard for rev2 support * Fixing r1 compile errors * PR feedback and changes for Proton-C compile errors
-rw-r--r--keyboards/zen/common/glcdfont.c239
-rw-r--r--keyboards/zen/config.h13
-rw-r--r--keyboards/zen/keymaps/default/rules.mk3
-rw-r--r--keyboards/zen/keymaps/jwlawrence/rules.mk3
-rw-r--r--keyboards/zen/keymaps/xyverz/rules.mk3
-rw-r--r--keyboards/zen/matrix.c466
-rw-r--r--keyboards/zen/readme.md19
-rw-r--r--keyboards/zen/rev1/config.h21
-rw-r--r--keyboards/zen/rev1/keymaps/333fred/config.h (renamed from keyboards/zen/keymaps/333fred/config.h)0
-rw-r--r--keyboards/zen/rev1/keymaps/333fred/keymap.c (renamed from keyboards/zen/keymaps/333fred/keymap.c)0
-rw-r--r--keyboards/zen/rev1/keymaps/333fred/rules.mk (renamed from keyboards/zen/keymaps/333fred/rules.mk)1
-rw-r--r--keyboards/zen/rev1/keymaps/default/config.h (renamed from keyboards/zen/keymaps/jwlawrence/config.h)5
-rw-r--r--keyboards/zen/rev1/keymaps/default/keymap.c (renamed from keyboards/zen/keymaps/default/keymap.c)0
-rw-r--r--keyboards/zen/rev1/keymaps/default/rules.mk1
-rw-r--r--keyboards/zen/rev1/keymaps/jwlawrence/config.h (renamed from keyboards/zen/keymaps/default/config.h)0
-rw-r--r--keyboards/zen/rev1/keymaps/jwlawrence/keymap.c (renamed from keyboards/zen/keymaps/jwlawrence/keymap.c)0
-rw-r--r--keyboards/zen/rev1/keymaps/jwlawrence/rules.mk1
-rw-r--r--keyboards/zen/rev1/keymaps/kageurufu/keymap.c (renamed from keyboards/zen/keymaps/kageurufu/keymap.c)4
-rw-r--r--keyboards/zen/rev1/keymaps/xyverz/config.h (renamed from keyboards/zen/keymaps/xyverz/config.h)5
-rw-r--r--keyboards/zen/rev1/keymaps/xyverz/keymap.c (renamed from keyboards/zen/keymaps/xyverz/keymap.c)0
-rw-r--r--keyboards/zen/rev1/keymaps/xyverz/rules.mk1
-rw-r--r--keyboards/zen/rev1/rev1.h5
-rw-r--r--keyboards/zen/rev1/rules.mk2
-rw-r--r--keyboards/zen/rev2/config.h98
-rw-r--r--keyboards/zen/rev2/keymaps/debug/keymap.c19
-rw-r--r--keyboards/zen/rev2/keymaps/default/keymap.c117
-rw-r--r--keyboards/zen/rev2/rev2.c66
-rw-r--r--keyboards/zen/rev2/rev2.h56
-rw-r--r--keyboards/zen/rev2/rules.mk14
-rw-r--r--keyboards/zen/rules.mk69
-rw-r--r--keyboards/zen/serial.c228
-rw-r--r--keyboards/zen/serial.h26
-rw-r--r--keyboards/zen/split_rgb.c41
-rw-r--r--keyboards/zen/split_rgb.h6
-rw-r--r--keyboards/zen/split_util.c86
-rw-r--r--keyboards/zen/split_util.h20
-rw-r--r--keyboards/zen/zen.h11
37 files changed, 662 insertions, 987 deletions
diff --git a/keyboards/zen/common/glcdfont.c b/keyboards/zen/common/glcdfont.c
new file mode 100644
index 000000000..3b4ccfa95
--- /dev/null
+++ b/keyboards/zen/common/glcdfont.c
@@ -0,0 +1,239 @@
1// This is the SOL 6x8 font
2
3#pragma once
4
5#ifdef __AVR__
6 #include <avr/io.h>
7 #include <avr/pgmspace.h>
8#elif defined(ESP8266)
9 #include <pgmspace.h>
10#else
11 #define PROGMEM
12#endif
13
14static const unsigned char font[] PROGMEM = {
15 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
17 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
18 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
19 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
20 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
21 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
22 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
23 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
24 0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
25 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
26 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
27 0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
28 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
29 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
30 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
31 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
32 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
33 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
34 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
35 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
36 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
37 0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
38 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
39 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
40 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
41 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
42 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
43 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
44 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
45 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
46 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
49 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
50 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
51 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
52 0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
53 0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
54 0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
55 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
56 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
57 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
58 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
59 0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
60 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
61 0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
62 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
63 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
64 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
65 0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
66 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
67 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
68 0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
69 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
70 0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
71 0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
72 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
73 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
74 0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
75 0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
76 0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
77 0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
78 0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
79 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
80 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
81 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
82 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
83 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
84 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
85 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
86 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
87 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
88 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
89 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
90 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
91 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
92 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
93 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
94 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
95 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
96 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
97 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
98 0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
99 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
100 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
101 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
102 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
103 0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
104 0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
105 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
106 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
107 0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
108 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
109 0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
110 0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
111 0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
112 0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
113 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
114 0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
115 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
116 0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
117 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
118 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00,
119 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
120 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
121 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
122 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
123 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
124 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
125 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
126 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
127 0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
128 0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
129 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
130 0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
131 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
132 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
133 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
134 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
135 0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
136 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
137 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
138 0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
139 0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
140 0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
141 0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
142 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
144 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
145 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
146 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x80, 0x00, 0x00, 0x0C, 0x90,
151 0xB0, 0xE0, 0x72, 0x31, 0x9B, 0xDE,
152 0xCE, 0xEC, 0xEE, 0xE9, 0xE9, 0xEC,
153 0xCF, 0xDA, 0x99, 0x3E, 0x62, 0xE4,
154 0xC4, 0x70, 0x10, 0x10, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
156 0xC0, 0xC0, 0x80, 0x80, 0x02, 0x85,
157 0x85, 0x87, 0x85, 0x89, 0x89, 0x92,
158 0xEA, 0xC6, 0xC4, 0x48, 0x50, 0x60,
159 0x40, 0x40, 0x40, 0x40, 0xC0, 0xE0,
160 0x50, 0x28, 0x10, 0x10, 0x60, 0xC0,
161 0x40, 0x40, 0x40, 0x40, 0x80, 0x80,
162 0x80, 0x80, 0x80, 0xE0, 0xF8, 0xFC,
163 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00,
164 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
165 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
166 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
167 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
168 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
169 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
170 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
171 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
172 0x00, 0x00, 0x00, 0xE0, 0xEC, 0xDF,
173 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00,
174 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
175 0x00, 0x00, 0x00, 0x7F, 0x80, 0x80,
176 0x80, 0x70, 0x0F, 0x00, 0x00, 0x80,
177 0x7F, 0x00, 0x00, 0x7F, 0x80, 0x80,
178 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F,
179 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
180 0x80, 0x80, 0x80, 0xFF, 0x00, 0x00,
181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
182 0x00, 0x40, 0x21, 0x33, 0x3B, 0x7B,
183 0xFF, 0x00, 0x7C, 0xFF, 0xFF, 0xFF,
184 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
185 0xFF, 0xFF, 0xFF, 0xFF, 0x7C, 0x01,
186 0xFF, 0xDE, 0x8C, 0x04, 0x0C, 0x08,
187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188 0x00, 0x01, 0x01, 0x01, 0x7F, 0x80,
189 0x80, 0xBE, 0xBE, 0x80, 0x80, 0x80,
190 0xC1, 0xFF, 0x80, 0x04, 0x32, 0x5E,
191 0x1C, 0x3D, 0x26, 0x10, 0xC1, 0xFF,
192 0x3E, 0x00, 0x00, 0x08, 0x36, 0xC1,
193 0x08, 0x08, 0x14, 0x77, 0x94, 0x94,
194 0x94, 0xF7, 0x94, 0xF7, 0x9C, 0x9C,
195 0xFF, 0xFF, 0x1E, 0x00, 0x00, 0x00,
196 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
197 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
198 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
199 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
200 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
201 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
202 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
203 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
204 0x40, 0x7C, 0x3F, 0x3F, 0x23, 0x01,
205 0x23, 0x3F, 0x37, 0x6C, 0x40, 0x00,
206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x06, 0x02, 0x06,
215 0x4D, 0x4F, 0x8C, 0xF9, 0x73, 0x37,
216 0x27, 0x2F, 0x2F, 0xAF, 0xEF, 0x6F,
217 0x77, 0x17, 0x33, 0x79, 0xCC, 0x1F,
218 0x31, 0x20, 0x21, 0x02, 0x02, 0x00,
219 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
220 0x00, 0x00, 0x00, 0x00, 0x40, 0xE0,
221 0xA0, 0xA0, 0xD0, 0x90, 0x48, 0x48,
222 0x25, 0x2B, 0x11, 0x09, 0x05, 0x03,
223 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
224 0x01, 0x03, 0x02, 0x04, 0x03, 0x01,
225 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
226 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F,
227 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
235 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
239};
diff --git a/keyboards/zen/config.h b/keyboards/zen/config.h
index 4478062eb..6868dc135 100644
--- a/keyboards/zen/config.h
+++ b/keyboards/zen/config.h
@@ -15,17 +15,6 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along 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
23#endif // CONFIG_H
24
25#undef RGBLED_NUM
26#define RGBLIGHT_ANIMATIONS
27#define RGBLED_NUM 16
28
29#ifndef TAPPING_TERM
30#define TAPPING_TERM 100
31#endif
diff --git a/keyboards/zen/keymaps/default/rules.mk b/keyboards/zen/keymaps/default/rules.mk
deleted file mode 100644
index 73142a168..000000000
--- a/keyboards/zen/keymaps/default/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
1RGBLIGHT_ENABLE = yes
2BACKLIGHT_ENABLE = yes
3
diff --git a/keyboards/zen/keymaps/jwlawrence/rules.mk b/keyboards/zen/keymaps/jwlawrence/rules.mk
deleted file mode 100644
index 73142a168..000000000
--- a/keyboards/zen/keymaps/jwlawrence/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
1RGBLIGHT_ENABLE = yes
2BACKLIGHT_ENABLE = yes
3
diff --git a/keyboards/zen/keymaps/xyverz/rules.mk b/keyboards/zen/keymaps/xyverz/rules.mk
deleted file mode 100644
index 73142a168..000000000
--- a/keyboards/zen/keymaps/xyverz/rules.mk
+++ /dev/null
@@ -1,3 +0,0 @@
1RGBLIGHT_ENABLE = yes
2BACKLIGHT_ENABLE = yes
3
diff --git a/keyboards/zen/matrix.c b/keyboards/zen/matrix.c
deleted file mode 100644
index 34655237b..000000000
--- a/keyboards/zen/matrix.c
+++ /dev/null
@@ -1,466 +0,0 @@
1/*
2Copyright 2017 Danny Nguyen <danny@keeb.io>
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/*
19 * scan matrix
20 */
21#include <stdint.h>
22#include <stdbool.h>
23#include <avr/io.h>
24#include "wait.h"
25#include "print.h"
26#include "debug.h"
27#include "util.h"
28#include "matrix.h"
29#include "split_util.h"
30#include "pro_micro.h"
31#include "config.h"
32#include "timer.h"
33#include "backlight.h"
34
35#ifdef USE_I2C
36# include "i2c.h"
37#else // USE_SERIAL
38# include "serial.h"
39#endif
40
41#ifndef DEBOUNCING_DELAY
42# define DEBOUNCING_DELAY 5
43#endif
44
45#if (DEBOUNCING_DELAY > 0)
46 static uint16_t debouncing_time;
47 static bool debouncing = false;
48#endif
49
50#if (MATRIX_COLS <= 8)
51# define print_matrix_header() print("\nr/c 01234567\n")
52# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
53# define matrix_bitpop(i) bitpop(matrix[i])
54# define ROW_SHIFTER ((uint8_t)1)
55#else
56# error "Currently only supports 8 COLS"
57#endif
58static matrix_row_t matrix_debouncing[MATRIX_ROWS];
59
60#define ERROR_DISCONNECT_COUNT 5
61
62#define SERIAL_LED_ADDR 0x00
63
64#define ROWS_PER_HAND (MATRIX_ROWS/2)
65
66static uint8_t error_count = 0;
67
68static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
69static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
70
71/* matrix state(1:on, 0:off) */
72static matrix_row_t matrix[MATRIX_ROWS];
73static matrix_row_t matrix_debouncing[MATRIX_ROWS];
74
75#if (DIODE_DIRECTION == COL2ROW)
76 static void init_cols(void);
77 static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
78 static void unselect_rows(void);
79 static void select_row(uint8_t row);
80 static void unselect_row(uint8_t row);
81#elif (DIODE_DIRECTION == ROW2COL)
82 static void init_rows(void);
83 static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
84 static void unselect_cols(void);
85 static void unselect_col(uint8_t col);
86 static void select_col(uint8_t col);
87#endif
88
89__attribute__ ((weak))
90void matrix_init_kb(void) {
91 matrix_init_user();
92}
93
94__attribute__ ((weak))
95void matrix_scan_kb(void) {
96 matrix_scan_user();
97}
98
99__attribute__ ((weak))
100void matrix_init_user(void) {
101}
102
103__attribute__ ((weak))
104void matrix_scan_user(void) {
105}
106
107inline
108uint8_t matrix_rows(void)
109{
110 return MATRIX_ROWS;
111}
112
113inline
114uint8_t matrix_cols(void)
115{
116 return MATRIX_COLS;
117}
118
119void matrix_init(void)
120{
121 debug_enable = true;
122 debug_matrix = true;
123 debug_mouse = true;
124 // initialize row and col
125 unselect_rows();
126 init_cols();
127
128 TX_RX_LED_INIT;
129
130 // initialize matrix state: all keys off
131 for (uint8_t i=0; i < MATRIX_ROWS; i++) {
132 matrix[i] = 0;
133 matrix_debouncing[i] = 0;
134 }
135
136 matrix_init_quantum();
137}
138
139uint8_t _matrix_scan(void)
140{
141 int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
142#if (DIODE_DIRECTION == COL2ROW)
143 // Set row, read cols
144 for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
145# if (DEBOUNCING_DELAY > 0)
146 bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row);
147
148 if (matrix_changed) {
149 debouncing = true;
150 debouncing_time = timer_read();
151 }
152
153# else
154 read_cols_on_row(matrix+offset, current_row);
155# endif
156
157 }
158
159#elif (DIODE_DIRECTION == ROW2COL)
160 // Set col, read rows
161 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
162# if (DEBOUNCING_DELAY > 0)
163 bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col);
164 if (matrix_changed) {
165 debouncing = true;
166 debouncing_time = timer_read();
167 }
168# else
169 read_rows_on_col(matrix+offset, current_col);
170# endif
171
172 }
173#endif
174
175# if (DEBOUNCING_DELAY > 0)
176 if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
177 for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
178 matrix[i+offset] = matrix_debouncing[i+offset];
179 }
180 debouncing = false;
181 }
182# endif
183
184 return 1;
185}
186
187#ifdef USE_I2C
188
189// Get rows from other half over i2c
190int i2c_transaction(void) {
191 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
192
193 int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
194 if (err) goto i2c_error;
195
196 // start of matrix stored at 0x00
197 err = i2c_master_write(0x00);
198 if (err) goto i2c_error;
199
200 // Start read
201 err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
202 if (err) goto i2c_error;
203
204 if (!err) {
205 int i;
206 for (i = 0; i < ROWS_PER_HAND-1; ++i) {
207 matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
208 }
209 matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
210 i2c_master_stop();
211 } else {
212i2c_error: // the cable is disconnceted, or something else went wrong
213 i2c_reset_state();
214 return err;
215 }
216
217 return 0;
218}
219
220#else // USE_SERIAL
221
222int serial_transaction(void) {
223 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
224
225 if (serial_update_buffers()) {
226 return 1;
227 }
228
229 for (int i = 0; i < ROWS_PER_HAND; ++i) {
230 matrix[slaveOffset+i] = serial_slave_buffer[i];
231 }
232
233#ifdef BACKLIGHT_ENABLE
234 // Write backlight level for slave to read
235 serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level();
236#endif
237 return 0;
238}
239#endif
240
241uint8_t matrix_scan(void)
242{
243 uint8_t ret = _matrix_scan();
244
245#ifdef USE_I2C
246 if( i2c_transaction() ) {
247#else // USE_SERIAL
248 if( serial_transaction() ) {
249#endif
250 // turn on the indicator led when halves are disconnected
251 TXLED1;
252
253 error_count++;
254
255 if (error_count > ERROR_DISCONNECT_COUNT) {
256 // reset other half if disconnected
257 int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
258 for (int i = 0; i < ROWS_PER_HAND; ++i) {
259 matrix[slaveOffset+i] = 0;
260 }
261 }
262 } else {
263 // turn off the indicator led on no error
264 TXLED0;
265 error_count = 0;
266 }
267 matrix_scan_quantum();
268 return ret;
269}
270
271void matrix_slave_scan(void) {
272 _matrix_scan();
273
274 int offset = (isLeftHand) ? 0 : ROWS_PER_HAND;
275
276#ifdef USE_I2C
277 for (int i = 0; i < ROWS_PER_HAND; ++i) {
278 i2c_slave_buffer[i] = matrix[offset+i];
279 }
280#else // USE_SERIAL
281 for (int i = 0; i < ROWS_PER_HAND; ++i) {
282 serial_slave_buffer[i] = matrix[offset+i];
283 }
284
285#ifdef BACKLIGHT_ENABLE
286 // Read backlight level sent from master and update level on slave
287 backlight_set(serial_master_buffer[SERIAL_LED_ADDR]);
288#endif
289#endif
290}
291
292bool matrix_is_modified(void)
293{
294 if (debouncing) return false;
295 return true;
296}
297
298inline
299bool matrix_is_on(uint8_t row, uint8_t col)
300{
301 return (matrix[row] & ((matrix_row_t)1<<col));
302}
303
304inline
305matrix_row_t matrix_get_row(uint8_t row)
306{
307 return matrix[row];
308}
309
310void matrix_print(void)
311{
312 print("\nr/c 0123456789ABCDEF\n");
313 for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
314 phex(row); print(": ");
315 pbin_reverse16(matrix_get_row(row));
316 print("\n");
317 }
318}
319
320uint8_t matrix_key_count(void)
321{
322 uint8_t count = 0;
323 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
324 count += bitpop16(matrix[i]);
325 }
326 return count;
327}
328
329#if (DIODE_DIRECTION == COL2ROW)
330
331static void init_cols(void)
332{
333 for(uint8_t x = 0; x < MATRIX_COLS; x++) {
334 uint8_t pin = col_pins[x];
335 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
336 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
337 }
338}
339
340static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
341{
342 // Store last value of row prior to reading
343 matrix_row_t last_row_value = current_matrix[current_row];
344
345 // Clear data in matrix row
346 current_matrix[current_row] = 0;
347
348 // Select row and wait for row selecton to stabilize
349 select_row(current_row);
350 wait_us(30);
351
352 // For each col...
353 for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
354
355 // Select the col pin to read (active low)
356 uint8_t pin = col_pins[col_index];
357 uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
358
359 // Populate the matrix row with the state of the col pin
360 current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
361 }
362
363 // Unselect row
364 unselect_row(current_row);
365
366 return (last_row_value != current_matrix[current_row]);
367}
368
369static void select_row(uint8_t row)
370{
371 uint8_t pin = row_pins[row];
372 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
373 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
374}
375
376static void unselect_row(uint8_t row)
377{
378 uint8_t pin = row_pins[row];
379 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
380 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
381}
382
383static void unselect_rows(void)
384{
385 for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
386 uint8_t pin = row_pins[x];
387 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
388 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
389 }
390}
391
392#elif (DIODE_DIRECTION == ROW2COL)
393
394static void init_rows(void)
395{
396 for(uint8_t x = 0; x < ROWS_PER_HAND; x++) {
397 uint8_t pin = row_pins[x];
398 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
399 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
400 }
401}
402
403static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
404{
405 bool matrix_changed = false;
406
407 // Select col and wait for col selecton to stabilize
408 select_col(current_col);
409 wait_us(30);
410
411 // For each row...
412 for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++)
413 {
414
415 // Store last value of row prior to reading
416 matrix_row_t last_row_value = current_matrix[row_index];
417
418 // Check row pin state
419 if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0)
420 {
421 // Pin LO, set col bit
422 current_matrix[row_index] |= (ROW_SHIFTER << current_col);
423 }
424 else
425 {
426 // Pin HI, clear col bit
427 current_matrix[row_index] &= ~(ROW_SHIFTER << current_col);
428 }
429
430 // Determine if the matrix changed state
431 if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
432 {
433 matrix_changed = true;
434 }
435 }
436
437 // Unselect col
438 unselect_col(current_col);
439
440 return matrix_changed;
441}
442
443static void select_col(uint8_t col)
444{
445 uint8_t pin = col_pins[col];
446 _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
447 _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
448}
449
450static void unselect_col(uint8_t col)
451{
452 uint8_t pin = col_pins[col];
453 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
454 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
455}
456
457static void unselect_cols(void)
458{
459 for(uint8_t x = 0; x < MATRIX_COLS; x++) {
460 uint8_t pin = col_pins[x];
461 _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
462 _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
463 }
464}
465
466#endif
diff --git a/keyboards/zen/readme.md b/keyboards/zen/readme.md
index 0fb0ffb3b..7ca7c69fe 100644
--- a/keyboards/zen/readme.md
+++ b/keyboards/zen/readme.md
@@ -2,19 +2,26 @@
2 2
3A split ergo keyboard with a few goals in mind: 3A split ergo keyboard with a few goals in mind:
4 4
5- Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen is only 8.0mm thick. 5- Be as thin as possible. Other split KBs (Let's Split, Nyquist, Iris) are 15.2mm thick. The Zen rev2 is only 13.2mm thick *including switches and caps* when using Kailh Choc low-profile switches, and 22.1mm using standard MX switches and DSA keycaps.
6- Layout designed for gaming. 1.5u pinky keys, ortho alphas, and angled thumb keys. After trying Ortholinear, Atreus62, and Ergodox, this is the best layout for gaming and typing. 6- Layout designed for gaming. 1.5u pinky keys, ortho alphas, and angled thumb keys. After trying Ortholinear, Atreus62, and Ergodox, this is the best layout for gaming and typing.
7- RGB backlighting. 16 WS2812b LEDs shine through the perimeter switches. The SK6812 variant are cheap and easy to solder. 7- Per-key RGB lighting. 34 WS2812b LEDs per side make it exceptionally bright
8- Price. Using Arduino Pro Micro, SK6812 LEDs, and PCB FR4 for the case, the cost of each half without switches or caps can be reduced to under $20 when purchased at volume. 8- Price. Using Arduino Pro Micro, SK6812 LEDs, and PCB FR4 for the case, the cost of each half without switches or caps can be reduced to under $20 when purchased at volume.
9- Options. The Zen rev2 comes with rotary encoder support, SSD1306 OLED pinout, USB-C or TRRS interconnect, and jumpers to enable compatibility with the [QMK Proton-C](https://olkb.com/parts/qmk-proton-c) and the [Keeb.io Elite-C](https://keeb.io/products/elite-c-usb-c-pro-micro-replacement-arduino-compatible-atmega32u4)
9 10
10Keyboard Maintainer: [Legonut](https://github.com/Legonut) 11Keyboard Maintainer: [Legonut](https://github.com/Legonut)
11Hardware Supported: Zen rev1 12Hardware Supported: Zen rev1, Zen rev2
12Hardware Availability: [RGBKB.net](https://www.rgbkb.net/) 13Hardware Availability: [RGBKB.net](https://www.rgbkb.net/)
13 14
14A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://legonut.gitbooks.io/zen-keyboard/content/). 15A build guide and more info for this keyboard can be found here: [Zen Build Guide](https://rgbkb.gitbook.io/sol-build-guide/zygomorph-build-guide/untitled).
15 16
16Make example for this keyboard (after setting up your build environment): 17Make example for this keyboard (after setting up your build environment):
17 18
18 make zen/rev1:default 19 make zen/rev2:default
20
21To build for a Proton-C:
22
23 make zen/rev2:default CTPC=yes
24
25**Note:** The Proton-C does not have split keyboard, or encoder support. Also OLED driver support is untested. Will update as status changes.
19 26
20See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. 27See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
diff --git a/keyboards/zen/rev1/config.h b/keyboards/zen/rev1/config.h
index f480cadcc..88f39af48 100644
--- a/keyboards/zen/rev1/config.h
+++ b/keyboards/zen/rev1/config.h
@@ -15,15 +15,12 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef REV1_CONFIG_H 18#pragma once
19#define REV1_CONFIG_H
20
21#include QMK_KEYBOARD_CONFIG_H
22 19
23/* USB Device descriptor parameter */ 20/* USB Device descriptor parameter */
24#define VENDOR_ID 0xCEEB 21#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x1256 22#define PRODUCT_ID 0x3060
26#define DEVICE_VER 0x0200 23#define DEVICE_VER 0x0001
27#define MANUFACTURER Legonut 24#define MANUFACTURER Legonut
28#define PRODUCT Project Zen 25#define PRODUCT Project Zen
29#define DESCRIPTION Split gaming keyboard 26#define DESCRIPTION Split gaming keyboard
@@ -40,12 +37,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
40/* COL2ROW or ROW2COL */ 37/* COL2ROW or ROW2COL */
41#define DIODE_DIRECTION COL2ROW 38#define DIODE_DIRECTION COL2ROW
42 39
40#define SOFT_SERIAL_PIN D0
41
43/* define if matrix has ghost */ 42/* define if matrix has ghost */
44//#define MATRIX_HAS_GHOST 43//#define MATRIX_HAS_GHOST
45 44
46/* number of backlight levels */
47// #define BACKLIGHT_LEVELS 3
48
49/* Set 0 if debouncing isn't needed */ 45/* Set 0 if debouncing isn't needed */
50#define DEBOUNCING_DELAY 5 46#define DEBOUNCING_DELAY 5
51 47
@@ -54,9 +50,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
54/* Locking resynchronize hack */ 50/* Locking resynchronize hack */
55#define LOCKING_RESYNC_ENABLE 51#define LOCKING_RESYNC_ENABLE
56 52
57#define BACKLIGHT_PIN F4
58#define BACKLIGHT_LEVELS 5
59
60/* ws2812 RGB LED */ 53/* ws2812 RGB LED */
61#define RGB_DI_PIN D1 54#define RGB_DI_PIN D1
62 55
@@ -79,5 +72,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
79//#define NO_ACTION_ONESHOT 72//#define NO_ACTION_ONESHOT
80//#define NO_ACTION_MACRO 73//#define NO_ACTION_MACRO
81//#define NO_ACTION_FUNCTION 74//#define NO_ACTION_FUNCTION
82
83#endif
diff --git a/keyboards/zen/keymaps/333fred/config.h b/keyboards/zen/rev1/keymaps/333fred/config.h
index 1634f368c..1634f368c 100644
--- a/keyboards/zen/keymaps/333fred/config.h
+++ b/keyboards/zen/rev1/keymaps/333fred/config.h
diff --git a/keyboards/zen/keymaps/333fred/keymap.c b/keyboards/zen/rev1/keymaps/333fred/keymap.c
index 3dd769803..3dd769803 100644
--- a/keyboards/zen/keymaps/333fred/keymap.c
+++ b/keyboards/zen/rev1/keymaps/333fred/keymap.c
diff --git a/keyboards/zen/keymaps/333fred/rules.mk b/keyboards/zen/rev1/keymaps/333fred/rules.mk
index 38b715550..1359e81c0 100644
--- a/keyboards/zen/keymaps/333fred/rules.mk
+++ b/keyboards/zen/rev1/keymaps/333fred/rules.mk
@@ -1,5 +1,4 @@
1RGBLIGHT_ENABLE = yes 1RGBLIGHT_ENABLE = yes
2BACKLIGHT_ENABLE = no
3NKRO_ENABLE = yes 2NKRO_ENABLE = yes
4KEY_LOCK_ENABLE = yes 3KEY_LOCK_ENABLE = yes
5TAP_DANCE_ENABLE = yes 4TAP_DANCE_ENABLE = yes
diff --git a/keyboards/zen/keymaps/jwlawrence/config.h b/keyboards/zen/rev1/keymaps/default/config.h
index 38e4d73f0..4a549c5b1 100644
--- a/keyboards/zen/keymaps/jwlawrence/config.h
+++ b/keyboards/zen/rev1/keymaps/default/config.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_USER_H 18#pragma once
19#define CONFIG_USER_H
20 19
21#include "config_common.h" 20#include "config_common.h"
22 21
@@ -37,5 +36,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
37#define RGBLIGHT_HUE_STEP 8 36#define RGBLIGHT_HUE_STEP 8
38#define RGBLIGHT_SAT_STEP 8 37#define RGBLIGHT_SAT_STEP 8
39#define RGBLIGHT_VAL_STEP 8 38#define RGBLIGHT_VAL_STEP 8
40
41#endif
diff --git a/keyboards/zen/keymaps/default/keymap.c b/keyboards/zen/rev1/keymaps/default/keymap.c
index b2adffd1e..b2adffd1e 100644
--- a/keyboards/zen/keymaps/default/keymap.c
+++ b/keyboards/zen/rev1/keymaps/default/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/default/rules.mk b/keyboards/zen/rev1/keymaps/default/rules.mk
new file mode 100644
index 000000000..1e3cebb14
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/default/rules.mk
@@ -0,0 +1 @@
RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/keymaps/default/config.h b/keyboards/zen/rev1/keymaps/jwlawrence/config.h
index d813085e4..d813085e4 100644
--- a/keyboards/zen/keymaps/default/config.h
+++ b/keyboards/zen/rev1/keymaps/jwlawrence/config.h
diff --git a/keyboards/zen/keymaps/jwlawrence/keymap.c b/keyboards/zen/rev1/keymaps/jwlawrence/keymap.c
index 13edd0db8..13edd0db8 100644
--- a/keyboards/zen/keymaps/jwlawrence/keymap.c
+++ b/keyboards/zen/rev1/keymaps/jwlawrence/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk b/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk
new file mode 100644
index 000000000..1e3cebb14
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/jwlawrence/rules.mk
@@ -0,0 +1 @@
RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/keymaps/kageurufu/keymap.c b/keyboards/zen/rev1/keymaps/kageurufu/keymap.c
index 761100dbe..75884635c 100644
--- a/keyboards/zen/keymaps/kageurufu/keymap.c
+++ b/keyboards/zen/rev1/keymaps/kageurufu/keymap.c
@@ -1,8 +1,8 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2#include "kageurufu.h" 2#include "kageurufu.h"
3#ifdef PROTOCOL_LUFA 3#ifdef PROTOCOL_LUFA
4#include "lufa.h" 4 #include "lufa.h"
5#include "split_util.h" 5 #include "split_util.h"
6#endif 6#endif
7 7
8extern keymap_config_t keymap_config; 8extern keymap_config_t keymap_config;
diff --git a/keyboards/zen/keymaps/xyverz/config.h b/keyboards/zen/rev1/keymaps/xyverz/config.h
index 818f89989..d3e21ea17 100644
--- a/keyboards/zen/keymaps/xyverz/config.h
+++ b/keyboards/zen/rev1/keymaps/xyverz/config.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_USER_H 18#pragma once
19#define CONFIG_USER_H
20 19
21#include "config_common.h" 20#include "config_common.h"
22 21
@@ -31,5 +30,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#define RGBLIGHT_HUE_STEP 8 30#define RGBLIGHT_HUE_STEP 8
32#define RGBLIGHT_SAT_STEP 8 31#define RGBLIGHT_SAT_STEP 8
33#define RGBLIGHT_VAL_STEP 8 32#define RGBLIGHT_VAL_STEP 8
34
35#endif
diff --git a/keyboards/zen/keymaps/xyverz/keymap.c b/keyboards/zen/rev1/keymaps/xyverz/keymap.c
index 6250086ed..6250086ed 100644
--- a/keyboards/zen/keymaps/xyverz/keymap.c
+++ b/keyboards/zen/rev1/keymaps/xyverz/keymap.c
diff --git a/keyboards/zen/rev1/keymaps/xyverz/rules.mk b/keyboards/zen/rev1/keymaps/xyverz/rules.mk
new file mode 100644
index 000000000..1e3cebb14
--- /dev/null
+++ b/keyboards/zen/rev1/keymaps/xyverz/rules.mk
@@ -0,0 +1 @@
RGBLIGHT_ENABLE = yes
diff --git a/keyboards/zen/rev1/rev1.h b/keyboards/zen/rev1/rev1.h
index c2444f047..a12f2ea78 100644
--- a/keyboards/zen/rev1/rev1.h
+++ b/keyboards/zen/rev1/rev1.h
@@ -1,5 +1,4 @@
1#ifndef REV1_H 1#pragma once
2#define REV1_H
3 2
4#include "zen.h" 3#include "zen.h"
5 4
@@ -36,5 +35,3 @@
36 { k80, k81, k82, k83, k84, k85, KC_NO }, \ 35 { k80, k81, k82, k83, k84, k85, KC_NO }, \
37 { k90, k91, k92, k93, k94, k95, k96 } \ 36 { k90, k91, k92, k93, k94, k95, k96 } \
38 } 37 }
39
40#endif
diff --git a/keyboards/zen/rev1/rules.mk b/keyboards/zen/rev1/rules.mk
index d7463419b..e69de29bb 100644
--- a/keyboards/zen/rev1/rules.mk
+++ b/keyboards/zen/rev1/rules.mk
@@ -1,2 +0,0 @@
1RGBLIGHT_ENABLE = yes
2BACKLIGHT_ENABLE = yes
diff --git a/keyboards/zen/rev2/config.h b/keyboards/zen/rev2/config.h
new file mode 100644
index 000000000..dc37472f6
--- /dev/null
+++ b/keyboards/zen/rev2/config.h
@@ -0,0 +1,98 @@
1/*
2Copyright 2017 Danny Nguyen <danny@hexwire.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/* USB Device descriptor parameter */
21#define VENDOR_ID 0xFEED
22#define PRODUCT_ID 0x3061
23#define DEVICE_VER 0x0002
24#define MANUFACTURER Legonut
25#define PRODUCT "Project Zen"
26#define DESCRIPTION "Split gaming keyboard"
27
28/* key matrix size */
29// Rows are doubled-up
30
31// wiring of each half
32#ifdef CONVERT_TO_PROTON_C
33 #define MATRIX_ROWS 5
34 #define MATRIX_COLS 7
35#else
36 #define MATRIX_ROWS 10
37 #define MATRIX_COLS 7
38#endif
39
40// Proton-C does pin conversion
41#define MATRIX_ROW_PINS { C6, E6, B5, D7, B4 }
42#define MATRIX_COL_PINS { F4, F5, F6, F7, B3, B1, B2 }
43
44#define NUMBER_OF_ENCODERS 1
45
46#define ENCODERS_PAD_A { D4 }
47#define ENCODERS_PAD_B { D2 }
48
49#define RGB_DI_PIN B6
50#define SOFT_SERIAL_PIN D3
51
52/* COL2ROW or ROW2COL */
53#define DIODE_DIRECTION COL2ROW
54
55/* define if matrix has ghost */
56//#define MATRIX_HAS_GHOST
57
58/* Set 0 if debouncing isn't needed */
59#define DEBOUNCING_DELAY 5
60
61/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
62#define LOCKING_SUPPORT_ENABLE
63/* Locking resynchronize hack */
64#define LOCKING_RESYNC_ENABLE
65
66/* ws2812 RGB LED */
67#define RGBLED_NUM 34 // Number of LEDs
68
69// If using 90 Degree rotation, increase block cout
70#ifdef OLED_ROTATE90
71 #define OLED_DISPLAY_CUSTOM
72 #define OLED_DISPLAY_WIDTH 128
73 #define OLED_DISPLAY_HEIGHT 32
74 #define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
75 #define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
76 #define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 8 (compile time mathed)
77 #define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
78 #define OLED_SOURCE_MAP { 0, 8, 16, 24 }
79 #define OLED_TARGET_MAP { 24, 16, 8, 0 }
80#endif
81
82/*
83 * Feature disable options
84 * These options are also useful to firmware size reduction.
85 */
86
87/* disable debug print */
88// #define NO_DEBUG
89
90/* disable print */
91// #define NO_PRINT
92
93/* disable action features */
94//#define NO_ACTION_LAYER
95//#define NO_ACTION_TAPPING
96//#define NO_ACTION_ONESHOT
97//#define NO_ACTION_MACRO
98//#define NO_ACTION_FUNCTION
diff --git a/keyboards/zen/rev2/keymaps/debug/keymap.c b/keyboards/zen/rev2/keymaps/debug/keymap.c
new file mode 100644
index 000000000..e2d3d6a35
--- /dev/null
+++ b/keyboards/zen/rev2/keymaps/debug/keymap.c
@@ -0,0 +1,19 @@
1#include QMK_KEYBOARD_H
2#include <stdio.h>
3
4// extern keymap_config_t keymap_config;
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { { { KC_TRNS } } };
7
8bool process_record_user(uint16_t keycode, keyrecord_t *record) {
9 static char buf[10] = " ";
10
11 if (record->event.pressed) {
12 snprintf(buf, 10, "C%dR%d ", record->event.key.col, record->event.key.row);
13
14 send_string(buf);
15 }
16 return false;
17
18 return true;
19}
diff --git a/keyboards/zen/rev2/keymaps/default/keymap.c b/keyboards/zen/rev2/keymaps/default/keymap.c
new file mode 100644
index 000000000..41003e4a5
--- /dev/null
+++ b/keyboards/zen/rev2/keymaps/default/keymap.c
@@ -0,0 +1,117 @@
1#include QMK_KEYBOARD_H
2
3extern keymap_config_t keymap_config;
4
5// Each layer gets a name for readability, which is then used in the keymap matrix below.
6// The underscores don't mean anything - you can have a layer called STUFF or any other name.
7// Layer names don't all need to be of the same length, obviously, and you can also skip them
8// entirely and just use numbers.
9#define _QWERTY 0
10#define _NAV 2
11
12
13enum custom_keycodes {
14 QWERTY = SAFE_RANGE,
15 NAV,
16
17};
18
19const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20
21 /* Qwerty
22 * ,-----------------------------------------. .-----------------------------------------.
23 * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
24 * |------+------+------+------+------+------| |------+------+------+------+------+------|
25 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
26 * |------+------+------+------+------+------| |------+------+------+------+------+------|
27 * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " |
28 * |------+------+------+------+------+------+------..------+------+------+------+------+------+------|
29 * | Shift| Z | X | C | V | B |RGBPrv||RGBNxt| N | M | , | . | / |Enter |
30 * |------+------+------+------+------+------+------||------+------+------+------+------+------+------|
31 * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN |
32 * `----------------------------------+-------------''------------------------------------------------'
33 * |Space |Delete||Enter |Space |
34 * '-------------''-------------'
35 */
36 [_QWERTY] = LAYOUT( \
37 KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
38 KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, \
39 LT(_NAV, KC_CAPS),KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
40 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, RGB_RMOD,RGB_MOD, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \
41 KC_LCTL, KC_LGUI, KC_LALT, RGB_TOG, MO(_NAV), KC_SPC, KC_DEL, KC_ENT, KC_SPACE, MO(_NAV), KC_MINS, KC_EQL, KC_PGUP, KC_PGDN, \
42 KC_SPC, KC_DEL, KC_ENT, KC_SPACE \
43 ),
44
45 /* NAV
46 * ,-----------------------------------------. .-----------------------------------------.
47 * | GESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Bksp |
48 * |------+------+------+------+------+------| |------+------+------+------+------+------|
49 * | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
50 * |------+------+------+------+------+------| |------+------+------+------+------+------|
51 * |CAPS(NAV)|A | S | D | F | G | | H | J | K | L | ; | " |
52 * |------+------+------+------+------+------+------..------+------+------+------+------+------+------|
53 * | Shift| Z | X | C | V | B | || | N | M | , | . | / |Enter |
54 * |------+------+------+------+------+------+------||------+------+------+------+------+------+------|
55 * | Ctrl | GUI | Alt |RGBTOG| NAV |Space |Delete||Enter |Space | NAV | - | = | PGUP | PGDN |
56 * `----------------------------------+-------------''------------------------------------------------'
57 * |Space |Delete||Enter |Space |
58 * '-------------''-------------'
59 */
60 [_NAV] = LAYOUT( \
61 KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
62 _______, RGB_SAI, RGB_VAI, RGB_SAD, RESET, KC_LBRC, KC_RBRC, KC_PGUP, KC_UP, KC_PGDN, KC_INS, KC_HOME, \
63 _______, RGB_HUD, RGB_VAD, RGB_HUI, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_END, \
64 KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MPRV, KC_MNXT, \
65 KC_LCTL, KC_LGUI, KC_LALT, RGB_MOD, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, KC_VOLU, KC_VOLD, \
66 _______, _______, _______, _______
67 ),
68
69};
70
71void encoder_update_user(uint8_t index, bool clockwise) {
72 if (index == 0) { /* First encoder */
73 if (clockwise) {
74 tap_code(KC_PGDN);
75 } else {
76 tap_code(KC_PGUP);
77 }
78 } else if (index == 1) { /* Second encoder from slave */
79 if (clockwise) {
80 tap_code(KC_UP);
81 } else {
82 tap_code(KC_DOWN);
83 }
84 }
85}
86
87bool process_record_user(uint16_t keycode, keyrecord_t *record) {
88 switch (keycode) {
89 case QWERTY:
90 if (record->event.pressed) {
91 set_single_persistent_default_layer(1UL<<_QWERTY);
92 }
93 return false;
94 break;
95 //case COLEMAK:
96 //if (record->event.pressed) {
97 //set_single_persistent_default_layer(1UL<<_COLEMAK);
98 //}
99 //return false;
100 //break;
101 }
102 return true;
103}
104
105
106#if OLED_DRIVER_ENABLE
107const char* layer_name_user(uint32_t layer) {
108 switch (layer) {
109 case _QWERTY:
110 return PSTR("QWRTY");
111 case _NAV:
112 return PSTR("NAV\n");
113 default:
114 return PSTR("UNDEF");
115 }
116}
117#endif
diff --git a/keyboards/zen/rev2/rev2.c b/keyboards/zen/rev2/rev2.c
new file mode 100644
index 000000000..4104460db
--- /dev/null
+++ b/keyboards/zen/rev2/rev2.c
@@ -0,0 +1,66 @@
1#include "rev2.h"
2
3#ifdef OLED_DRIVER_ENABLE
4#include "split_util.h"
5#include "oled_driver.h"
6
7__attribute__((weak))
8void render_logo(void) {
9 static const char PROGMEM sol_logo[] = {
10 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
11 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
12 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
13
14 oled_write_P(sol_logo, false);
15}
16
17__attribute__((weak))
18const char* layer_name_user(uint32_t layer) {
19 switch (layer) {
20 default:
21 return PSTR("UNDEF\n");
22 }
23}
24
25__attribute__((weak))
26void render_status(void) {
27 // Setup for 90 degree rendering because it's awesome!
28 // It can house 16 lines of text, with 5 letters each line
29 // Render to mode icon
30 static const char PROGMEM mode_logo[2][4] = {
31 {0x97,0x98,0x0a,0},
32 {0xb7,0xb8,0x0a,0} };
33
34 oled_write_P(mode_logo[0], false); // Line 1
35 oled_write_P(mode_logo[1], false); // Line 2
36
37 // Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
38 oled_set_cursor(0, 3); // Line 3
39 oled_write_P(PSTR("Layer"), false); // Line 4
40 oled_write_P(layer_name_user(biton32(layer_state)), false);
41
42 // Host Keyboard LED Status
43 uint8_t led_usb_state = host_keyboard_leds();
44 oled_set_cursor(0, OLED_MAX_LINES - 4); // Line 13
45 oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false); // Line 14
46 oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); // Line 15
47 oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); // Line 16
48}
49
50#ifdef OLED_ROTATE90
51bool oled_init_user(bool flip180) {
52 return true;
53}
54#endif
55
56__attribute__((weak))
57void oled_task_user(void) {
58 if (is_keyboard_master()) {
59 render_status();
60 } else {
61 render_logo();
62 oled_scroll_left();
63 }
64}
65
66#endif
diff --git a/keyboards/zen/rev2/rev2.h b/keyboards/zen/rev2/rev2.h
new file mode 100644
index 000000000..101622988
--- /dev/null
+++ b/keyboards/zen/rev2/rev2.h
@@ -0,0 +1,56 @@
1#pragma once
2
3#include "zen.h"
4
5//void promicro_bootloader_jmp(bool program);
6#include "quantum.h"
7
8
9#ifdef USE_I2C
10#include <stddef.h>
11#ifdef __AVR__
12 #include <avr/io.h>
13 #include <avr/interrupt.h>
14#endif
15#endif
16
17//void promicro_bootloader_jmp(bool program);
18
19#ifdef CONVERT_TO_PROTON_C
20 #define LAYOUT( \
21 k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \
22 k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \
23 k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \
24 k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \
25 k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \
26 k45, k46, k96, k95 \
27 ) \
28 { \
29 { k00, k01, k02, k03, k04, k05, KC_NO }, \
30 { k10, k11, k12, k13, k14, k15, k16 }, \
31 { k20, k21, k22, k23, k24, k25, k26 }, \
32 { k30, k31, k32, k33, k34, k35, k36 }, \
33 { k40, k41, k42, k43, k44, k45, k46 } \
34 }
35#else
36 #define LAYOUT( \
37 k00, k01, k02, k03, k04, k05, k55, k54, k53, k52, k51, k50, \
38 k10, k11, k12, k13, k14, k15, k65, k64, k63, k62, k61, k60, \
39 k20, k21, k22, k23, k24, k25, k75, k74, k73, k72, k71, k70, \
40 k30, k31, k32, k33, k34, k35, k16, k66, k85, k84, k83, k82, k81, k80, \
41 k40, k41, k42, k43, k44, k36, k26, k76, k86, k94, k93, k92, k91, k90, \
42 k45, k46, k96, k95 \
43 ) \
44 { \
45 { k00, k01, k02, k03, k04, k05, KC_NO }, \
46 { k10, k11, k12, k13, k14, k15, k16 }, \
47 { k20, k21, k22, k23, k24, k25, k26 }, \
48 { k30, k31, k32, k33, k34, k35, k36 }, \
49 { k40, k41, k42, k43, k44, k45, k46 }, \
50 { k50, k51, k52, k53, k54, k55, KC_NO }, \
51 { k60, k61, k62, k63, k64, k65, k66 }, \
52 { k70, k71, k72, k73, k74, k75, k76 }, \
53 { k80, k81, k82, k83, k84, k85, k86 }, \
54 { k90, k91, k92, k93, k94, k95, k96 } \
55 }
56#endif
diff --git a/keyboards/zen/rev2/rules.mk b/keyboards/zen/rev2/rules.mk
new file mode 100644
index 000000000..d1fe41052
--- /dev/null
+++ b/keyboards/zen/rev2/rules.mk
@@ -0,0 +1,14 @@
1ENCODER_ENABLE = yes
2
3OLED_DRIVER_ENABLE = no
4OLED_ROTATE90 = yes
5
6# Setup so that OLED and 90 degree rotation can be turned on/off easily
7# with "OLED_DRIVER_ENABLE = yes" or "OLED_ROTATE90 = no" in user's rules.mk file
8ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
9 # Custom local font file
10 OPT_DEFS += -DOLED_FONT_H=\"common/glcdfont.c\"
11 ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
12 OPT_DEFS += -DOLED_ROTATE90
13 endif
14endif
diff --git a/keyboards/zen/rules.mk b/keyboards/zen/rules.mk
index 4e8268911..f5d64a7f0 100644
--- a/keyboards/zen/rules.mk
+++ b/keyboards/zen/rules.mk
@@ -1,51 +1,26 @@
1SRC += matrix.c \ 1# Pro Micro or Elite-C
2 split_util.c \ 2# Automagically converted to Proton-C
3 serial.c
4
5# MCU name
6#MCU = at90usb1287
7MCU = atmega32u4 3MCU = atmega32u4
8
9# Processor frequency.
10# This will define a symbol, F_CPU, in all source code files equal to the
11# processor frequency in Hz. You can then use this symbol in your source code to
12# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
13# automatically to create a 32-bit value in your source code.
14#
15# This will be an integer division of F_USB below, as it is sourced by
16# F_USB after it has run through any CPU prescalers. Note that this value
17# does not *change* the processor frequency - it should merely be updated to
18# reflect the processor speed set externally so that the code can use accurate
19# software delays.
20F_CPU = 16000000 4F_CPU = 16000000
21
22#
23# LUFA specific
24#
25# Target architecture (see library "Board Types" documentation).
26ARCH = AVR8 5ARCH = AVR8
27
28# Input clock frequency.
29# This will define a symbol, F_USB, in all source code files equal to the
30# input clock frequency (before any prescaling is performed) in Hz. This value may
31# differ from F_CPU if prescaling is used on the latter, and is required as the
32# raw input clock is fed directly to the PLL sections of the AVR for high speed
33# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
34# at the end, this will be done automatically to create a 32-bit value in your
35# source code.
36#
37# If no clock division is performed on the input clock inside the AVR (via the
38# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
39F_USB = $(F_CPU) 6F_USB = $(F_CPU)
7BOOTLOADER = dfu
8OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
40 9
41# Bootloader 10ifeq ($(strip $(CTPC)), yes)
42# This definition is optional, and if your keyboard supports multiple bootloaders of 11 CONVERT_TO_PROTON_C=yes
43# different sizes, comment this out, and the correct address will be loaded 12endif
44# automatically (+60). See bootloader.mk for all options.
45BOOTLOADER = caterina
46 13
47# Interrupt driven control endpoint task(+60) 14ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
48OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 15 SPLIT_KEYBOARD = no # currently unsupported on ARM
16 RGBLIGHT_ENABLE = no # currently unsupported on ARM
17
18 EXTRAFLAGS += -DUSE_PROTON_C
19else
20 # Currently moved to Pro Micro only section because of lack of Proton-C support
21 SPLIT_KEYBOARD = yes
22 RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
23endif
49 24
50# Build Options 25# Build Options
51# change to "no" to disable the options, or define them in the Makefile in 26# change to "no" to disable the options, or define them in the Makefile in
@@ -57,17 +32,11 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE = no # Console for debug(+400) 32CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE = yes # Commands for debug and configuration 33COMMAND_ENABLE = yes # Commands for debug and configuration
59NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 34NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
60BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
61MIDI_ENABLE = no # MIDI controls 35MIDI_ENABLE = no # MIDI controls
62AUDIO_ENABLE = no # Audio output on port C6 36AUDIO_ENABLE = no # Audio output on port C6
63UNICODE_ENABLE = no # Unicode 37UNICODE_ENABLE = no # Unicode
64BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 38BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
65RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
66SUBPROJECT_rev1 = yes
67USE_I2C = no
68# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
69SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
70 39
71CUSTOM_MATRIX = yes 40SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
72 41
73DEFAULT_FOLDER = zen/rev1 42DEFAULT_FOLDER = zen/rev2
diff --git a/keyboards/zen/serial.c b/keyboards/zen/serial.c
deleted file mode 100644
index 74bcbb6bf..000000000
--- a/keyboards/zen/serial.c
+++ /dev/null
@@ -1,228 +0,0 @@
1/*
2 * WARNING: be careful changing this code, it is very timing dependent
3 */
4
5#ifndef F_CPU
6#define F_CPU 16000000
7#endif
8
9#include <avr/io.h>
10#include <avr/interrupt.h>
11#include <util/delay.h>
12#include <stdbool.h>
13#include "serial.h"
14
15#ifndef USE_I2C
16
17// Serial pulse period in microseconds. Its probably a bad idea to lower this
18// value.
19#define SERIAL_DELAY 24
20
21uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
22uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
23
24#define SLAVE_DATA_CORRUPT (1<<0)
25volatile uint8_t status = 0;
26
27inline static
28void serial_delay(void) {
29 _delay_us(SERIAL_DELAY);
30}
31
32inline static
33void serial_output(void) {
34 SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
35}
36
37// make the serial pin an input with pull-up resistor
38inline static
39void serial_input(void) {
40 SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
41 SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
42}
43
44inline static
45uint8_t serial_read_pin(void) {
46 return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
47}
48
49inline static
50void serial_low(void) {
51 SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
52}
53
54inline static
55void serial_high(void) {
56 SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
57}
58
59void serial_master_init(void) {
60 serial_output();
61 serial_high();
62}
63
64void serial_slave_init(void) {
65 serial_input();
66
67 // Enable INT0
68 EIMSK |= _BV(INT0);
69 // Trigger on falling edge of INT0
70 EICRA &= ~(_BV(ISC00) | _BV(ISC01));
71}
72
73// Used by the master to synchronize timing with the slave.
74static
75void sync_recv(void) {
76 serial_input();
77 // This shouldn't hang if the slave disconnects because the
78 // serial line will float to high if the slave does disconnect.
79 while (!serial_read_pin());
80 serial_delay();
81}
82
83// Used by the slave to send a synchronization signal to the master.
84static
85void sync_send(void) {
86 serial_output();
87
88 serial_low();
89 serial_delay();
90
91 serial_high();
92}
93
94// Reads a byte from the serial line
95static
96uint8_t serial_read_byte(void) {
97 uint8_t byte = 0;
98 serial_input();
99 for ( uint8_t i = 0; i < 8; ++i) {
100 byte = (byte << 1) | serial_read_pin();
101 serial_delay();
102 _delay_us(1);
103 }
104
105 return byte;
106}
107
108// Sends a byte with MSB ordering
109static
110void serial_write_byte(uint8_t data) {
111 uint8_t b = 8;
112 serial_output();
113 while( b-- ) {
114 if(data & (1 << b)) {
115 serial_high();
116 } else {
117 serial_low();
118 }
119 serial_delay();
120 }
121}
122
123// interrupt handle to be used by the slave device
124ISR(SERIAL_PIN_INTERRUPT) {
125 sync_send();
126
127 uint8_t checksum = 0;
128 for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
129 serial_write_byte(serial_slave_buffer[i]);
130 sync_send();
131 checksum += serial_slave_buffer[i];
132 }
133 serial_write_byte(checksum);
134 sync_send();
135
136 // wait for the sync to finish sending
137 serial_delay();
138
139 // read the middle of pulses
140 _delay_us(SERIAL_DELAY/2);
141
142 uint8_t checksum_computed = 0;
143 for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
144 serial_master_buffer[i] = serial_read_byte();
145 sync_send();
146 checksum_computed += serial_master_buffer[i];
147 }
148 uint8_t checksum_received = serial_read_byte();
149 sync_send();
150
151 serial_input(); // end transaction
152
153 if ( checksum_computed != checksum_received ) {
154 status |= SLAVE_DATA_CORRUPT;
155 } else {
156 status &= ~SLAVE_DATA_CORRUPT;
157 }
158}
159
160inline
161bool serial_slave_DATA_CORRUPT(void) {
162 return status & SLAVE_DATA_CORRUPT;
163}
164
165// Copies the serial_slave_buffer to the master and sends the
166// serial_master_buffer to the slave.
167//
168// Returns:
169// 0 => no error
170// 1 => slave did not respond
171int serial_update_buffers(void) {
172 // this code is very time dependent, so we need to disable interrupts
173 cli();
174
175 // signal to the slave that we want to start a transaction
176 serial_output();
177 serial_low();
178 _delay_us(1);
179
180 // wait for the slaves response
181 serial_input();
182 serial_high();
183 _delay_us(SERIAL_DELAY);
184
185 // check if the slave is present
186 if (serial_read_pin()) {
187 // slave failed to pull the line low, assume not present
188 sei();
189 return 1;
190 }
191
192 // if the slave is present syncronize with it
193 sync_recv();
194
195 uint8_t checksum_computed = 0;
196 // receive data from the slave
197 for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
198 serial_slave_buffer[i] = serial_read_byte();
199 sync_recv();
200 checksum_computed += serial_slave_buffer[i];
201 }
202 uint8_t checksum_received = serial_read_byte();
203 sync_recv();
204
205 if (checksum_computed != checksum_received) {
206 sei();
207 return 1;
208 }
209
210 uint8_t checksum = 0;
211 // send data to the slave
212 for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
213 serial_write_byte(serial_master_buffer[i]);
214 sync_recv();
215 checksum += serial_master_buffer[i];
216 }
217 serial_write_byte(checksum);
218 sync_recv();
219
220 // always, release the line when not in use
221 serial_output();
222 serial_high();
223
224 sei();
225 return 0;
226}
227
228#endif
diff --git a/keyboards/zen/serial.h b/keyboards/zen/serial.h
deleted file mode 100644
index 15fe4db7b..000000000
--- a/keyboards/zen/serial.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef MY_SERIAL_H
2#define MY_SERIAL_H
3
4#include "config.h"
5#include <stdbool.h>
6
7/* TODO: some defines for interrupt setup */
8#define SERIAL_PIN_DDR DDRD
9#define SERIAL_PIN_PORT PORTD
10#define SERIAL_PIN_INPUT PIND
11#define SERIAL_PIN_MASK _BV(PD0)
12#define SERIAL_PIN_INTERRUPT INT0_vect
13
14#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
15#define SERIAL_MASTER_BUFFER_LENGTH 1
16
17// Buffers for master - slave communication
18extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
19extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
20
21void serial_master_init(void);
22void serial_slave_init(void);
23int serial_update_buffers(void);
24bool serial_slave_data_corrupt(void);
25
26#endif
diff --git a/keyboards/zen/split_rgb.c b/keyboards/zen/split_rgb.c
deleted file mode 100644
index 6d7cb44cf..000000000
--- a/keyboards/zen/split_rgb.c
+++ /dev/null
@@ -1,41 +0,0 @@
1#include <stdint.h>
2#include <stdbool.h>
3#include "split_util.h"
4#include "progmem.h"
5#include "print.h"
6#include "rgblight.h"
7
8#ifdef USE_I2C
9# include "i2c.h"
10#else // USE_SERIAL
11# include "serial.h"
12#endif
13
14
15rgblight_config_t rgblight_config;
16
17void rgblight_slave_update(void) {
18 //rgblight_effect_christmas();
19}
20
21
22void rgblight_set(void) {
23 if (rgblight_config.enable) {
24 #ifdef RGBW
25 ws2812_setleds_rgbw(led, RGBLED_NUM);
26 #else
27 ws2812_setleds(led, RGBLED_NUM);
28 #endif
29 } else {
30 for (uint8_t i = 0; i < RGBLED_NUM; i++) {
31 led[i].r = 0;
32 led[i].g = 0;
33 led[i].b = 0;
34 }
35 #ifdef RGBW
36 ws2812_setleds_rgbw(led, RGBLED_NUM);
37 #else
38 ws2812_setleds(led, RGBLED_NUM);
39 #endif
40 }
41}
diff --git a/keyboards/zen/split_rgb.h b/keyboards/zen/split_rgb.h
deleted file mode 100644
index 5f552890a..000000000
--- a/keyboards/zen/split_rgb.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef SPLIT_RGB_H
2#define SPLIT_RGB_H
3
4void rgblight_slave_update(void);
5
6#endif
diff --git a/keyboards/zen/split_util.c b/keyboards/zen/split_util.c
deleted file mode 100644
index 346cbc908..000000000
--- a/keyboards/zen/split_util.c
+++ /dev/null
@@ -1,86 +0,0 @@
1#include <avr/io.h>
2#include <avr/wdt.h>
3#include <avr/power.h>
4#include <avr/interrupt.h>
5#include <util/delay.h>
6#include <avr/eeprom.h>
7#include "split_util.h"
8#include "matrix.h"
9#include "keyboard.h"
10#include "config.h"
11#include "timer.h"
12
13#ifdef USE_I2C
14# include "i2c.h"
15#else
16# include "serial.h"
17#endif
18
19volatile bool isLeftHand = true;
20
21static void setup_handedness(void) {
22 #ifdef EE_HANDS
23 isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
24 #else
25 // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c
26 #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
27 isLeftHand = !has_usb();
28 #else
29 isLeftHand = has_usb();
30 #endif
31 #endif
32}
33
34static void keyboard_master_setup(void) {
35#ifdef USE_I2C
36 i2c_master_init();
37#ifdef SSD1306OLED
38 matrix_master_OLED_init ();
39#endif
40#else
41 serial_master_init();
42#endif
43}
44
45static void keyboard_slave_setup(void) {
46 timer_init();
47#ifdef USE_I2C
48 i2c_slave_init(SLAVE_I2C_ADDRESS);
49#else
50 serial_slave_init();
51#endif
52}
53
54bool has_usb(void) {
55 USBCON |= (1 << OTGPADE); //enables VBUS pad
56 _delay_us(5);
57 return (USBSTA & (1<<VBUS)); //checks state of VBUS
58}
59
60void split_keyboard_setup(void) {
61 setup_handedness();
62
63 if (has_usb()) {
64 keyboard_master_setup();
65 } else {
66 keyboard_slave_setup();
67 }
68 sei();
69}
70
71void keyboard_slave_loop(void) {
72 matrix_init();
73
74 while (1) {
75 matrix_slave_scan();
76 }
77}
78
79// this code runs before the usb and keyboard is initialized
80void matrix_setup(void) {
81 split_keyboard_setup();
82
83 if (!has_usb()) {
84 keyboard_slave_loop();
85 }
86}
diff --git a/keyboards/zen/split_util.h b/keyboards/zen/split_util.h
deleted file mode 100644
index 595a0659e..000000000
--- a/keyboards/zen/split_util.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef SPLIT_KEYBOARD_UTIL_H
2#define SPLIT_KEYBOARD_UTIL_H
3
4#include <stdbool.h>
5#include "eeconfig.h"
6
7#define SLAVE_I2C_ADDRESS 0x32
8
9extern volatile bool isLeftHand;
10
11// slave version of matix scan, defined in matrix.c
12void matrix_slave_scan(void);
13
14void split_keyboard_setup(void);
15bool has_usb(void);
16void keyboard_slave_loop(void);
17
18void matrix_master_OLED_init (void);
19
20#endif
diff --git a/keyboards/zen/zen.h b/keyboards/zen/zen.h
index 56fc64fe2..cee7652d6 100644
--- a/keyboards/zen/zen.h
+++ b/keyboards/zen/zen.h
@@ -1,7 +1,8 @@
1#ifndef ZEN_H 1#pragma once
2#define ZEN_H
3
4#include "rev1.h"
5#include "quantum.h"
6 2
3#if KEYBOARD_zen_rev1
4 #include "rev1.h"
5#elif KEYBOARD_zen_rev2
6 #include "rev2.h"
7#endif 7#endif
8#include "quantum.h"