aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-06-26 18:52:09 +0100
committerDrashna Jaelre <drashna@live.com>2019-06-26 10:52:09 -0700
commit2a56b61a28dde9e8ab0a9afcd22f913f988b2a0e (patch)
tree8f11977cbcc28ce6d4e6fa99ce87ddc879cdfa72
parent01fb06af6c7d63a1338dc48d9a62e956ffcc6c3a (diff)
downloadqmk_firmware-2a56b61a28dde9e8ab0a9afcd22f913f988b2a0e.tar.gz
qmk_firmware-2a56b61a28dde9e8ab0a9afcd22f913f988b2a0e.zip
[Keyboard] Refactor of onekey to support multiple development boards (#6017)
* Initial refactor of onekey to support multiple development boards * Fixes to get teensy lc && 3.2 working * Add pin tables * Add caveats to Teensy boards * Correct bootloader for Elite-C
-rw-r--r--keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.c56
-rw-r--r--keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.h166
-rw-r--r--keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.mk5
-rw-r--r--keyboards/handwired/onekey/bluepill/bootloader_defs.h10
-rw-r--r--keyboards/handwired/onekey/bluepill/chconf.h524
-rw-r--r--keyboards/handwired/onekey/bluepill/config.h23
-rw-r--r--keyboards/handwired/onekey/bluepill/halconf.h353
-rw-r--r--keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld88
-rw-r--r--keyboards/handwired/onekey/bluepill/mcuconf.h209
-rw-r--r--keyboards/handwired/onekey/bluepill/readme.md3
-rw-r--r--keyboards/handwired/onekey/bluepill/rules.mk37
-rw-r--r--keyboards/handwired/onekey/config.h13
-rw-r--r--keyboards/handwired/onekey/elite_c/config.h23
-rw-r--r--keyboards/handwired/onekey/elite_c/readme.md3
-rw-r--r--keyboards/handwired/onekey/elite_c/rules.mk58
-rw-r--r--keyboards/handwired/onekey/onekey.h21
-rw-r--r--keyboards/handwired/onekey/promicro/config.h23
-rw-r--r--keyboards/handwired/onekey/promicro/readme.md3
-rw-r--r--keyboards/handwired/onekey/promicro/rules.mk58
-rw-r--r--keyboards/handwired/onekey/proton_c/config.h23
-rw-r--r--keyboards/handwired/onekey/proton_c/readme.md3
-rw-r--r--keyboards/handwired/onekey/proton_c/rules.mk2
-rw-r--r--keyboards/handwired/onekey/readme.md6
-rw-r--r--keyboards/handwired/onekey/rules.mk79
-rw-r--r--keyboards/handwired/onekey/teensy_2/config.h23
-rw-r--r--keyboards/handwired/onekey/teensy_2/readme.md3
-rw-r--r--keyboards/handwired/onekey/teensy_2/rules.mk58
-rw-r--r--keyboards/handwired/onekey/teensy_2pp/config.h23
-rw-r--r--keyboards/handwired/onekey/teensy_2pp/readme.md3
-rw-r--r--keyboards/handwired/onekey/teensy_2pp/rules.mk58
-rw-r--r--keyboards/handwired/onekey/teensy_32/chconf.h524
-rw-r--r--keyboards/handwired/onekey/teensy_32/config.h24
-rw-r--r--keyboards/handwired/onekey/teensy_32/halconf.h354
-rw-r--r--keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld101
-rw-r--r--keyboards/handwired/onekey/teensy_32/mcuconf.h45
-rw-r--r--keyboards/handwired/onekey/teensy_32/readme.md40
-rw-r--r--keyboards/handwired/onekey/teensy_32/rules.mk41
-rw-r--r--keyboards/handwired/onekey/teensy_lc/chconf.h524
-rw-r--r--keyboards/handwired/onekey/teensy_lc/config.h24
-rw-r--r--keyboards/handwired/onekey/teensy_lc/halconf.h354
-rw-r--r--keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld105
-rw-r--r--keyboards/handwired/onekey/teensy_lc/mcuconf.h45
-rw-r--r--keyboards/handwired/onekey/teensy_lc/readme.md40
-rw-r--r--keyboards/handwired/onekey/teensy_lc/rules.mk41
44 files changed, 4142 insertions, 77 deletions
diff --git a/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.c b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.c
new file mode 100644
index 000000000..8c5a87f35
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.c
@@ -0,0 +1,56 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#include "hal.h"
18
19// Value to place in RTC backup register 10 for persistent bootloader mode
20#define RTC_BOOTLOADER_FLAG 0x424C
21
22/**
23 * @brief PAL setup.
24 * @details Digital I/O ports static configuration as defined in @p board.h.
25 * This variable is used by the HAL when initializing the PAL driver.
26 */
27#if HAL_USE_PAL || defined(__DOXYGEN__)
28const PALConfig pal_default_config =
29{
30 {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH},
31 {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH},
32 {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH},
33 {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH},
34 {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH},
35};
36#endif
37
38/*
39 * Early initialization code.
40 * This initialization must be performed just after stack setup and before
41 * any other initialization.
42 */
43void __early_init(void) {
44
45 stm32_clock_init();
46}
47
48/*
49 * Board-specific initialization code.
50 */
51void boardInit(void) {
52 //JTAG-DP Disabled and SW-DP Enabled
53 AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
54 //Set backup register DR10 to enter bootloader on reset
55 BKP->DR10 = RTC_BOOTLOADER_FLAG;
56}
diff --git a/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.h b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.h
new file mode 100644
index 000000000..9427adabf
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.h
@@ -0,0 +1,166 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _BOARD_H_
18#define _BOARD_H_
19
20/*
21 * Setup for a Generic STM32F103 board.
22 */
23
24/*
25 * Board identifier.
26 */
27#define BOARD_GENERIC_STM32_F103
28#define BOARD_NAME "Generic STM32F103x board"
29
30/*
31 * Board frequencies.
32 */
33#define STM32_LSECLK 32768
34#define STM32_HSECLK 8000000
35
36/*
37 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
38 */
39#define STM32F103xB
40
41/*
42 * IO pins assignments
43 */
44
45/* on-board */
46
47#define GPIOA_LED 8
48#define GPIOD_OSC_IN 0
49#define GPIOD_OSC_OUT 1
50
51/* In case your board has a "USB enable" hardware
52 controlled by a pin, define it here. (It could be just
53 a 1.5k resistor connected to D+ line.)
54*/
55/*
56#define GPIOB_USB_DISC 10
57*/
58
59/*
60 * I/O ports initial setup, this configuration is established soon after reset
61 * in the initialization code.
62 *
63 * The digits have the following meaning:
64 * 0 - Analog input.
65 * 1 - Push Pull output 10MHz.
66 * 2 - Push Pull output 2MHz.
67 * 3 - Push Pull output 50MHz.
68 * 4 - Digital input.
69 * 5 - Open Drain output 10MHz.
70 * 6 - Open Drain output 2MHz.
71 * 7 - Open Drain output 50MHz.
72 * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
73 * 9 - Alternate Push Pull output 10MHz.
74 * A - Alternate Push Pull output 2MHz.
75 * B - Alternate Push Pull output 50MHz.
76 * C - Reserved.
77 * D - Alternate Open Drain output 10MHz.
78 * E - Alternate Open Drain output 2MHz.
79 * F - Alternate Open Drain output 50MHz.
80 * Please refer to the STM32 Reference Manual for details.
81 */
82
83/*
84 * Port A setup.
85 * Everything input with pull-up except:
86 * PA2 - Alternate output (USART2 TX).
87 * PA3 - Normal input (USART2 RX).
88 * PA9 - Alternate output (USART1 TX).
89 * PA10 - Normal input (USART1 RX).
90 */
91#define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */
92#define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */
93#define VAL_GPIOAODR 0xFFFFFFFF
94
95/*
96 * Port B setup.
97 * Everything input with pull-up except:
98 * PB10 - Push Pull output (USB switch).
99 */
100#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
101#define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */
102#define VAL_GPIOBODR 0xFFFFFFFF
103
104/*
105 * Port C setup.
106 * Everything input with pull-up except:
107 * PC13 - Push Pull output (LED).
108 */
109#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
110#define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */
111#define VAL_GPIOCODR 0xFFFFFFFF
112
113/*
114 * Port D setup.
115 * Everything input with pull-up except:
116 * PD0 - Normal input (XTAL).
117 * PD1 - Normal input (XTAL).
118 */
119#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
120#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
121#define VAL_GPIODODR 0xFFFFFFFF
122
123/*
124 * Port E setup.
125 * Everything input with pull-up except:
126 */
127#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
128#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
129#define VAL_GPIOEODR 0xFFFFFFFF
130
131/*
132 * USB bus activation macro, required by the USB driver.
133 */
134/* The point is that most of the generic STM32F103* boards
135 have a 1.5k resistor connected on one end to the D+ line
136 and on the other end to some pin. Or even a slightly more
137 complicated "USB enable" circuit, controlled by a pin.
138 That should go here.
139
140 However on some boards (e.g. one that I have), there's no
141 such hardware. In which case it's better to not do anything.
142*/
143/*
144#define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC)
145*/
146#define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT);
147
148/*
149 * USB bus de-activation macro, required by the USB driver.
150 */
151/*
152#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC)
153*/
154#define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12);
155
156#if !defined(_FROM_ASM_)
157#ifdef __cplusplus
158extern "C" {
159#endif
160 void boardInit(void);
161#ifdef __cplusplus
162}
163#endif
164#endif /* _FROM_ASM_ */
165
166#endif /* _BOARD_H_ */
diff --git a/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.mk b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.mk
new file mode 100644
index 000000000..6b8b312fd
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/boards/GENERIC_STM32_F103/board.mk
@@ -0,0 +1,5 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/boards/GENERIC_STM32_F103/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/boards/GENERIC_STM32_F103
diff --git a/keyboards/handwired/onekey/bluepill/bootloader_defs.h b/keyboards/handwired/onekey/bluepill/bootloader_defs.h
new file mode 100644
index 000000000..6b8fa9f72
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/bootloader_defs.h
@@ -0,0 +1,10 @@
1/* Address for jumping to bootloader on STM32 chips. */
2/* It is chip dependent, the correct number can be looked up here (page 175):
3 * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
4 * This also requires a patch to chibios:
5 * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
6 */
7
8// STM32F103* does NOT have an USB bootloader in ROM (only serial),
9// so setting anything here does not make much sense
10#define STM32_BOOTLOADER_ADDRESS 0x80000000
diff --git a/keyboards/handwired/onekey/bluepill/chconf.h b/keyboards/handwired/onekey/bluepill/chconf.h
new file mode 100644
index 000000000..bbd9b2da6
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/chconf.h
@@ -0,0 +1,524 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32
33/*===========================================================================*/
34/**
35 * @name System timers settings
36 * @{
37 */
38/*===========================================================================*/
39
40/**
41 * @brief System time counter resolution.
42 * @note Allowed values are 16 or 32 bits.
43 */
44#define CH_CFG_ST_RESOLUTION 32
45
46/**
47 * @brief System tick frequency.
48 * @details Frequency of the system timer that drives the system ticks. This
49 * setting also defines the system tick time unit.
50 */
51#define CH_CFG_ST_FREQUENCY 100000
52
53/**
54 * @brief Time delta constant for the tick-less mode.
55 * @note If this value is zero then the system uses the classic
56 * periodic tick. This value represents the minimum number
57 * of ticks that is safe to specify in a timeout directive.
58 * The value one is not valid, timeouts are rounded up to
59 * this value.
60 */
61#define CH_CFG_ST_TIMEDELTA 0
62
63/** @} */
64
65/*===========================================================================*/
66/**
67 * @name Kernel parameters and options
68 * @{
69 */
70/*===========================================================================*/
71
72/**
73 * @brief Round robin interval.
74 * @details This constant is the number of system ticks allowed for the
75 * threads before preemption occurs. Setting this value to zero
76 * disables the preemption for threads with equal priority and the
77 * round robin becomes cooperative. Note that higher priority
78 * threads can still preempt, the kernel is always preemptive.
79 * @note Disabling the round robin preemption makes the kernel more compact
80 * and generally faster.
81 * @note The round robin preemption is not supported in tickless mode and
82 * must be set to zero in that case.
83 */
84#define CH_CFG_TIME_QUANTUM 0
85
86/**
87 * @brief Managed RAM size.
88 * @details Size of the RAM area to be managed by the OS. If set to zero
89 * then the whole available RAM is used. The core memory is made
90 * available to the heap allocator and/or can be used directly through
91 * the simplified core memory allocator.
92 *
93 * @note In order to let the OS manage the whole RAM the linker script must
94 * provide the @p __heap_base__ and @p __heap_end__ symbols.
95 * @note Requires @p CH_CFG_USE_MEMCORE.
96 */
97#define CH_CFG_MEMCORE_SIZE 0
98
99/**
100 * @brief Idle thread automatic spawn suppression.
101 * @details When this option is activated the function @p chSysInit()
102 * does not spawn the idle thread. The application @p main()
103 * function becomes the idle thread and must implement an
104 * infinite loop.
105 */
106#define CH_CFG_NO_IDLE_THREAD FALSE
107
108/* Use __WFI in the idle thread for waiting. Does lower the power
109 * consumption. */
110#define CORTEX_ENABLE_WFI_IDLE TRUE
111
112/** @} */
113
114/*===========================================================================*/
115/**
116 * @name Performance options
117 * @{
118 */
119/*===========================================================================*/
120
121/**
122 * @brief OS optimization.
123 * @details If enabled then time efficient rather than space efficient code
124 * is used when two possible implementations exist.
125 *
126 * @note This is not related to the compiler optimization options.
127 * @note The default is @p TRUE.
128 */
129#define CH_CFG_OPTIMIZE_SPEED TRUE
130
131/** @} */
132
133/*===========================================================================*/
134/**
135 * @name Subsystem options
136 * @{
137 */
138/*===========================================================================*/
139
140/**
141 * @brief Time Measurement APIs.
142 * @details If enabled then the time measurement APIs are included in
143 * the kernel.
144 *
145 * @note The default is @p TRUE.
146 */
147#define CH_CFG_USE_TM FALSE
148
149/**
150 * @brief Threads registry APIs.
151 * @details If enabled then the registry APIs are included in the kernel.
152 *
153 * @note The default is @p TRUE.
154 */
155#define CH_CFG_USE_REGISTRY TRUE
156
157/**
158 * @brief Threads synchronization APIs.
159 * @details If enabled then the @p chThdWait() function is included in
160 * the kernel.
161 *
162 * @note The default is @p TRUE.
163 */
164#define CH_CFG_USE_WAITEXIT TRUE
165
166/**
167 * @brief Semaphores APIs.
168 * @details If enabled then the Semaphores APIs are included in the kernel.
169 *
170 * @note The default is @p TRUE.
171 */
172#define CH_CFG_USE_SEMAPHORES TRUE
173
174/**
175 * @brief Semaphores queuing mode.
176 * @details If enabled then the threads are enqueued on semaphores by
177 * priority rather than in FIFO order.
178 *
179 * @note The default is @p FALSE. Enable this if you have special
180 * requirements.
181 * @note Requires @p CH_CFG_USE_SEMAPHORES.
182 */
183#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
184
185/**
186 * @brief Mutexes APIs.
187 * @details If enabled then the mutexes APIs are included in the kernel.
188 *
189 * @note The default is @p TRUE.
190 */
191#define CH_CFG_USE_MUTEXES TRUE
192
193/**
194 * @brief Enables recursive behavior on mutexes.
195 * @note Recursive mutexes are heavier and have an increased
196 * memory footprint.
197 *
198 * @note The default is @p FALSE.
199 * @note Requires @p CH_CFG_USE_MUTEXES.
200 */
201#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
202
203/**
204 * @brief Conditional Variables APIs.
205 * @details If enabled then the conditional variables APIs are included
206 * in the kernel.
207 *
208 * @note The default is @p TRUE.
209 * @note Requires @p CH_CFG_USE_MUTEXES.
210 */
211#define CH_CFG_USE_CONDVARS TRUE
212
213/**
214 * @brief Conditional Variables APIs with timeout.
215 * @details If enabled then the conditional variables APIs with timeout
216 * specification are included in the kernel.
217 *
218 * @note The default is @p TRUE.
219 * @note Requires @p CH_CFG_USE_CONDVARS.
220 */
221#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
222
223/**
224 * @brief Events Flags APIs.
225 * @details If enabled then the event flags APIs are included in the kernel.
226 *
227 * @note The default is @p TRUE.
228 */
229#define CH_CFG_USE_EVENTS TRUE
230
231/**
232 * @brief Events Flags APIs with timeout.
233 * @details If enabled then the events APIs with timeout specification
234 * are included in the kernel.
235 *
236 * @note The default is @p TRUE.
237 * @note Requires @p CH_CFG_USE_EVENTS.
238 */
239#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
240
241/**
242 * @brief Synchronous Messages APIs.
243 * @details If enabled then the synchronous messages APIs are included
244 * in the kernel.
245 *
246 * @note The default is @p TRUE.
247 */
248#define CH_CFG_USE_MESSAGES TRUE
249
250/**
251 * @brief Synchronous Messages queuing mode.
252 * @details If enabled then messages are served by priority rather than in
253 * FIFO order.
254 *
255 * @note The default is @p FALSE. Enable this if you have special
256 * requirements.
257 * @note Requires @p CH_CFG_USE_MESSAGES.
258 */
259#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
260
261/**
262 * @brief Mailboxes APIs.
263 * @details If enabled then the asynchronous messages (mailboxes) APIs are
264 * included in the kernel.
265 *
266 * @note The default is @p TRUE.
267 * @note Requires @p CH_CFG_USE_SEMAPHORES.
268 */
269#define CH_CFG_USE_MAILBOXES TRUE
270
271/**
272 * @brief Core Memory Manager APIs.
273 * @details If enabled then the core memory manager APIs are included
274 * in the kernel.
275 *
276 * @note The default is @p TRUE.
277 */
278#define CH_CFG_USE_MEMCORE TRUE
279
280/**
281 * @brief Heap Allocator APIs.
282 * @details If enabled then the memory heap allocator APIs are included
283 * in the kernel.
284 *
285 * @note The default is @p TRUE.
286 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
287 * @p CH_CFG_USE_SEMAPHORES.
288 * @note Mutexes are recommended.
289 */
290#define CH_CFG_USE_HEAP TRUE
291
292/**
293 * @brief Memory Pools Allocator APIs.
294 * @details If enabled then the memory pools allocator APIs are included
295 * in the kernel.
296 *
297 * @note The default is @p TRUE.
298 */
299#define CH_CFG_USE_MEMPOOLS FALSE
300
301/**
302 * @brief Dynamic Threads APIs.
303 * @details If enabled then the dynamic threads creation APIs are included
304 * in the kernel.
305 *
306 * @note The default is @p TRUE.
307 * @note Requires @p CH_CFG_USE_WAITEXIT.
308 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
309 */
310#define CH_CFG_USE_DYNAMIC FALSE
311
312/** @} */
313
314/*===========================================================================*/
315/**
316 * @name Debug options
317 * @{
318 */
319/*===========================================================================*/
320
321/**
322 * @brief Debug option, kernel statistics.
323 *
324 * @note The default is @p FALSE.
325 */
326#define CH_DBG_STATISTICS FALSE
327
328/**
329 * @brief Debug option, system state check.
330 * @details If enabled the correct call protocol for system APIs is checked
331 * at runtime.
332 *
333 * @note The default is @p FALSE.
334 */
335#define CH_DBG_SYSTEM_STATE_CHECK FALSE
336
337/**
338 * @brief Debug option, parameters checks.
339 * @details If enabled then the checks on the API functions input
340 * parameters are activated.
341 *
342 * @note The default is @p FALSE.
343 */
344#define CH_DBG_ENABLE_CHECKS FALSE
345
346/**
347 * @brief Debug option, consistency checks.
348 * @details If enabled then all the assertions in the kernel code are
349 * activated. This includes consistency checks inside the kernel,
350 * runtime anomalies and port-defined checks.
351 *
352 * @note The default is @p FALSE.
353 */
354#define CH_DBG_ENABLE_ASSERTS FALSE
355
356/**
357 * @brief Debug option, trace buffer.
358 * @details If enabled then the trace buffer is activated.
359 *
360 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
361 */
362#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
363
364/**
365 * @brief Trace buffer entries.
366 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
367 * different from @p CH_DBG_TRACE_MASK_DISABLED.
368 */
369#define CH_DBG_TRACE_BUFFER_SIZE 128
370
371/**
372 * @brief Debug option, stack checks.
373 * @details If enabled then a runtime stack check is performed.
374 *
375 * @note The default is @p FALSE.
376 * @note The stack check is performed in a architecture/port dependent way.
377 * It may not be implemented or some ports.
378 * @note The default failure mode is to halt the system with the global
379 * @p panic_msg variable set to @p NULL.
380 */
381#define CH_DBG_ENABLE_STACK_CHECK FALSE
382
383/**
384 * @brief Debug option, stacks initialization.
385 * @details If enabled then the threads working area is filled with a byte
386 * value when a thread is created. This can be useful for the
387 * runtime measurement of the used stack.
388 *
389 * @note The default is @p FALSE.
390 */
391#define CH_DBG_FILL_THREADS FALSE
392
393/**
394 * @brief Debug option, threads profiling.
395 * @details If enabled then a field is added to the @p thread_t structure that
396 * counts the system ticks occurred while executing the thread.
397 *
398 * @note The default is @p FALSE.
399 * @note This debug option is not currently compatible with the
400 * tickless mode.
401 */
402#define CH_DBG_THREADS_PROFILING FALSE
403
404/** @} */
405
406/*===========================================================================*/
407/**
408 * @name Kernel hooks
409 * @{
410 */
411/*===========================================================================*/
412
413/**
414 * @brief Threads descriptor structure extension.
415 * @details User fields added to the end of the @p thread_t structure.
416 */
417#define CH_CFG_THREAD_EXTRA_FIELDS \
418 /* Add threads custom fields here.*/
419
420/**
421 * @brief Threads initialization hook.
422 * @details User initialization code added to the @p chThdInit() API.
423 *
424 * @note It is invoked from within @p chThdInit() and implicitly from all
425 * the threads creation APIs.
426 */
427#define CH_CFG_THREAD_INIT_HOOK(tp) { \
428 /* Add threads initialization code here.*/ \
429}
430
431/**
432 * @brief Threads finalization hook.
433 * @details User finalization code added to the @p chThdExit() API.
434 */
435#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
436 /* Add threads finalization code here.*/ \
437}
438
439/**
440 * @brief Context switch hook.
441 * @details This hook is invoked just before switching between threads.
442 */
443#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
444 /* Context switch code here.*/ \
445}
446
447/**
448 * @brief ISR enter hook.
449 */
450#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
451 /* IRQ prologue code here.*/ \
452}
453
454/**
455 * @brief ISR exit hook.
456 */
457#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
458 /* IRQ epilogue code here.*/ \
459}
460
461/**
462 * @brief Idle thread enter hook.
463 * @note This hook is invoked within a critical zone, no OS functions
464 * should be invoked from here.
465 * @note This macro can be used to activate a power saving mode.
466 */
467#define CH_CFG_IDLE_ENTER_HOOK() { \
468 /* Idle-enter code here.*/ \
469}
470
471/**
472 * @brief Idle thread leave hook.
473 * @note This hook is invoked within a critical zone, no OS functions
474 * should be invoked from here.
475 * @note This macro can be used to deactivate a power saving mode.
476 */
477#define CH_CFG_IDLE_LEAVE_HOOK() { \
478 /* Idle-leave code here.*/ \
479}
480
481/**
482 * @brief Idle Loop hook.
483 * @details This hook is continuously invoked by the idle thread loop.
484 */
485#define CH_CFG_IDLE_LOOP_HOOK() { \
486 /* Idle loop code here.*/ \
487}
488
489/**
490 * @brief System tick event hook.
491 * @details This hook is invoked in the system tick handler immediately
492 * after processing the virtual timers queue.
493 */
494#define CH_CFG_SYSTEM_TICK_HOOK() { \
495 /* System tick event code here.*/ \
496}
497
498/**
499 * @brief System halt hook.
500 * @details This hook is invoked in case to a system halting error before
501 * the system is halted.
502 */
503#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
504 /* System halt code here.*/ \
505}
506
507/**
508 * @brief Trace hook.
509 * @details This hook is invoked each time a new record is written in the
510 * trace buffer.
511 */
512#define CH_CFG_TRACE_HOOK(tep) { \
513 /* Trace code here.*/ \
514}
515
516/** @} */
517
518/*===========================================================================*/
519/* Port-specific settings (override port settings defaulted in chcore.h). */
520/*===========================================================================*/
521
522#endif /* CHCONF_H */
523
524/** @} */
diff --git a/keyboards/handwired/onekey/bluepill/config.h b/keyboards/handwired/onekey/bluepill/config.h
new file mode 100644
index 000000000..3d88ee00e
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { B0 }
22#define MATRIX_ROW_PINS { A7 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/bluepill/halconf.h b/keyboards/handwired/onekey/bluepill/halconf.h
new file mode 100644
index 000000000..72879a575
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/halconf.h
@@ -0,0 +1,353 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/halconf.h
19 * @brief HAL configuration header.
20 * @details HAL configuration file, this file allows to enable or disable the
21 * various device drivers from your application. You may also use
22 * this file in order to override the device drivers default settings.
23 *
24 * @addtogroup HAL_CONF
25 * @{
26 */
27
28#ifndef _HALCONF_H_
29#define _HALCONF_H_
30
31#include "mcuconf.h"
32
33/**
34 * @brief Enables the PAL subsystem.
35 */
36#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
37#define HAL_USE_PAL TRUE
38#endif
39
40/**
41 * @brief Enables the ADC subsystem.
42 */
43#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
44#define HAL_USE_ADC FALSE
45#endif
46
47/**
48 * @brief Enables the CAN subsystem.
49 */
50#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
51#define HAL_USE_CAN FALSE
52#endif
53
54/**
55 * @brief Enables the DAC subsystem.
56 */
57#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
58#define HAL_USE_DAC FALSE
59#endif
60
61/**
62 * @brief Enables the EXT subsystem.
63 */
64#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
65#define HAL_USE_EXT FALSE
66#endif
67
68/**
69 * @brief Enables the GPT subsystem.
70 */
71#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
72#define HAL_USE_GPT FALSE
73#endif
74
75/**
76 * @brief Enables the I2C subsystem.
77 */
78#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79#define HAL_USE_I2C FALSE
80#endif
81
82/**
83 * @brief Enables the I2S subsystem.
84 */
85#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
86#define HAL_USE_I2S FALSE
87#endif
88
89/**
90 * @brief Enables the ICU subsystem.
91 */
92#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
93#define HAL_USE_ICU FALSE
94#endif
95
96/**
97 * @brief Enables the MAC subsystem.
98 */
99#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
100#define HAL_USE_MAC FALSE
101#endif
102
103/**
104 * @brief Enables the MMC_SPI subsystem.
105 */
106#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
107#define HAL_USE_MMC_SPI FALSE
108#endif
109
110/**
111 * @brief Enables the PWM subsystem.
112 */
113#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114#define HAL_USE_PWM TRUE
115#endif
116
117/**
118 * @brief Enables the RTC subsystem.
119 */
120#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
121#define HAL_USE_RTC FALSE
122#endif
123
124/**
125 * @brief Enables the SDC subsystem.
126 */
127#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
128#define HAL_USE_SDC FALSE
129#endif
130
131/**
132 * @brief Enables the SERIAL subsystem.
133 */
134#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
135#define HAL_USE_SERIAL FALSE
136#endif
137
138/**
139 * @brief Enables the SERIAL over USB subsystem.
140 */
141#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
142#define HAL_USE_SERIAL_USB FALSE
143#endif
144
145/**
146 * @brief Enables the SPI subsystem.
147 */
148#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
149#define HAL_USE_SPI TRUE
150#endif
151
152/**
153 * @brief Enables the UART subsystem.
154 */
155#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
156#define HAL_USE_UART FALSE
157#endif
158
159/**
160 * @brief Enables the USB subsystem.
161 */
162#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
163#define HAL_USE_USB TRUE
164#endif
165
166/**
167 * @brief Enables the WDG subsystem.
168 */
169#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
170#define HAL_USE_WDG FALSE
171#endif
172
173/*===========================================================================*/
174/* ADC driver related settings. */
175/*===========================================================================*/
176
177/**
178 * @brief Enables synchronous APIs.
179 * @note Disabling this option saves both code and data space.
180 */
181#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
182#define ADC_USE_WAIT TRUE
183#endif
184
185/**
186 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
187 * @note Disabling this option saves both code and data space.
188 */
189#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
190#define ADC_USE_MUTUAL_EXCLUSION TRUE
191#endif
192
193/*===========================================================================*/
194/* CAN driver related settings. */
195/*===========================================================================*/
196
197/**
198 * @brief Sleep mode related APIs inclusion switch.
199 */
200#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
201#define CAN_USE_SLEEP_MODE TRUE
202#endif
203
204/*===========================================================================*/
205/* I2C driver related settings. */
206/*===========================================================================*/
207
208/**
209 * @brief Enables the mutual exclusion APIs on the I2C bus.
210 */
211#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
212#define I2C_USE_MUTUAL_EXCLUSION TRUE
213#endif
214
215/*===========================================================================*/
216/* MAC driver related settings. */
217/*===========================================================================*/
218
219/**
220 * @brief Enables an event sources for incoming packets.
221 */
222#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
223#define MAC_USE_ZERO_COPY FALSE
224#endif
225
226/**
227 * @brief Enables an event sources for incoming packets.
228 */
229#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
230#define MAC_USE_EVENTS TRUE
231#endif
232
233/*===========================================================================*/
234/* MMC_SPI driver related settings. */
235/*===========================================================================*/
236
237/**
238 * @brief Delays insertions.
239 * @details If enabled this options inserts delays into the MMC waiting
240 * routines releasing some extra CPU time for the threads with
241 * lower priority, this may slow down the driver a bit however.
242 * This option is recommended also if the SPI driver does not
243 * use a DMA channel and heavily loads the CPU.
244 */
245#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
246#define MMC_NICE_WAITING TRUE
247#endif
248
249/*===========================================================================*/
250/* SDC driver related settings. */
251/*===========================================================================*/
252
253/**
254 * @brief Number of initialization attempts before rejecting the card.
255 * @note Attempts are performed at 10mS intervals.
256 */
257#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
258#define SDC_INIT_RETRY 100
259#endif
260
261/**
262 * @brief Include support for MMC cards.
263 * @note MMC support is not yet implemented so this option must be kept
264 * at @p FALSE.
265 */
266#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
267#define SDC_MMC_SUPPORT FALSE
268#endif
269
270/**
271 * @brief Delays insertions.
272 * @details If enabled this options inserts delays into the MMC waiting
273 * routines releasing some extra CPU time for the threads with
274 * lower priority, this may slow down the driver a bit however.
275 */
276#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
277#define SDC_NICE_WAITING TRUE
278#endif
279
280/*===========================================================================*/
281/* SERIAL driver related settings. */
282/*===========================================================================*/
283
284/**
285 * @brief Default bit rate.
286 * @details Configuration parameter, this is the baud rate selected for the
287 * default configuration.
288 */
289#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
290#define SERIAL_DEFAULT_BITRATE 38400
291#endif
292
293/**
294 * @brief Serial buffers size.
295 * @details Configuration parameter, you can change the depth of the queue
296 * buffers depending on the requirements of your application.
297 * @note The default is 64 bytes for both the transmission and receive
298 * buffers.
299 */
300#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
301#define SERIAL_BUFFERS_SIZE 16
302#endif
303
304/*===========================================================================*/
305/* SERIAL_USB driver related setting. */
306/*===========================================================================*/
307
308/**
309 * @brief Serial over USB buffers size.
310 * @details Configuration parameter, the buffer size must be a multiple of
311 * the USB data endpoint maximum packet size.
312 * @note The default is 64 bytes for both the transmission and receive
313 * buffers.
314 */
315#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
316#define SERIAL_USB_BUFFERS_SIZE 1
317#endif
318
319/*===========================================================================*/
320/* SPI driver related settings. */
321/*===========================================================================*/
322
323/**
324 * @brief Enables synchronous APIs.
325 * @note Disabling this option saves both code and data space.
326 */
327#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
328#define SPI_USE_WAIT TRUE
329#endif
330
331/**
332 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
333 * @note Disabling this option saves both code and data space.
334 */
335#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
336#define SPI_USE_MUTUAL_EXCLUSION TRUE
337#endif
338
339/*===========================================================================*/
340/* USB driver related settings. */
341/*===========================================================================*/
342
343/**
344 * @brief Enables synchronous APIs.
345 * @note Disabling this option saves both code and data space.
346 */
347#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
348#define USB_USE_WAIT TRUE
349#endif
350
351#endif /* _HALCONF_H_ */
352
353/** @} */
diff --git a/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld b/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld
new file mode 100644
index 000000000..d0688ef60
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/ld/STM32F103x8_stm32duino_bootloader.ld
@@ -0,0 +1,88 @@
1/*
2 ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/*
18 * ST32F103xB memory setup for use with the maplemini bootloader.
19 * You will have to
20 * #define CORTEX_VTOR_INIT 0x5000
21 * in your projects chconf.h
22 */
23MEMORY
24{
25 flash0 : org = 0x08002000, len = 64k - 0x2000
26 flash1 : org = 0x00000000, len = 0
27 flash2 : org = 0x00000000, len = 0
28 flash3 : org = 0x00000000, len = 0
29 flash4 : org = 0x00000000, len = 0
30 flash5 : org = 0x00000000, len = 0
31 flash6 : org = 0x00000000, len = 0
32 flash7 : org = 0x00000000, len = 0
33 ram0 : org = 0x20000000, len = 20k
34 ram1 : org = 0x00000000, len = 0
35 ram2 : org = 0x00000000, len = 0
36 ram3 : org = 0x00000000, len = 0
37 ram4 : org = 0x00000000, len = 0
38 ram5 : org = 0x00000000, len = 0
39 ram6 : org = 0x00000000, len = 0
40 ram7 : org = 0x00000000, len = 0
41}
42
43/* For each data/text section two region are defined, a virtual region
44 and a load region (_LMA suffix).*/
45
46/* Flash region to be used for exception vectors.*/
47REGION_ALIAS("VECTORS_FLASH", flash0);
48REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
49
50/* Flash region to be used for constructors and destructors.*/
51REGION_ALIAS("XTORS_FLASH", flash0);
52REGION_ALIAS("XTORS_FLASH_LMA", flash0);
53
54/* Flash region to be used for code text.*/
55REGION_ALIAS("TEXT_FLASH", flash0);
56REGION_ALIAS("TEXT_FLASH_LMA", flash0);
57
58/* Flash region to be used for read only data.*/
59REGION_ALIAS("RODATA_FLASH", flash0);
60REGION_ALIAS("RODATA_FLASH_LMA", flash0);
61
62/* Flash region to be used for various.*/
63REGION_ALIAS("VARIOUS_FLASH", flash0);
64REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
65
66/* Flash region to be used for RAM(n) initialization data.*/
67REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
68
69/* RAM region to be used for Main stack. This stack accommodates the processing
70 of all exceptions and interrupts.*/
71REGION_ALIAS("MAIN_STACK_RAM", ram0);
72
73/* RAM region to be used for the process stack. This is the stack used by
74 the main() function.*/
75REGION_ALIAS("PROCESS_STACK_RAM", ram0);
76
77/* RAM region to be used for data segment.*/
78REGION_ALIAS("DATA_RAM", ram0);
79REGION_ALIAS("DATA_RAM_LMA", flash0);
80
81/* RAM region to be used for BSS segment.*/
82REGION_ALIAS("BSS_RAM", ram0);
83
84/* RAM region to be used for the default heap.*/
85REGION_ALIAS("HEAP_RAM", ram0);
86
87/* Generic rules inclusion.*/
88INCLUDE rules.ld
diff --git a/keyboards/handwired/onekey/bluepill/mcuconf.h b/keyboards/handwired/onekey/bluepill/mcuconf.h
new file mode 100644
index 000000000..fced27289
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/mcuconf.h
@@ -0,0 +1,209 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _MCUCONF_H_
18#define _MCUCONF_H_
19
20#define STM32F103_MCUCONF
21
22/*
23 * STM32F103 drivers configuration.
24 * The following settings override the default settings present in
25 * the various device driver implementation headers.
26 * Note that the settings for each driver only have effect if the whole
27 * driver is enabled in halconf.h.
28 *
29 * IRQ priorities:
30 * 15...0 Lowest...Highest.
31 *
32 * DMA priorities:
33 * 0...3 Lowest...Highest.
34 */
35
36/*
37 * HAL driver system settings.
38 */
39#define STM32_NO_INIT FALSE
40#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED FALSE
42#define STM32_HSE_ENABLED TRUE
43#define STM32_LSE_ENABLED FALSE
44#define STM32_SW STM32_SW_PLL
45#define STM32_PLLSRC STM32_PLLSRC_HSE
46#define STM32_PLLXTPRE STM32_PLLXTPRE_DIV1
47#define STM32_PLLMUL_VALUE 9
48#define STM32_HPRE STM32_HPRE_DIV1
49#define STM32_PPRE1 STM32_PPRE1_DIV2
50#define STM32_PPRE2 STM32_PPRE2_DIV2
51#define STM32_ADCPRE STM32_ADCPRE_DIV4
52#define STM32_USB_CLOCK_REQUIRED TRUE
53#define STM32_USBPRE STM32_USBPRE_DIV1P5
54#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
55#define STM32_RTCSEL STM32_RTCSEL_HSEDIV
56#define STM32_PVD_ENABLE FALSE
57#define STM32_PLS STM32_PLS_LEV0
58
59/*
60 * ADC driver system settings.
61 */
62#define STM32_ADC_USE_ADC1 FALSE
63#define STM32_ADC_ADC1_DMA_PRIORITY 2
64#define STM32_ADC_ADC1_IRQ_PRIORITY 6
65
66/*
67 * CAN driver system settings.
68 */
69#define STM32_CAN_USE_CAN1 FALSE
70#define STM32_CAN_CAN1_IRQ_PRIORITY 11
71
72/*
73 * EXT driver system settings.
74 */
75#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
76#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
77#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
78#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
79#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
80#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
81#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
82#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
83#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
84#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
85#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
86
87/*
88 * GPT driver system settings.
89 */
90#define STM32_GPT_USE_TIM1 FALSE
91#define STM32_GPT_USE_TIM2 FALSE
92#define STM32_GPT_USE_TIM3 FALSE
93#define STM32_GPT_USE_TIM4 FALSE
94#define STM32_GPT_USE_TIM5 FALSE
95#define STM32_GPT_USE_TIM8 FALSE
96#define STM32_GPT_TIM1_IRQ_PRIORITY 7
97#define STM32_GPT_TIM2_IRQ_PRIORITY 7
98#define STM32_GPT_TIM3_IRQ_PRIORITY 7
99#define STM32_GPT_TIM4_IRQ_PRIORITY 7
100#define STM32_GPT_TIM5_IRQ_PRIORITY 7
101#define STM32_GPT_TIM8_IRQ_PRIORITY 7
102
103/*
104 * I2C driver system settings.
105 */
106#define STM32_I2C_USE_I2C1 FALSE
107#define STM32_I2C_USE_I2C2 FALSE
108#define STM32_I2C_BUSY_TIMEOUT 50
109#define STM32_I2C_I2C1_IRQ_PRIORITY 5
110#define STM32_I2C_I2C2_IRQ_PRIORITY 5
111#define STM32_I2C_I2C1_DMA_PRIORITY 3
112#define STM32_I2C_I2C2_DMA_PRIORITY 3
113#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
114
115/*
116 * ICU driver system settings.
117 */
118#define STM32_ICU_USE_TIM1 FALSE
119#define STM32_ICU_USE_TIM2 FALSE
120#define STM32_ICU_USE_TIM3 FALSE
121#define STM32_ICU_USE_TIM4 FALSE
122#define STM32_ICU_USE_TIM5 FALSE
123#define STM32_ICU_USE_TIM8 FALSE
124#define STM32_ICU_TIM1_IRQ_PRIORITY 7
125#define STM32_ICU_TIM2_IRQ_PRIORITY 7
126#define STM32_ICU_TIM3_IRQ_PRIORITY 7
127#define STM32_ICU_TIM4_IRQ_PRIORITY 7
128#define STM32_ICU_TIM5_IRQ_PRIORITY 7
129#define STM32_ICU_TIM8_IRQ_PRIORITY 7
130
131/*
132 * PWM driver system settings.
133 */
134#define STM32_PWM_USE_ADVANCED FALSE
135#define STM32_PWM_USE_TIM1 TRUE
136#define STM32_PWM_USE_TIM2 FALSE
137#define STM32_PWM_USE_TIM3 FALSE
138#define STM32_PWM_USE_TIM4 FALSE
139#define STM32_PWM_USE_TIM5 FALSE
140#define STM32_PWM_USE_TIM8 FALSE
141#define STM32_PWM_TIM1_IRQ_PRIORITY 7
142#define STM32_PWM_TIM2_IRQ_PRIORITY 7
143#define STM32_PWM_TIM3_IRQ_PRIORITY 7
144#define STM32_PWM_TIM4_IRQ_PRIORITY 7
145#define STM32_PWM_TIM5_IRQ_PRIORITY 7
146#define STM32_PWM_TIM8_IRQ_PRIORITY 7
147
148/*
149 * RTC driver system settings.
150 */
151#define STM32_RTC_IRQ_PRIORITY 15
152
153/*
154 * SERIAL driver system settings.
155 */
156#define STM32_SERIAL_USE_USART1 FALSE
157#define STM32_SERIAL_USE_USART2 FALSE
158#define STM32_SERIAL_USE_USART3 FALSE
159#define STM32_SERIAL_USE_UART4 FALSE
160#define STM32_SERIAL_USE_UART5 FALSE
161#define STM32_SERIAL_USART1_PRIORITY 12
162#define STM32_SERIAL_USART2_PRIORITY 12
163#define STM32_SERIAL_USART3_PRIORITY 12
164#define STM32_SERIAL_UART4_PRIORITY 12
165#define STM32_SERIAL_UART5_PRIORITY 12
166
167/*
168 * SPI driver system settings.
169 */
170#define STM32_SPI_USE_SPI1 FALSE
171#define STM32_SPI_USE_SPI2 TRUE
172#define STM32_SPI_USE_SPI3 FALSE
173#define STM32_SPI_SPI1_DMA_PRIORITY 1
174#define STM32_SPI_SPI2_DMA_PRIORITY 1
175#define STM32_SPI_SPI3_DMA_PRIORITY 1
176#define STM32_SPI_SPI1_IRQ_PRIORITY 10
177#define STM32_SPI_SPI2_IRQ_PRIORITY 10
178#define STM32_SPI_SPI3_IRQ_PRIORITY 10
179#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
180
181/*
182 * ST driver system settings.
183 */
184#define STM32_ST_IRQ_PRIORITY 8
185#define STM32_ST_USE_TIMER 2
186
187/*
188 * UART driver system settings.
189 */
190#define STM32_UART_USE_USART1 FALSE
191#define STM32_UART_USE_USART2 FALSE
192#define STM32_UART_USE_USART3 FALSE
193#define STM32_UART_USART1_IRQ_PRIORITY 12
194#define STM32_UART_USART2_IRQ_PRIORITY 12
195#define STM32_UART_USART3_IRQ_PRIORITY 12
196#define STM32_UART_USART1_DMA_PRIORITY 0
197#define STM32_UART_USART2_DMA_PRIORITY 0
198#define STM32_UART_USART3_DMA_PRIORITY 0
199#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
200
201/*
202 * USB driver system settings.
203 */
204#define STM32_USB_USE_USB1 TRUE
205#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
206#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
207#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
208
209#endif /* _MCUCONF_H_ */
diff --git a/keyboards/handwired/onekey/bluepill/readme.md b/keyboards/handwired/onekey/bluepill/readme.md
new file mode 100644
index 000000000..0bf1f5701
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/readme.md
@@ -0,0 +1,3 @@
1# bluepill onekey
2
3To trigger keypress, short together pins *B0* and *A7*.
diff --git a/keyboards/handwired/onekey/bluepill/rules.mk b/keyboards/handwired/onekey/bluepill/rules.mk
new file mode 100644
index 000000000..46274066d
--- /dev/null
+++ b/keyboards/handwired/onekey/bluepill/rules.mk
@@ -0,0 +1,37 @@
1# GENERIC STM32F103C8T6 board - stm32duino bootloader
2OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000
3MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
4BOARD = GENERIC_STM32_F103
5
6# OPT_DEFS =
7# MCU_LDSCRIPT = STM32F103x8
8# BOARD = GENERIC_STM32_F103
9
10## chip/board settings
11# the next two should match the directories in
12# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
13MCU_FAMILY = STM32
14MCU_SERIES = STM32F1xx
15# linker script to use
16# it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
17# or <this_dir>/ld/
18# startup code to use
19# is should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
20MCU_STARTUP = stm32f1xx
21# it should exist either in <chibios>/os/hal/boards/
22# or <this_dir>/boards
23# Cortex version
24# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4
25MCU = cortex-m3
26# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
27ARMV = 7
28# If you want to be able to jump to bootloader from firmware on STM32 MCUs,
29# set the correct BOOTLOADER_ADDRESS. Either set it here, or define it in
30# ./bootloader_defs.h or in ./boards/<FOO>/bootloader_defs.h (if you have
31# a custom board definition that you plan to reuse).
32# If you're not setting it here, leave it commented out.
33# It is chip dependent, the correct number can be looked up here (page 175):
34# http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
35# This also requires a patch to chibios:
36# <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
37#STM32_BOOTLOADER_ADDRESS = 0x1FFFC800
diff --git a/keyboards/handwired/onekey/config.h b/keyboards/handwired/onekey/config.h
index 4a3042eea..6f7ec1289 100644
--- a/keyboards/handwired/onekey/config.h
+++ b/keyboards/handwired/onekey/config.h
@@ -15,14 +15,11 @@ 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
21#include "config_common.h"
22 19
23/* USB Device descriptor parameter */ 20/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED 21#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6464 22#define PRODUCT_ID 0x6465
26#define DEVICE_VER 0x0001 23#define DEVICE_VER 0x0001
27#define MANUFACTURER none 24#define MANUFACTURER none
28#define PRODUCT onekey 25#define PRODUCT onekey
@@ -32,10 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
32#define MATRIX_ROWS 1 29#define MATRIX_ROWS 1
33#define MATRIX_COLS 1 30#define MATRIX_COLS 1
34 31
35#define MATRIX_COL_PINS { B0 }
36#define MATRIX_ROW_PINS { D0 }
37#define UNUSED_PINS
38
39/* define if matrix has ghost */ 32/* define if matrix has ghost */
40//#define MATRIX_HAS_GHOST 33//#define MATRIX_HAS_GHOST
41 34
@@ -64,5 +57,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
64//#define NO_ACTION_ONESHOT 57//#define NO_ACTION_ONESHOT
65//#define NO_ACTION_MACRO 58//#define NO_ACTION_MACRO
66//#define NO_ACTION_FUNCTION 59//#define NO_ACTION_FUNCTION
67
68#endif
diff --git a/keyboards/handwired/onekey/elite_c/config.h b/keyboards/handwired/onekey/elite_c/config.h
new file mode 100644
index 000000000..fbcd630d7
--- /dev/null
+++ b/keyboards/handwired/onekey/elite_c/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { F4 }
22#define MATRIX_ROW_PINS { F5 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/elite_c/readme.md b/keyboards/handwired/onekey/elite_c/readme.md
new file mode 100644
index 000000000..28a0885bb
--- /dev/null
+++ b/keyboards/handwired/onekey/elite_c/readme.md
@@ -0,0 +1,3 @@
1# Elite-C onekey
2
3To trigger keypress, short together pins *F4* and *F5* (marked on the PCB as *A3* and *A2*).
diff --git a/keyboards/handwired/onekey/elite_c/rules.mk b/keyboards/handwired/onekey/elite_c/rules.mk
new file mode 100644
index 000000000..eb7c44395
--- /dev/null
+++ b/keyboards/handwired/onekey/elite_c/rules.mk
@@ -0,0 +1,58 @@
1# MCU name
2MCU = atmega32u4
3
4# Processor frequency.
5# This will define a symbol, F_CPU, in all source code files equal to the
6# processor frequency in Hz. You can then use this symbol in your source code to
7# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
8# automatically to create a 32-bit value in your source code.
9#
10# This will be an integer division of F_USB below, as it is sourced by
11# F_USB after it has run through any CPU prescalers. Note that this value
12# does not *change* the processor frequency - it should merely be updated to
13# reflect the processor speed set externally so that the code can use accurate
14# software delays.
15F_CPU = 16000000
16
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40
41# Bootloader selection
42# Teensy halfkay
43# Pro Micro caterina
44# Atmel DFU atmel-dfu
45# LUFA DFU lufa-dfu
46# QMK DFU qmk-dfu
47# atmega32a bootloadHID
48BOOTLOADER = atmel-dfu
49
50
51# If you don't know the bootloader type, then you can specify the
52# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58# OPT_DEFS += -DBOOTLOADER_SIZE=4096
diff --git a/keyboards/handwired/onekey/onekey.h b/keyboards/handwired/onekey/onekey.h
index 8ce6fec2d..2924ff3ff 100644
--- a/keyboards/handwired/onekey/onekey.h
+++ b/keyboards/handwired/onekey/onekey.h
@@ -1,5 +1,20 @@
1#ifndef ONEKEY_H 1/* Copyright 2019
2#define ONEKEY_H 2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
3 18
4#include "quantum.h" 19#include "quantum.h"
5 20
@@ -8,5 +23,3 @@
8 ) { \ 23 ) { \
9 { k00 } \ 24 { k00 } \
10} 25}
11
12#endif
diff --git a/keyboards/handwired/onekey/promicro/config.h b/keyboards/handwired/onekey/promicro/config.h
new file mode 100644
index 000000000..fbcd630d7
--- /dev/null
+++ b/keyboards/handwired/onekey/promicro/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { F4 }
22#define MATRIX_ROW_PINS { F5 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/promicro/readme.md b/keyboards/handwired/onekey/promicro/readme.md
new file mode 100644
index 000000000..260eab83d
--- /dev/null
+++ b/keyboards/handwired/onekey/promicro/readme.md
@@ -0,0 +1,3 @@
1# Pro Micro onekey
2
3To trigger keypress, short together pins *F4* and *F5* (marked on the PCB as *A3* and *A2*).
diff --git a/keyboards/handwired/onekey/promicro/rules.mk b/keyboards/handwired/onekey/promicro/rules.mk
new file mode 100644
index 000000000..dc6f19623
--- /dev/null
+++ b/keyboards/handwired/onekey/promicro/rules.mk
@@ -0,0 +1,58 @@
1# MCU name
2MCU = atmega32u4
3
4# Processor frequency.
5# This will define a symbol, F_CPU, in all source code files equal to the
6# processor frequency in Hz. You can then use this symbol in your source code to
7# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
8# automatically to create a 32-bit value in your source code.
9#
10# This will be an integer division of F_USB below, as it is sourced by
11# F_USB after it has run through any CPU prescalers. Note that this value
12# does not *change* the processor frequency - it should merely be updated to
13# reflect the processor speed set externally so that the code can use accurate
14# software delays.
15F_CPU = 16000000
16
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40
41# Bootloader selection
42# Teensy halfkay
43# Pro Micro caterina
44# Atmel DFU atmel-dfu
45# LUFA DFU lufa-dfu
46# QMK DFU qmk-dfu
47# atmega32a bootloadHID
48BOOTLOADER = caterina
49
50
51# If you don't know the bootloader type, then you can specify the
52# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58# OPT_DEFS += -DBOOTLOADER_SIZE=4096
diff --git a/keyboards/handwired/onekey/proton_c/config.h b/keyboards/handwired/onekey/proton_c/config.h
new file mode 100644
index 000000000..f6bedcfe6
--- /dev/null
+++ b/keyboards/handwired/onekey/proton_c/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { A3 }
22#define MATRIX_ROW_PINS { A2 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/proton_c/readme.md b/keyboards/handwired/onekey/proton_c/readme.md
new file mode 100644
index 000000000..0feedbbd4
--- /dev/null
+++ b/keyboards/handwired/onekey/proton_c/readme.md
@@ -0,0 +1,3 @@
1# Proton C onekey
2
3To trigger keypress, short together pins *A3* and *A2*.
diff --git a/keyboards/handwired/onekey/proton_c/rules.mk b/keyboards/handwired/onekey/proton_c/rules.mk
new file mode 100644
index 000000000..b17a3d031
--- /dev/null
+++ b/keyboards/handwired/onekey/proton_c/rules.mk
@@ -0,0 +1,2 @@
1# MCU name
2MCU = STM32F303
diff --git a/keyboards/handwired/onekey/readme.md b/keyboards/handwired/onekey/readme.md
index eab3b75a9..0e9d6a538 100644
--- a/keyboards/handwired/onekey/readme.md
+++ b/keyboards/handwired/onekey/readme.md
@@ -2,11 +2,11 @@
2 2
3Custom handwired one key keyboard. 3Custom handwired one key keyboard.
4 4
5Keyboard Maintainer: 5Keyboard Maintainer: QMK Community
6Hardware Supported: Custom handwired one key 6Hardware Supported: bluepill, Elite-C, Pro Micro, Proton C, Teensy 2.0, Teensy++ 2.0, Teensy LC, Teensy 3.2
7Hardware Availability: 7Hardware Availability:
8 8
9Switch must be connected to pins B0 and D0. 9**See each individual board for pin infomation**
10 10
11Make example for this keyboard (after setting up your build environment): 11Make example for this keyboard (after setting up your build environment):
12 12
diff --git a/keyboards/handwired/onekey/rules.mk b/keyboards/handwired/onekey/rules.mk
index cfa693a73..245f9025d 100644
--- a/keyboards/handwired/onekey/rules.mk
+++ b/keyboards/handwired/onekey/rules.mk
@@ -1,61 +1,22 @@
1
2
3# MCU name
4MCU = atmega32u4
5
6# Processor frequency.
7# This will define a symbol, F_CPU, in all source code files equal to the
8# processor frequency in Hz. You can then use this symbol in your source code to
9# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
10# automatically to create a 32-bit value in your source code.
11#
12# This will be an integer division of F_USB below, as it is sourced by
13# F_USB after it has run through any CPU prescalers. Note that this value
14# does not *change* the processor frequency - it should merely be updated to
15# reflect the processor speed set externally so that the code can use accurate
16# software delays.
17F_CPU = 16000000
18
19
20#
21# LUFA specific
22#
23# Target architecture (see library "Board Types" documentation).
24ARCH = AVR8
25
26# Input clock frequency.
27# This will define a symbol, F_USB, in all source code files equal to the
28# input clock frequency (before any prescaling is performed) in Hz. This value may
29# differ from F_CPU if prescaling is used on the latter, and is required as the
30# raw input clock is fed directly to the PLL sections of the AVR for high speed
31# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
32# at the end, this will be done automatically to create a 32-bit value in your
33# source code.
34#
35# If no clock division is performed on the input clock inside the AVR (via the
36# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
37F_USB = $(F_CPU)
38
39# Interrupt driven control endpoint task(+60)
40OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
41
42
43# Boot Section Size in *bytes*
44# Teensy halfKay 512
45# Teensy++ halfKay 1024
46# Atmel DFU loader 4096
47# LUFA bootloader 4096
48# USBaspLoader 2048
49OPT_DEFS += -DBOOTLOADER_SIZE=4096
50
51
52# Build Options 1# Build Options
53# comment out to disable the options. 2# change yes to no to disable
54# 3#
55BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 4BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
56MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 5MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
57EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 6EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
58CONSOLE_ENABLE = yes # Console for debug(+400) 7CONSOLE_ENABLE = yes # Console for debug(+400)
59COMMAND_ENABLE = yes # Commands for debug and configuration 8COMMAND_ENABLE = yes # Commands for debug and configuration
60#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 9# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
61#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA \ No newline at end of file 10SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
11# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
12NKRO_ENABLE = yes # USB Nkey Rollover
13BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
14RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
15MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
16UNICODE_ENABLE = no # Unicode
17BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
18AUDIO_ENABLE = no # Audio output on port C6
19FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
20HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
21
22DEFAULT_FOLDER = handwired/onekey/promicro
diff --git a/keyboards/handwired/onekey/teensy_2/config.h b/keyboards/handwired/onekey/teensy_2/config.h
new file mode 100644
index 000000000..fbcd630d7
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { F4 }
22#define MATRIX_ROW_PINS { F5 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/teensy_2/readme.md b/keyboards/handwired/onekey/teensy_2/readme.md
new file mode 100644
index 000000000..86a3114e5
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2/readme.md
@@ -0,0 +1,3 @@
1# Teensy 2.0 onekey
2
3To trigger keypress, short together pins *F4* and *F5*
diff --git a/keyboards/handwired/onekey/teensy_2/rules.mk b/keyboards/handwired/onekey/teensy_2/rules.mk
new file mode 100644
index 000000000..3fb7c7e5a
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2/rules.mk
@@ -0,0 +1,58 @@
1# MCU name
2MCU = atmega32u4
3
4# Processor frequency.
5# This will define a symbol, F_CPU, in all source code files equal to the
6# processor frequency in Hz. You can then use this symbol in your source code to
7# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
8# automatically to create a 32-bit value in your source code.
9#
10# This will be an integer division of F_USB below, as it is sourced by
11# F_USB after it has run through any CPU prescalers. Note that this value
12# does not *change* the processor frequency - it should merely be updated to
13# reflect the processor speed set externally so that the code can use accurate
14# software delays.
15F_CPU = 16000000
16
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40
41# Bootloader selection
42# Teensy halfkay
43# Pro Micro caterina
44# Atmel DFU atmel-dfu
45# LUFA DFU lufa-dfu
46# QMK DFU qmk-dfu
47# atmega32a bootloadHID
48BOOTLOADER = halfkay
49
50
51# If you don't know the bootloader type, then you can specify the
52# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58# OPT_DEFS += -DBOOTLOADER_SIZE=4096
diff --git a/keyboards/handwired/onekey/teensy_2pp/config.h b/keyboards/handwired/onekey/teensy_2pp/config.h
new file mode 100644
index 000000000..9d993980c
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2pp/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "config_common.h"
20
21#define MATRIX_COL_PINS { B2 }
22#define MATRIX_ROW_PINS { B1 }
23#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/teensy_2pp/readme.md b/keyboards/handwired/onekey/teensy_2pp/readme.md
new file mode 100644
index 000000000..9cb99e118
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2pp/readme.md
@@ -0,0 +1,3 @@
1# Teensy++ 2.0 onekey
2
3To trigger keypress, short together pins *B2* and *B1*
diff --git a/keyboards/handwired/onekey/teensy_2pp/rules.mk b/keyboards/handwired/onekey/teensy_2pp/rules.mk
new file mode 100644
index 000000000..e318e4b9e
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_2pp/rules.mk
@@ -0,0 +1,58 @@
1# MCU name
2MCU = at90usb1286
3
4# Processor frequency.
5# This will define a symbol, F_CPU, in all source code files equal to the
6# processor frequency in Hz. You can then use this symbol in your source code to
7# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
8# automatically to create a 32-bit value in your source code.
9#
10# This will be an integer division of F_USB below, as it is sourced by
11# F_USB after it has run through any CPU prescalers. Note that this value
12# does not *change* the processor frequency - it should merely be updated to
13# reflect the processor speed set externally so that the code can use accurate
14# software delays.
15F_CPU = 16000000
16
17
18#
19# LUFA specific
20#
21# Target architecture (see library "Board Types" documentation).
22ARCH = AVR8
23
24# Input clock frequency.
25# This will define a symbol, F_USB, in all source code files equal to the
26# input clock frequency (before any prescaling is performed) in Hz. This value may
27# differ from F_CPU if prescaling is used on the latter, and is required as the
28# raw input clock is fed directly to the PLL sections of the AVR for high speed
29# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
30# at the end, this will be done automatically to create a 32-bit value in your
31# source code.
32#
33# If no clock division is performed on the input clock inside the AVR (via the
34# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
35F_USB = $(F_CPU)
36
37# Interrupt driven control endpoint task(+60)
38OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
39
40
41# Bootloader selection
42# Teensy halfkay
43# Pro Micro caterina
44# Atmel DFU atmel-dfu
45# LUFA DFU lufa-dfu
46# QMK DFU qmk-dfu
47# atmega32a bootloadHID
48BOOTLOADER = halfkay
49
50
51# If you don't know the bootloader type, then you can specify the
52# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
53# Teensy halfKay 512
54# Teensy++ halfKay 1024
55# Atmel DFU loader 4096
56# LUFA bootloader 4096
57# USBaspLoader 2048
58# OPT_DEFS += -DBOOTLOADER_SIZE=4096
diff --git a/keyboards/handwired/onekey/teensy_32/chconf.h b/keyboards/handwired/onekey/teensy_32/chconf.h
new file mode 100644
index 000000000..3294ac7ee
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/chconf.h
@@ -0,0 +1,524 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32
33/*===========================================================================*/
34/**
35 * @name System timers settings
36 * @{
37 */
38/*===========================================================================*/
39
40/**
41 * @brief System time counter resolution.
42 * @note Allowed values are 16 or 32 bits.
43 */
44#define CH_CFG_ST_RESOLUTION 32
45
46/**
47 * @brief System tick frequency.
48 * @details Frequency of the system timer that drives the system ticks. This
49 * setting also defines the system tick time unit.
50 */
51#define CH_CFG_ST_FREQUENCY 1000
52
53/**
54 * @brief Time delta constant for the tick-less mode.
55 * @note If this value is zero then the system uses the classic
56 * periodic tick. This value represents the minimum number
57 * of ticks that is safe to specify in a timeout directive.
58 * The value one is not valid, timeouts are rounded up to
59 * this value.
60 */
61#define CH_CFG_ST_TIMEDELTA 0
62
63/** @} */
64
65/*===========================================================================*/
66/**
67 * @name Kernel parameters and options
68 * @{
69 */
70/*===========================================================================*/
71
72/**
73 * @brief Round robin interval.
74 * @details This constant is the number of system ticks allowed for the
75 * threads before preemption occurs. Setting this value to zero
76 * disables the preemption for threads with equal priority and the
77 * round robin becomes cooperative. Note that higher priority
78 * threads can still preempt, the kernel is always preemptive.
79 * @note Disabling the round robin preemption makes the kernel more compact
80 * and generally faster.
81 * @note The round robin preemption is not supported in tickless mode and
82 * must be set to zero in that case.
83 */
84#define CH_CFG_TIME_QUANTUM 20
85
86/**
87 * @brief Managed RAM size.
88 * @details Size of the RAM area to be managed by the OS. If set to zero
89 * then the whole available RAM is used. The core memory is made
90 * available to the heap allocator and/or can be used directly through
91 * the simplified core memory allocator.
92 *
93 * @note In order to let the OS manage the whole RAM the linker script must
94 * provide the @p __heap_base__ and @p __heap_end__ symbols.
95 * @note Requires @p CH_CFG_USE_MEMCORE.
96 */
97#define CH_CFG_MEMCORE_SIZE 0
98
99/**
100 * @brief Idle thread automatic spawn suppression.
101 * @details When this option is activated the function @p chSysInit()
102 * does not spawn the idle thread. The application @p main()
103 * function becomes the idle thread and must implement an
104 * infinite loop.
105 */
106#define CH_CFG_NO_IDLE_THREAD FALSE
107
108/* Use __WFI in the idle thread for waiting. Does lower the power
109 * consumption. */
110#define CORTEX_ENABLE_WFI_IDLE TRUE
111
112/** @} */
113
114/*===========================================================================*/
115/**
116 * @name Performance options
117 * @{
118 */
119/*===========================================================================*/
120
121/**
122 * @brief OS optimization.
123 * @details If enabled then time efficient rather than space efficient code
124 * is used when two possible implementations exist.
125 *
126 * @note This is not related to the compiler optimization options.
127 * @note The default is @p TRUE.
128 */
129#define CH_CFG_OPTIMIZE_SPEED TRUE
130
131/** @} */
132
133/*===========================================================================*/
134/**
135 * @name Subsystem options
136 * @{
137 */
138/*===========================================================================*/
139
140/**
141 * @brief Time Measurement APIs.
142 * @details If enabled then the time measurement APIs are included in
143 * the kernel.
144 *
145 * @note The default is @p TRUE.
146 */
147#define CH_CFG_USE_TM FALSE
148
149/**
150 * @brief Threads registry APIs.
151 * @details If enabled then the registry APIs are included in the kernel.
152 *
153 * @note The default is @p TRUE.
154 */
155#define CH_CFG_USE_REGISTRY TRUE
156
157/**
158 * @brief Threads synchronization APIs.
159 * @details If enabled then the @p chThdWait() function is included in
160 * the kernel.
161 *
162 * @note The default is @p TRUE.
163 */
164#define CH_CFG_USE_WAITEXIT TRUE
165
166/**
167 * @brief Semaphores APIs.
168 * @details If enabled then the Semaphores APIs are included in the kernel.
169 *
170 * @note The default is @p TRUE.
171 */
172#define CH_CFG_USE_SEMAPHORES TRUE
173
174/**
175 * @brief Semaphores queuing mode.
176 * @details If enabled then the threads are enqueued on semaphores by
177 * priority rather than in FIFO order.
178 *
179 * @note The default is @p FALSE. Enable this if you have special
180 * requirements.
181 * @note Requires @p CH_CFG_USE_SEMAPHORES.
182 */
183#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
184
185/**
186 * @brief Mutexes APIs.
187 * @details If enabled then the mutexes APIs are included in the kernel.
188 *
189 * @note The default is @p TRUE.
190 */
191#define CH_CFG_USE_MUTEXES TRUE
192
193/**
194 * @brief Enables recursive behavior on mutexes.
195 * @note Recursive mutexes are heavier and have an increased
196 * memory footprint.
197 *
198 * @note The default is @p FALSE.
199 * @note Requires @p CH_CFG_USE_MUTEXES.
200 */
201#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
202
203/**
204 * @brief Conditional Variables APIs.
205 * @details If enabled then the conditional variables APIs are included
206 * in the kernel.
207 *
208 * @note The default is @p TRUE.
209 * @note Requires @p CH_CFG_USE_MUTEXES.
210 */
211#define CH_CFG_USE_CONDVARS TRUE
212
213/**
214 * @brief Conditional Variables APIs with timeout.
215 * @details If enabled then the conditional variables APIs with timeout
216 * specification are included in the kernel.
217 *
218 * @note The default is @p TRUE.
219 * @note Requires @p CH_CFG_USE_CONDVARS.
220 */
221#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
222
223/**
224 * @brief Events Flags APIs.
225 * @details If enabled then the event flags APIs are included in the kernel.
226 *
227 * @note The default is @p TRUE.
228 */
229#define CH_CFG_USE_EVENTS TRUE
230
231/**
232 * @brief Events Flags APIs with timeout.
233 * @details If enabled then the events APIs with timeout specification
234 * are included in the kernel.
235 *
236 * @note The default is @p TRUE.
237 * @note Requires @p CH_CFG_USE_EVENTS.
238 */
239#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
240
241/**
242 * @brief Synchronous Messages APIs.
243 * @details If enabled then the synchronous messages APIs are included
244 * in the kernel.
245 *
246 * @note The default is @p TRUE.
247 */
248#define CH_CFG_USE_MESSAGES TRUE
249
250/**
251 * @brief Synchronous Messages queuing mode.
252 * @details If enabled then messages are served by priority rather than in
253 * FIFO order.
254 *
255 * @note The default is @p FALSE. Enable this if you have special
256 * requirements.
257 * @note Requires @p CH_CFG_USE_MESSAGES.
258 */
259#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
260
261/**
262 * @brief Mailboxes APIs.
263 * @details If enabled then the asynchronous messages (mailboxes) APIs are
264 * included in the kernel.
265 *
266 * @note The default is @p TRUE.
267 * @note Requires @p CH_CFG_USE_SEMAPHORES.
268 */
269#define CH_CFG_USE_MAILBOXES TRUE
270
271/**
272 * @brief Core Memory Manager APIs.
273 * @details If enabled then the core memory manager APIs are included
274 * in the kernel.
275 *
276 * @note The default is @p TRUE.
277 */
278#define CH_CFG_USE_MEMCORE TRUE
279
280/**
281 * @brief Heap Allocator APIs.
282 * @details If enabled then the memory heap allocator APIs are included
283 * in the kernel.
284 *
285 * @note The default is @p TRUE.
286 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
287 * @p CH_CFG_USE_SEMAPHORES.
288 * @note Mutexes are recommended.
289 */
290#define CH_CFG_USE_HEAP TRUE
291
292/**
293 * @brief Memory Pools Allocator APIs.
294 * @details If enabled then the memory pools allocator APIs are included
295 * in the kernel.
296 *
297 * @note The default is @p TRUE.
298 */
299#define CH_CFG_USE_MEMPOOLS TRUE
300
301/**
302 * @brief Dynamic Threads APIs.
303 * @details If enabled then the dynamic threads creation APIs are included
304 * in the kernel.
305 *
306 * @note The default is @p TRUE.
307 * @note Requires @p CH_CFG_USE_WAITEXIT.
308 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
309 */
310#define CH_CFG_USE_DYNAMIC TRUE
311
312/** @} */
313
314/*===========================================================================*/
315/**
316 * @name Debug options
317 * @{
318 */
319/*===========================================================================*/
320
321/**
322 * @brief Debug option, kernel statistics.
323 *
324 * @note The default is @p FALSE.
325 */
326#define CH_DBG_STATISTICS FALSE
327
328/**
329 * @brief Debug option, system state check.
330 * @details If enabled the correct call protocol for system APIs is checked
331 * at runtime.
332 *
333 * @note The default is @p FALSE.
334 */
335#define CH_DBG_SYSTEM_STATE_CHECK TRUE
336
337/**
338 * @brief Debug option, parameters checks.
339 * @details If enabled then the checks on the API functions input
340 * parameters are activated.
341 *
342 * @note The default is @p FALSE.
343 */
344#define CH_DBG_ENABLE_CHECKS TRUE
345
346/**
347 * @brief Debug option, consistency checks.
348 * @details If enabled then all the assertions in the kernel code are
349 * activated. This includes consistency checks inside the kernel,
350 * runtime anomalies and port-defined checks.
351 *
352 * @note The default is @p FALSE.
353 */
354#define CH_DBG_ENABLE_ASSERTS TRUE
355
356/**
357 * @brief Debug option, trace buffer.
358 * @details If enabled then the trace buffer is activated.
359 *
360 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
361 */
362#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
363
364/**
365 * @brief Trace buffer entries.
366 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
367 * different from @p CH_DBG_TRACE_MASK_DISABLED.
368 */
369#define CH_DBG_TRACE_BUFFER_SIZE 128
370
371/**
372 * @brief Debug option, stack checks.
373 * @details If enabled then a runtime stack check is performed.
374 *
375 * @note The default is @p FALSE.
376 * @note The stack check is performed in a architecture/port dependent way.
377 * It may not be implemented or some ports.
378 * @note The default failure mode is to halt the system with the global
379 * @p panic_msg variable set to @p NULL.
380 */
381#define CH_DBG_ENABLE_STACK_CHECK TRUE
382
383/**
384 * @brief Debug option, stacks initialization.
385 * @details If enabled then the threads working area is filled with a byte
386 * value when a thread is created. This can be useful for the
387 * runtime measurement of the used stack.
388 *
389 * @note The default is @p FALSE.
390 */
391#define CH_DBG_FILL_THREADS TRUE
392
393/**
394 * @brief Debug option, threads profiling.
395 * @details If enabled then a field is added to the @p thread_t structure that
396 * counts the system ticks occurred while executing the thread.
397 *
398 * @note The default is @p FALSE.
399 * @note This debug option is not currently compatible with the
400 * tickless mode.
401 */
402#define CH_DBG_THREADS_PROFILING FALSE
403
404/** @} */
405
406/*===========================================================================*/
407/**
408 * @name Kernel hooks
409 * @{
410 */
411/*===========================================================================*/
412
413/**
414 * @brief Threads descriptor structure extension.
415 * @details User fields added to the end of the @p thread_t structure.
416 */
417#define CH_CFG_THREAD_EXTRA_FIELDS \
418 /* Add threads custom fields here.*/
419
420/**
421 * @brief Threads initialization hook.
422 * @details User initialization code added to the @p chThdInit() API.
423 *
424 * @note It is invoked from within @p chThdInit() and implicitly from all
425 * the threads creation APIs.
426 */
427#define CH_CFG_THREAD_INIT_HOOK(tp) { \
428 /* Add threads initialization code here.*/ \
429}
430
431/**
432 * @brief Threads finalization hook.
433 * @details User finalization code added to the @p chThdExit() API.
434 */
435#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
436 /* Add threads finalization code here.*/ \
437}
438
439/**
440 * @brief Context switch hook.
441 * @details This hook is invoked just before switching between threads.
442 */
443#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
444 /* Context switch code here.*/ \
445}
446
447/**
448 * @brief ISR enter hook.
449 */
450#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
451 /* IRQ prologue code here.*/ \
452}
453
454/**
455 * @brief ISR exit hook.
456 */
457#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
458 /* IRQ epilogue code here.*/ \
459}
460
461/**
462 * @brief Idle thread enter hook.
463 * @note This hook is invoked within a critical zone, no OS functions
464 * should be invoked from here.
465 * @note This macro can be used to activate a power saving mode.
466 */
467#define CH_CFG_IDLE_ENTER_HOOK() { \
468 /* Idle-enter code here.*/ \
469}
470
471/**
472 * @brief Idle thread leave hook.
473 * @note This hook is invoked within a critical zone, no OS functions
474 * should be invoked from here.
475 * @note This macro can be used to deactivate a power saving mode.
476 */
477#define CH_CFG_IDLE_LEAVE_HOOK() { \
478 /* Idle-leave code here.*/ \
479}
480
481/**
482 * @brief Idle Loop hook.
483 * @details This hook is continuously invoked by the idle thread loop.
484 */
485#define CH_CFG_IDLE_LOOP_HOOK() { \
486 /* Idle loop code here.*/ \
487}
488
489/**
490 * @brief System tick event hook.
491 * @details This hook is invoked in the system tick handler immediately
492 * after processing the virtual timers queue.
493 */
494#define CH_CFG_SYSTEM_TICK_HOOK() { \
495 /* System tick event code here.*/ \
496}
497
498/**
499 * @brief System halt hook.
500 * @details This hook is invoked in case to a system halting error before
501 * the system is halted.
502 */
503#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
504 /* System halt code here.*/ \
505}
506
507/**
508 * @brief Trace hook.
509 * @details This hook is invoked each time a new record is written in the
510 * trace buffer.
511 */
512#define CH_CFG_TRACE_HOOK(tep) { \
513 /* Trace code here.*/ \
514}
515
516/** @} */
517
518/*===========================================================================*/
519/* Port-specific settings (override port settings defaulted in chcore.h). */
520/*===========================================================================*/
521
522#endif /* CHCONF_H */
523
524/** @} */
diff --git a/keyboards/handwired/onekey/teensy_32/config.h b/keyboards/handwired/onekey/teensy_32/config.h
new file mode 100644
index 000000000..0d82a0578
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/config.h
@@ -0,0 +1,24 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19// TODO: including this causes "error: expected identifier before '(' token" errors
20//#include "config_common.h"
21
22#define MATRIX_COL_PINS { D5 }
23#define MATRIX_ROW_PINS { B2 }
24#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/teensy_32/halconf.h b/keyboards/handwired/onekey/teensy_32/halconf.h
new file mode 100644
index 000000000..1b6f2adc2
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/halconf.h
@@ -0,0 +1,354 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/halconf.h
19 * @brief HAL configuration header.
20 * @details HAL configuration file, this file allows to enable or disable the
21 * various device drivers from your application. You may also use
22 * this file in order to override the device drivers default settings.
23 *
24 * @addtogroup HAL_CONF
25 * @{
26 */
27
28#ifndef _HALCONF_H_
29#define _HALCONF_H_
30
31#include "mcuconf.h"
32
33/**
34 * @brief Enables the PAL subsystem.
35 */
36#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
37#define HAL_USE_PAL TRUE
38#endif
39
40/**
41 * @brief Enables the ADC subsystem.
42 */
43#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
44#define HAL_USE_ADC FALSE
45#endif
46
47/**
48 * @brief Enables the CAN subsystem.
49 */
50#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
51#define HAL_USE_CAN FALSE
52#endif
53
54/**
55 * @brief Enables the DAC subsystem.
56 */
57#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
58#define HAL_USE_DAC FALSE
59#endif
60
61/**
62 * @brief Enables the EXT subsystem.
63 */
64#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
65#define HAL_USE_EXT FALSE
66#endif
67
68/**
69 * @brief Enables the GPT subsystem.
70 */
71#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
72#define HAL_USE_GPT FALSE
73#endif
74
75/**
76 * @brief Enables the I2C subsystem.
77 */
78#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79#define HAL_USE_I2C FALSE
80#endif
81
82/**
83 * @brief Enables the I2S subsystem.
84 */
85#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
86#define HAL_USE_I2S FALSE
87#endif
88
89/**
90 * @brief Enables the ICU subsystem.
91 */
92#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
93#define HAL_USE_ICU FALSE
94#endif
95
96/**
97 * @brief Enables the MAC subsystem.
98 */
99#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
100#define HAL_USE_MAC FALSE
101#endif
102
103/**
104 * @brief Enables the MMC_SPI subsystem.
105 */
106#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
107#define HAL_USE_MMC_SPI FALSE
108#endif
109
110/**
111 * @brief Enables the PWM subsystem.
112 */
113#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114#define HAL_USE_PWM FALSE
115#endif
116
117/**
118 * @brief Enables the RTC subsystem.
119 */
120#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
121#define HAL_USE_RTC FALSE
122#endif
123
124/**
125 * @brief Enables the SDC subsystem.
126 */
127#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
128#define HAL_USE_SDC FALSE
129#endif
130
131/**
132 * @brief Enables the SERIAL subsystem.
133 */
134#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
135#define HAL_USE_SERIAL FALSE
136#endif
137
138/**
139 * @brief Enables the SERIAL over USB subsystem.
140 */
141#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
142#define HAL_USE_SERIAL_USB FALSE
143#endif
144
145/**
146 * @brief Enables the SPI subsystem.
147 */
148#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
149#define HAL_USE_SPI FALSE
150#endif
151
152/**
153 * @brief Enables the UART subsystem.
154 */
155#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
156#define HAL_USE_UART FALSE
157#endif
158
159/**
160 * @brief Enables the USB subsystem.
161 */
162#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
163#define HAL_USE_USB TRUE
164#endif
165
166/**
167 * @brief Enables the WDG subsystem.
168 */
169#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
170#define HAL_USE_WDG FALSE
171#endif
172
173/*===========================================================================*/
174/* ADC driver related settings. */
175/*===========================================================================*/
176
177/**
178 * @brief Enables synchronous APIs.
179 * @note Disabling this option saves both code and data space.
180 */
181#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
182#define ADC_USE_WAIT TRUE
183#endif
184
185/**
186 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
187 * @note Disabling this option saves both code and data space.
188 */
189#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
190#define ADC_USE_MUTUAL_EXCLUSION TRUE
191#endif
192
193/*===========================================================================*/
194/* CAN driver related settings. */
195/*===========================================================================*/
196
197/**
198 * @brief Sleep mode related APIs inclusion switch.
199 */
200#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
201#define CAN_USE_SLEEP_MODE TRUE
202#endif
203
204/*===========================================================================*/
205/* I2C driver related settings. */
206/*===========================================================================*/
207
208/**
209 * @brief Enables the mutual exclusion APIs on the I2C bus.
210 */
211#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
212#define I2C_USE_MUTUAL_EXCLUSION TRUE
213#endif
214
215/*===========================================================================*/
216/* MAC driver related settings. */
217/*===========================================================================*/
218
219/**
220 * @brief Enables an event sources for incoming packets.
221 */
222#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
223#define MAC_USE_ZERO_COPY FALSE
224#endif
225
226/**
227 * @brief Enables an event sources for incoming packets.
228 */
229#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
230#define MAC_USE_EVENTS TRUE
231#endif
232
233/*===========================================================================*/
234/* MMC_SPI driver related settings. */
235/*===========================================================================*/
236
237/**
238 * @brief Delays insertions.
239 * @details If enabled this options inserts delays into the MMC waiting
240 * routines releasing some extra CPU time for the threads with
241 * lower priority, this may slow down the driver a bit however.
242 * This option is recommended also if the SPI driver does not
243 * use a DMA channel and heavily loads the CPU.
244 */
245#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
246#define MMC_NICE_WAITING TRUE
247#endif
248
249/*===========================================================================*/
250/* SDC driver related settings. */
251/*===========================================================================*/
252
253/**
254 * @brief Number of initialization attempts before rejecting the card.
255 * @note Attempts are performed at 10mS intervals.
256 */
257#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
258#define SDC_INIT_RETRY 100
259#endif
260
261/**
262 * @brief Include support for MMC cards.
263 * @note MMC support is not yet implemented so this option must be kept
264 * at @p FALSE.
265 */
266#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
267#define SDC_MMC_SUPPORT FALSE
268#endif
269
270/**
271 * @brief Delays insertions.
272 * @details If enabled this options inserts delays into the MMC waiting
273 * routines releasing some extra CPU time for the threads with
274 * lower priority, this may slow down the driver a bit however.
275 */
276#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
277#define SDC_NICE_WAITING TRUE
278#endif
279
280/*===========================================================================*/
281/* SERIAL driver related settings. */
282/*===========================================================================*/
283
284/**
285 * @brief Default bit rate.
286 * @details Configuration parameter, this is the baud rate selected for the
287 * default configuration.
288 */
289#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
290#define SERIAL_DEFAULT_BITRATE 38400
291#endif
292
293/**
294 * @brief Serial buffers size.
295 * @details Configuration parameter, you can change the depth of the queue
296 * buffers depending on the requirements of your application.
297 * @note The default is 64 bytes for both the transmission and receive
298 * buffers.
299 */
300#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
301#define SERIAL_BUFFERS_SIZE 16
302#endif
303
304/*===========================================================================*/
305/* SERIAL_USB driver related setting. */
306/*===========================================================================*/
307
308/**
309 * @brief Serial over USB buffers size.
310 * @details Configuration parameter, the buffer size must be a multiple of
311 * the USB data endpoint maximum packet size.
312 * @note The default is 64 bytes for both the transmission and receive
313 * buffers.
314 */
315#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
316#define SERIAL_USB_BUFFERS_SIZE 1
317#endif
318
319/*===========================================================================*/
320/* SPI driver related settings. */
321/*===========================================================================*/
322
323/**
324 * @brief Enables synchronous APIs.
325 * @note Disabling this option saves both code and data space.
326 */
327#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
328#define SPI_USE_WAIT TRUE
329#endif
330
331/**
332 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
333 * @note Disabling this option saves both code and data space.
334 */
335#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
336#define SPI_USE_MUTUAL_EXCLUSION TRUE
337#endif
338
339/*===========================================================================*/
340/* USB driver related settings. */
341/*===========================================================================*/
342
343/**
344 * @brief Enables synchronous APIs.
345 * @note Disabling this option saves both code and data space.
346 */
347#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
348#define USB_USE_WAIT TRUE
349#endif
350
351#endif /* _HALCONF_H_ */
352
353/** @} */
354
diff --git a/keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld b/keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld
new file mode 100644
index 000000000..66bc6b81e
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/ld/MK20DX256.ld
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com
3 * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24/*
25 * MK20DX256 memory setup.
26 */
27MEMORY
28{
29 flash0 : org = 0x00000000, len = 0x400
30 flash1 : org = 0x00000400, len = 0x10
31 flash2 : org = 0x00000410, len = 256k - 0x410
32 flash3 : org = 0x00000000, len = 0
33 flash4 : org = 0x00000000, len = 0
34 flash5 : org = 0x00000000, len = 0
35 flash6 : org = 0x00000000, len = 0
36 flash7 : org = 0x00000000, len = 0
37 ram0 : org = 0x1FFF8000, len = 64k
38 ram1 : org = 0x00000000, len = 0
39 ram2 : org = 0x00000000, len = 0
40 ram3 : org = 0x00000000, len = 0
41 ram4 : org = 0x00000000, len = 0
42 ram5 : org = 0x00000000, len = 0
43 ram6 : org = 0x00000000, len = 0
44 ram7 : org = 0x00000000, len = 0
45}
46
47/* Flash region for the configuration bytes.*/
48SECTIONS
49{
50 .cfmprotect : ALIGN(4) SUBALIGN(4)
51 {
52 KEEP(*(.cfmconfig))
53 } > flash1
54}
55
56/* For each data/text section two region are defined, a virtual region
57 and a load region (_LMA suffix).*/
58
59/* Flash region to be used for exception vectors.*/
60REGION_ALIAS("VECTORS_FLASH", flash0);
61REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
62
63/* Flash region to be used for constructors and destructors.*/
64REGION_ALIAS("XTORS_FLASH", flash2);
65REGION_ALIAS("XTORS_FLASH_LMA", flash2);
66
67/* Flash region to be used for code text.*/
68REGION_ALIAS("TEXT_FLASH", flash2);
69REGION_ALIAS("TEXT_FLASH_LMA", flash2);
70
71/* Flash region to be used for read only data.*/
72REGION_ALIAS("RODATA_FLASH", flash2);
73REGION_ALIAS("RODATA_FLASH_LMA", flash2);
74
75/* Flash region to be used for various.*/
76REGION_ALIAS("VARIOUS_FLASH", flash2);
77REGION_ALIAS("VARIOUS_FLASH_LMA", flash2);
78
79/* Flash region to be used for RAM(n) initialization data.*/
80REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2);
81
82/* RAM region to be used for Main stack. This stack accommodates the processing
83 of all exceptions and interrupts.*/
84REGION_ALIAS("MAIN_STACK_RAM", ram0);
85
86/* RAM region to be used for the process stack. This is the stack used by
87 the main() function.*/
88REGION_ALIAS("PROCESS_STACK_RAM", ram0);
89
90/* RAM region to be used for data segment.*/
91REGION_ALIAS("DATA_RAM", ram0);
92REGION_ALIAS("DATA_RAM_LMA", flash2);
93
94/* RAM region to be used for BSS segment.*/
95REGION_ALIAS("BSS_RAM", ram0);
96
97/* RAM region to be used for the default heap.*/
98REGION_ALIAS("HEAP_RAM", ram0);
99
100/* Generic rules inclusion.*/
101INCLUDE rules.ld
diff --git a/keyboards/handwired/onekey/teensy_32/mcuconf.h b/keyboards/handwired/onekey/teensy_32/mcuconf.h
new file mode 100644
index 000000000..13a9e3333
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/mcuconf.h
@@ -0,0 +1,45 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _MCUCONF_H_
18#define _MCUCONF_H_
19
20#define K20x_MCUCONF
21
22/*
23 * HAL driver system settings.
24 */
25/* PEE mode - 48MHz system clock driven by (16 MHz) external crystal. */
26#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE
27#define KINETIS_PLLCLK_FREQUENCY 96000000UL
28#define KINETIS_SYSCLK_FREQUENCY 48000000UL
29
30/*
31 * SERIAL driver system settings.
32 */
33#define KINETIS_SERIAL_USE_UART0 TRUE
34
35/*
36 * USB driver settings
37 */
38#define KINETIS_USB_USE_USB0 TRUE
39
40/* Need to redefine this, since the default (configured for K20x) might not apply
41 * 2 for Teensy LC
42 * 5 for Teensy 3.x */
43#define KINETIS_USB_USB0_IRQ_PRIORITY 5
44
45#endif /* _MCUCONF_H_ */
diff --git a/keyboards/handwired/onekey/teensy_32/readme.md b/keyboards/handwired/onekey/teensy_32/readme.md
new file mode 100644
index 000000000..216aecfaf
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/readme.md
@@ -0,0 +1,40 @@
1# Teensy 3.2 onekey
2
3To trigger keypress, short together pins *D5* and *B2* (marked on the PCB as *20* and *19*).
4
5## Hardware
6
7### Pins
8When setting matrix pins, you need to use the MCU definitions instead of what is printed on the PCB. Sourced from <https://www.pjrc.com/teensy/schematic32.gif>. The following table can be used to convert between the two.
9
10| PCB | MCU | Notes |
11|------- |-----|-----------------------------|
12| 0 | B16 | |
13| 1 | B17 | |
14| 2 | D0 | |
15| 3 | A12 | |
16| 4 | A13 | |
17| 5 | D7 | |
18| 6 | D4 | |
19| 7 | D2 | |
20| 8 | D3 | |
21| 9 | C3 | |
22| 10 | C4 | |
23| 11 | C6 | |
24| 12 | C7 | |
25| 13/LED | C5 | |
26| 14/A0 | D1 | |
27| 15/A1 | C0 | |
28| 16/A2 | B0 | |
29| 17/A3 | B1 | |
30| 18/A4 | B3 | |
31| 19/A5 | B2 | |
32| 20/A6 | D5 | |
33| 21/A7 | D6 | |
34| 22/A8 | C1 | |
35| 23/A9 | C2 | |
36| 24/A10 | | ADC0_DP0 in schematic *[1]* |
37| 25/A11 | | ADC0_DM0 in schematic *[1]* |
38| 26/A12 | | ADC0_DP3 in schematic *[1]* |
39
40*[1]* - Currently not configured and may require extra work to implement.
diff --git a/keyboards/handwired/onekey/teensy_32/rules.mk b/keyboards/handwired/onekey/teensy_32/rules.mk
new file mode 100644
index 000000000..97171611e
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_32/rules.mk
@@ -0,0 +1,41 @@
1## chip/board settings
2# - the next two should match the directories in
3# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
4# - For Teensies, FAMILY = KINETIS and SERIES is either
5# KL2x (LC) or K20x (3.0,3.1,3.2).
6MCU_FAMILY = KINETIS
7MCU_SERIES = K20x
8
9# Linker script to use
10# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
11# or <this_dir>/ld/
12# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
13# - LDSCRIPT =
14# - MKL26Z64 for Teensy LC
15# - MK20DX128 for Teensy 3.0
16# - MK20DX256 for Teensy 3.1 and 3.2
17MCU_LDSCRIPT = MK20DX256
18
19# Startup code to use
20# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
21# - STARTUP =
22# - kl2x for Teensy LC
23# - k20x5 for Teensy 3.0
24# - k20x7 for Teensy 3.1 and 3.2
25MCU_STARTUP = k20x7
26
27# Board: it should exist either in <chibios>/os/hal/boards/
28# or <this_dir>/boards
29# - BOARD =
30# - PJRC_TEENSY_LC for Teensy LC
31# - PJRC_TEENSY_3 for Teensy 3.0
32# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
33BOARD = PJRC_TEENSY_3_1
34
35# Cortex version
36# Teensy LC is cortex-m0plus; Teensy 3.x are cortex-m4
37MCU = cortex-m4
38
39# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
40# I.e. 6 for Teensy LC; 7 for Teensy 3.x
41ARMV = 7
diff --git a/keyboards/handwired/onekey/teensy_lc/chconf.h b/keyboards/handwired/onekey/teensy_lc/chconf.h
new file mode 100644
index 000000000..3294ac7ee
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/chconf.h
@@ -0,0 +1,524 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32
33/*===========================================================================*/
34/**
35 * @name System timers settings
36 * @{
37 */
38/*===========================================================================*/
39
40/**
41 * @brief System time counter resolution.
42 * @note Allowed values are 16 or 32 bits.
43 */
44#define CH_CFG_ST_RESOLUTION 32
45
46/**
47 * @brief System tick frequency.
48 * @details Frequency of the system timer that drives the system ticks. This
49 * setting also defines the system tick time unit.
50 */
51#define CH_CFG_ST_FREQUENCY 1000
52
53/**
54 * @brief Time delta constant for the tick-less mode.
55 * @note If this value is zero then the system uses the classic
56 * periodic tick. This value represents the minimum number
57 * of ticks that is safe to specify in a timeout directive.
58 * The value one is not valid, timeouts are rounded up to
59 * this value.
60 */
61#define CH_CFG_ST_TIMEDELTA 0
62
63/** @} */
64
65/*===========================================================================*/
66/**
67 * @name Kernel parameters and options
68 * @{
69 */
70/*===========================================================================*/
71
72/**
73 * @brief Round robin interval.
74 * @details This constant is the number of system ticks allowed for the
75 * threads before preemption occurs. Setting this value to zero
76 * disables the preemption for threads with equal priority and the
77 * round robin becomes cooperative. Note that higher priority
78 * threads can still preempt, the kernel is always preemptive.
79 * @note Disabling the round robin preemption makes the kernel more compact
80 * and generally faster.
81 * @note The round robin preemption is not supported in tickless mode and
82 * must be set to zero in that case.
83 */
84#define CH_CFG_TIME_QUANTUM 20
85
86/**
87 * @brief Managed RAM size.
88 * @details Size of the RAM area to be managed by the OS. If set to zero
89 * then the whole available RAM is used. The core memory is made
90 * available to the heap allocator and/or can be used directly through
91 * the simplified core memory allocator.
92 *
93 * @note In order to let the OS manage the whole RAM the linker script must
94 * provide the @p __heap_base__ and @p __heap_end__ symbols.
95 * @note Requires @p CH_CFG_USE_MEMCORE.
96 */
97#define CH_CFG_MEMCORE_SIZE 0
98
99/**
100 * @brief Idle thread automatic spawn suppression.
101 * @details When this option is activated the function @p chSysInit()
102 * does not spawn the idle thread. The application @p main()
103 * function becomes the idle thread and must implement an
104 * infinite loop.
105 */
106#define CH_CFG_NO_IDLE_THREAD FALSE
107
108/* Use __WFI in the idle thread for waiting. Does lower the power
109 * consumption. */
110#define CORTEX_ENABLE_WFI_IDLE TRUE
111
112/** @} */
113
114/*===========================================================================*/
115/**
116 * @name Performance options
117 * @{
118 */
119/*===========================================================================*/
120
121/**
122 * @brief OS optimization.
123 * @details If enabled then time efficient rather than space efficient code
124 * is used when two possible implementations exist.
125 *
126 * @note This is not related to the compiler optimization options.
127 * @note The default is @p TRUE.
128 */
129#define CH_CFG_OPTIMIZE_SPEED TRUE
130
131/** @} */
132
133/*===========================================================================*/
134/**
135 * @name Subsystem options
136 * @{
137 */
138/*===========================================================================*/
139
140/**
141 * @brief Time Measurement APIs.
142 * @details If enabled then the time measurement APIs are included in
143 * the kernel.
144 *
145 * @note The default is @p TRUE.
146 */
147#define CH_CFG_USE_TM FALSE
148
149/**
150 * @brief Threads registry APIs.
151 * @details If enabled then the registry APIs are included in the kernel.
152 *
153 * @note The default is @p TRUE.
154 */
155#define CH_CFG_USE_REGISTRY TRUE
156
157/**
158 * @brief Threads synchronization APIs.
159 * @details If enabled then the @p chThdWait() function is included in
160 * the kernel.
161 *
162 * @note The default is @p TRUE.
163 */
164#define CH_CFG_USE_WAITEXIT TRUE
165
166/**
167 * @brief Semaphores APIs.
168 * @details If enabled then the Semaphores APIs are included in the kernel.
169 *
170 * @note The default is @p TRUE.
171 */
172#define CH_CFG_USE_SEMAPHORES TRUE
173
174/**
175 * @brief Semaphores queuing mode.
176 * @details If enabled then the threads are enqueued on semaphores by
177 * priority rather than in FIFO order.
178 *
179 * @note The default is @p FALSE. Enable this if you have special
180 * requirements.
181 * @note Requires @p CH_CFG_USE_SEMAPHORES.
182 */
183#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
184
185/**
186 * @brief Mutexes APIs.
187 * @details If enabled then the mutexes APIs are included in the kernel.
188 *
189 * @note The default is @p TRUE.
190 */
191#define CH_CFG_USE_MUTEXES TRUE
192
193/**
194 * @brief Enables recursive behavior on mutexes.
195 * @note Recursive mutexes are heavier and have an increased
196 * memory footprint.
197 *
198 * @note The default is @p FALSE.
199 * @note Requires @p CH_CFG_USE_MUTEXES.
200 */
201#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
202
203/**
204 * @brief Conditional Variables APIs.
205 * @details If enabled then the conditional variables APIs are included
206 * in the kernel.
207 *
208 * @note The default is @p TRUE.
209 * @note Requires @p CH_CFG_USE_MUTEXES.
210 */
211#define CH_CFG_USE_CONDVARS TRUE
212
213/**
214 * @brief Conditional Variables APIs with timeout.
215 * @details If enabled then the conditional variables APIs with timeout
216 * specification are included in the kernel.
217 *
218 * @note The default is @p TRUE.
219 * @note Requires @p CH_CFG_USE_CONDVARS.
220 */
221#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
222
223/**
224 * @brief Events Flags APIs.
225 * @details If enabled then the event flags APIs are included in the kernel.
226 *
227 * @note The default is @p TRUE.
228 */
229#define CH_CFG_USE_EVENTS TRUE
230
231/**
232 * @brief Events Flags APIs with timeout.
233 * @details If enabled then the events APIs with timeout specification
234 * are included in the kernel.
235 *
236 * @note The default is @p TRUE.
237 * @note Requires @p CH_CFG_USE_EVENTS.
238 */
239#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
240
241/**
242 * @brief Synchronous Messages APIs.
243 * @details If enabled then the synchronous messages APIs are included
244 * in the kernel.
245 *
246 * @note The default is @p TRUE.
247 */
248#define CH_CFG_USE_MESSAGES TRUE
249
250/**
251 * @brief Synchronous Messages queuing mode.
252 * @details If enabled then messages are served by priority rather than in
253 * FIFO order.
254 *
255 * @note The default is @p FALSE. Enable this if you have special
256 * requirements.
257 * @note Requires @p CH_CFG_USE_MESSAGES.
258 */
259#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
260
261/**
262 * @brief Mailboxes APIs.
263 * @details If enabled then the asynchronous messages (mailboxes) APIs are
264 * included in the kernel.
265 *
266 * @note The default is @p TRUE.
267 * @note Requires @p CH_CFG_USE_SEMAPHORES.
268 */
269#define CH_CFG_USE_MAILBOXES TRUE
270
271/**
272 * @brief Core Memory Manager APIs.
273 * @details If enabled then the core memory manager APIs are included
274 * in the kernel.
275 *
276 * @note The default is @p TRUE.
277 */
278#define CH_CFG_USE_MEMCORE TRUE
279
280/**
281 * @brief Heap Allocator APIs.
282 * @details If enabled then the memory heap allocator APIs are included
283 * in the kernel.
284 *
285 * @note The default is @p TRUE.
286 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
287 * @p CH_CFG_USE_SEMAPHORES.
288 * @note Mutexes are recommended.
289 */
290#define CH_CFG_USE_HEAP TRUE
291
292/**
293 * @brief Memory Pools Allocator APIs.
294 * @details If enabled then the memory pools allocator APIs are included
295 * in the kernel.
296 *
297 * @note The default is @p TRUE.
298 */
299#define CH_CFG_USE_MEMPOOLS TRUE
300
301/**
302 * @brief Dynamic Threads APIs.
303 * @details If enabled then the dynamic threads creation APIs are included
304 * in the kernel.
305 *
306 * @note The default is @p TRUE.
307 * @note Requires @p CH_CFG_USE_WAITEXIT.
308 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
309 */
310#define CH_CFG_USE_DYNAMIC TRUE
311
312/** @} */
313
314/*===========================================================================*/
315/**
316 * @name Debug options
317 * @{
318 */
319/*===========================================================================*/
320
321/**
322 * @brief Debug option, kernel statistics.
323 *
324 * @note The default is @p FALSE.
325 */
326#define CH_DBG_STATISTICS FALSE
327
328/**
329 * @brief Debug option, system state check.
330 * @details If enabled the correct call protocol for system APIs is checked
331 * at runtime.
332 *
333 * @note The default is @p FALSE.
334 */
335#define CH_DBG_SYSTEM_STATE_CHECK TRUE
336
337/**
338 * @brief Debug option, parameters checks.
339 * @details If enabled then the checks on the API functions input
340 * parameters are activated.
341 *
342 * @note The default is @p FALSE.
343 */
344#define CH_DBG_ENABLE_CHECKS TRUE
345
346/**
347 * @brief Debug option, consistency checks.
348 * @details If enabled then all the assertions in the kernel code are
349 * activated. This includes consistency checks inside the kernel,
350 * runtime anomalies and port-defined checks.
351 *
352 * @note The default is @p FALSE.
353 */
354#define CH_DBG_ENABLE_ASSERTS TRUE
355
356/**
357 * @brief Debug option, trace buffer.
358 * @details If enabled then the trace buffer is activated.
359 *
360 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
361 */
362#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
363
364/**
365 * @brief Trace buffer entries.
366 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
367 * different from @p CH_DBG_TRACE_MASK_DISABLED.
368 */
369#define CH_DBG_TRACE_BUFFER_SIZE 128
370
371/**
372 * @brief Debug option, stack checks.
373 * @details If enabled then a runtime stack check is performed.
374 *
375 * @note The default is @p FALSE.
376 * @note The stack check is performed in a architecture/port dependent way.
377 * It may not be implemented or some ports.
378 * @note The default failure mode is to halt the system with the global
379 * @p panic_msg variable set to @p NULL.
380 */
381#define CH_DBG_ENABLE_STACK_CHECK TRUE
382
383/**
384 * @brief Debug option, stacks initialization.
385 * @details If enabled then the threads working area is filled with a byte
386 * value when a thread is created. This can be useful for the
387 * runtime measurement of the used stack.
388 *
389 * @note The default is @p FALSE.
390 */
391#define CH_DBG_FILL_THREADS TRUE
392
393/**
394 * @brief Debug option, threads profiling.
395 * @details If enabled then a field is added to the @p thread_t structure that
396 * counts the system ticks occurred while executing the thread.
397 *
398 * @note The default is @p FALSE.
399 * @note This debug option is not currently compatible with the
400 * tickless mode.
401 */
402#define CH_DBG_THREADS_PROFILING FALSE
403
404/** @} */
405
406/*===========================================================================*/
407/**
408 * @name Kernel hooks
409 * @{
410 */
411/*===========================================================================*/
412
413/**
414 * @brief Threads descriptor structure extension.
415 * @details User fields added to the end of the @p thread_t structure.
416 */
417#define CH_CFG_THREAD_EXTRA_FIELDS \
418 /* Add threads custom fields here.*/
419
420/**
421 * @brief Threads initialization hook.
422 * @details User initialization code added to the @p chThdInit() API.
423 *
424 * @note It is invoked from within @p chThdInit() and implicitly from all
425 * the threads creation APIs.
426 */
427#define CH_CFG_THREAD_INIT_HOOK(tp) { \
428 /* Add threads initialization code here.*/ \
429}
430
431/**
432 * @brief Threads finalization hook.
433 * @details User finalization code added to the @p chThdExit() API.
434 */
435#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
436 /* Add threads finalization code here.*/ \
437}
438
439/**
440 * @brief Context switch hook.
441 * @details This hook is invoked just before switching between threads.
442 */
443#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
444 /* Context switch code here.*/ \
445}
446
447/**
448 * @brief ISR enter hook.
449 */
450#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
451 /* IRQ prologue code here.*/ \
452}
453
454/**
455 * @brief ISR exit hook.
456 */
457#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
458 /* IRQ epilogue code here.*/ \
459}
460
461/**
462 * @brief Idle thread enter hook.
463 * @note This hook is invoked within a critical zone, no OS functions
464 * should be invoked from here.
465 * @note This macro can be used to activate a power saving mode.
466 */
467#define CH_CFG_IDLE_ENTER_HOOK() { \
468 /* Idle-enter code here.*/ \
469}
470
471/**
472 * @brief Idle thread leave hook.
473 * @note This hook is invoked within a critical zone, no OS functions
474 * should be invoked from here.
475 * @note This macro can be used to deactivate a power saving mode.
476 */
477#define CH_CFG_IDLE_LEAVE_HOOK() { \
478 /* Idle-leave code here.*/ \
479}
480
481/**
482 * @brief Idle Loop hook.
483 * @details This hook is continuously invoked by the idle thread loop.
484 */
485#define CH_CFG_IDLE_LOOP_HOOK() { \
486 /* Idle loop code here.*/ \
487}
488
489/**
490 * @brief System tick event hook.
491 * @details This hook is invoked in the system tick handler immediately
492 * after processing the virtual timers queue.
493 */
494#define CH_CFG_SYSTEM_TICK_HOOK() { \
495 /* System tick event code here.*/ \
496}
497
498/**
499 * @brief System halt hook.
500 * @details This hook is invoked in case to a system halting error before
501 * the system is halted.
502 */
503#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
504 /* System halt code here.*/ \
505}
506
507/**
508 * @brief Trace hook.
509 * @details This hook is invoked each time a new record is written in the
510 * trace buffer.
511 */
512#define CH_CFG_TRACE_HOOK(tep) { \
513 /* Trace code here.*/ \
514}
515
516/** @} */
517
518/*===========================================================================*/
519/* Port-specific settings (override port settings defaulted in chcore.h). */
520/*===========================================================================*/
521
522#endif /* CHCONF_H */
523
524/** @} */
diff --git a/keyboards/handwired/onekey/teensy_lc/config.h b/keyboards/handwired/onekey/teensy_lc/config.h
new file mode 100644
index 000000000..0d82a0578
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/config.h
@@ -0,0 +1,24 @@
1/* Copyright 2019
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19// TODO: including this causes "error: expected identifier before '(' token" errors
20//#include "config_common.h"
21
22#define MATRIX_COL_PINS { D5 }
23#define MATRIX_ROW_PINS { B2 }
24#define UNUSED_PINS
diff --git a/keyboards/handwired/onekey/teensy_lc/halconf.h b/keyboards/handwired/onekey/teensy_lc/halconf.h
new file mode 100644
index 000000000..1b6f2adc2
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/halconf.h
@@ -0,0 +1,354 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17/**
18 * @file templates/halconf.h
19 * @brief HAL configuration header.
20 * @details HAL configuration file, this file allows to enable or disable the
21 * various device drivers from your application. You may also use
22 * this file in order to override the device drivers default settings.
23 *
24 * @addtogroup HAL_CONF
25 * @{
26 */
27
28#ifndef _HALCONF_H_
29#define _HALCONF_H_
30
31#include "mcuconf.h"
32
33/**
34 * @brief Enables the PAL subsystem.
35 */
36#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
37#define HAL_USE_PAL TRUE
38#endif
39
40/**
41 * @brief Enables the ADC subsystem.
42 */
43#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
44#define HAL_USE_ADC FALSE
45#endif
46
47/**
48 * @brief Enables the CAN subsystem.
49 */
50#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
51#define HAL_USE_CAN FALSE
52#endif
53
54/**
55 * @brief Enables the DAC subsystem.
56 */
57#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
58#define HAL_USE_DAC FALSE
59#endif
60
61/**
62 * @brief Enables the EXT subsystem.
63 */
64#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
65#define HAL_USE_EXT FALSE
66#endif
67
68/**
69 * @brief Enables the GPT subsystem.
70 */
71#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
72#define HAL_USE_GPT FALSE
73#endif
74
75/**
76 * @brief Enables the I2C subsystem.
77 */
78#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
79#define HAL_USE_I2C FALSE
80#endif
81
82/**
83 * @brief Enables the I2S subsystem.
84 */
85#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
86#define HAL_USE_I2S FALSE
87#endif
88
89/**
90 * @brief Enables the ICU subsystem.
91 */
92#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
93#define HAL_USE_ICU FALSE
94#endif
95
96/**
97 * @brief Enables the MAC subsystem.
98 */
99#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
100#define HAL_USE_MAC FALSE
101#endif
102
103/**
104 * @brief Enables the MMC_SPI subsystem.
105 */
106#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
107#define HAL_USE_MMC_SPI FALSE
108#endif
109
110/**
111 * @brief Enables the PWM subsystem.
112 */
113#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
114#define HAL_USE_PWM FALSE
115#endif
116
117/**
118 * @brief Enables the RTC subsystem.
119 */
120#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
121#define HAL_USE_RTC FALSE
122#endif
123
124/**
125 * @brief Enables the SDC subsystem.
126 */
127#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
128#define HAL_USE_SDC FALSE
129#endif
130
131/**
132 * @brief Enables the SERIAL subsystem.
133 */
134#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
135#define HAL_USE_SERIAL FALSE
136#endif
137
138/**
139 * @brief Enables the SERIAL over USB subsystem.
140 */
141#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
142#define HAL_USE_SERIAL_USB FALSE
143#endif
144
145/**
146 * @brief Enables the SPI subsystem.
147 */
148#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
149#define HAL_USE_SPI FALSE
150#endif
151
152/**
153 * @brief Enables the UART subsystem.
154 */
155#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
156#define HAL_USE_UART FALSE
157#endif
158
159/**
160 * @brief Enables the USB subsystem.
161 */
162#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
163#define HAL_USE_USB TRUE
164#endif
165
166/**
167 * @brief Enables the WDG subsystem.
168 */
169#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
170#define HAL_USE_WDG FALSE
171#endif
172
173/*===========================================================================*/
174/* ADC driver related settings. */
175/*===========================================================================*/
176
177/**
178 * @brief Enables synchronous APIs.
179 * @note Disabling this option saves both code and data space.
180 */
181#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
182#define ADC_USE_WAIT TRUE
183#endif
184
185/**
186 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
187 * @note Disabling this option saves both code and data space.
188 */
189#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
190#define ADC_USE_MUTUAL_EXCLUSION TRUE
191#endif
192
193/*===========================================================================*/
194/* CAN driver related settings. */
195/*===========================================================================*/
196
197/**
198 * @brief Sleep mode related APIs inclusion switch.
199 */
200#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
201#define CAN_USE_SLEEP_MODE TRUE
202#endif
203
204/*===========================================================================*/
205/* I2C driver related settings. */
206/*===========================================================================*/
207
208/**
209 * @brief Enables the mutual exclusion APIs on the I2C bus.
210 */
211#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
212#define I2C_USE_MUTUAL_EXCLUSION TRUE
213#endif
214
215/*===========================================================================*/
216/* MAC driver related settings. */
217/*===========================================================================*/
218
219/**
220 * @brief Enables an event sources for incoming packets.
221 */
222#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
223#define MAC_USE_ZERO_COPY FALSE
224#endif
225
226/**
227 * @brief Enables an event sources for incoming packets.
228 */
229#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
230#define MAC_USE_EVENTS TRUE
231#endif
232
233/*===========================================================================*/
234/* MMC_SPI driver related settings. */
235/*===========================================================================*/
236
237/**
238 * @brief Delays insertions.
239 * @details If enabled this options inserts delays into the MMC waiting
240 * routines releasing some extra CPU time for the threads with
241 * lower priority, this may slow down the driver a bit however.
242 * This option is recommended also if the SPI driver does not
243 * use a DMA channel and heavily loads the CPU.
244 */
245#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
246#define MMC_NICE_WAITING TRUE
247#endif
248
249/*===========================================================================*/
250/* SDC driver related settings. */
251/*===========================================================================*/
252
253/**
254 * @brief Number of initialization attempts before rejecting the card.
255 * @note Attempts are performed at 10mS intervals.
256 */
257#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
258#define SDC_INIT_RETRY 100
259#endif
260
261/**
262 * @brief Include support for MMC cards.
263 * @note MMC support is not yet implemented so this option must be kept
264 * at @p FALSE.
265 */
266#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
267#define SDC_MMC_SUPPORT FALSE
268#endif
269
270/**
271 * @brief Delays insertions.
272 * @details If enabled this options inserts delays into the MMC waiting
273 * routines releasing some extra CPU time for the threads with
274 * lower priority, this may slow down the driver a bit however.
275 */
276#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
277#define SDC_NICE_WAITING TRUE
278#endif
279
280/*===========================================================================*/
281/* SERIAL driver related settings. */
282/*===========================================================================*/
283
284/**
285 * @brief Default bit rate.
286 * @details Configuration parameter, this is the baud rate selected for the
287 * default configuration.
288 */
289#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
290#define SERIAL_DEFAULT_BITRATE 38400
291#endif
292
293/**
294 * @brief Serial buffers size.
295 * @details Configuration parameter, you can change the depth of the queue
296 * buffers depending on the requirements of your application.
297 * @note The default is 64 bytes for both the transmission and receive
298 * buffers.
299 */
300#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
301#define SERIAL_BUFFERS_SIZE 16
302#endif
303
304/*===========================================================================*/
305/* SERIAL_USB driver related setting. */
306/*===========================================================================*/
307
308/**
309 * @brief Serial over USB buffers size.
310 * @details Configuration parameter, the buffer size must be a multiple of
311 * the USB data endpoint maximum packet size.
312 * @note The default is 64 bytes for both the transmission and receive
313 * buffers.
314 */
315#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
316#define SERIAL_USB_BUFFERS_SIZE 1
317#endif
318
319/*===========================================================================*/
320/* SPI driver related settings. */
321/*===========================================================================*/
322
323/**
324 * @brief Enables synchronous APIs.
325 * @note Disabling this option saves both code and data space.
326 */
327#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
328#define SPI_USE_WAIT TRUE
329#endif
330
331/**
332 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
333 * @note Disabling this option saves both code and data space.
334 */
335#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
336#define SPI_USE_MUTUAL_EXCLUSION TRUE
337#endif
338
339/*===========================================================================*/
340/* USB driver related settings. */
341/*===========================================================================*/
342
343/**
344 * @brief Enables synchronous APIs.
345 * @note Disabling this option saves both code and data space.
346 */
347#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
348#define USB_USE_WAIT TRUE
349#endif
350
351#endif /* _HALCONF_H_ */
352
353/** @} */
354
diff --git a/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld b/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld
new file mode 100644
index 000000000..c4ca8b874
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/ld/MKL26Z64.ld
@@ -0,0 +1,105 @@
1/*
2 * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com
3 * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24/*
25 * KL26Z64 memory setup.
26 */
27MEMORY
28{
29 flash0 : org = 0x00000000, len = 0x100
30 flash1 : org = 0x00000400, len = 0x10
31 flash2 : org = 0x00000410, len = 62k - 0x410
32 flash3 : org = 0x0000F800, len = 2k
33 flash4 : org = 0x00000000, len = 0
34 flash5 : org = 0x00000000, len = 0
35 flash6 : org = 0x00000000, len = 0
36 flash7 : org = 0x00000000, len = 0
37 ram0 : org = 0x1FFFF800, len = 8k
38 ram1 : org = 0x00000000, len = 0
39 ram2 : org = 0x00000000, len = 0
40 ram3 : org = 0x00000000, len = 0
41 ram4 : org = 0x00000000, len = 0
42 ram5 : org = 0x00000000, len = 0
43 ram6 : org = 0x00000000, len = 0
44 ram7 : org = 0x00000000, len = 0
45}
46
47/* Flash region for the configuration bytes.*/
48SECTIONS
49{
50 .cfmprotect : ALIGN(4) SUBALIGN(4)
51 {
52 KEEP(*(.cfmconfig))
53 } > flash1
54}
55
56/* For each data/text section two region are defined, a virtual region
57 and a load region (_LMA suffix).*/
58
59/* Flash region to be used for exception vectors.*/
60REGION_ALIAS("VECTORS_FLASH", flash0);
61REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
62
63/* Flash region to be used for constructors and destructors.*/
64REGION_ALIAS("XTORS_FLASH", flash2);
65REGION_ALIAS("XTORS_FLASH_LMA", flash2);
66
67/* Flash region to be used for code text.*/
68REGION_ALIAS("TEXT_FLASH", flash2);
69REGION_ALIAS("TEXT_FLASH_LMA", flash2);
70
71/* Flash region to be used for read only data.*/
72REGION_ALIAS("RODATA_FLASH", flash2);
73REGION_ALIAS("RODATA_FLASH_LMA", flash2);
74
75/* Flash region to be used for various.*/
76REGION_ALIAS("VARIOUS_FLASH", flash2);
77REGION_ALIAS("VARIOUS_FLASH_LMA", flash2);
78
79/* Flash region to be used for RAM(n) initialization data.*/
80REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2);
81
82/* RAM region to be used for Main stack. This stack accommodates the processing
83 of all exceptions and interrupts.*/
84REGION_ALIAS("MAIN_STACK_RAM", ram0);
85
86/* RAM region to be used for the process stack. This is the stack used by
87 the main() function.*/
88REGION_ALIAS("PROCESS_STACK_RAM", ram0);
89
90/* RAM region to be used for data segment.*/
91REGION_ALIAS("DATA_RAM", ram0);
92REGION_ALIAS("DATA_RAM_LMA", flash2);
93
94/* RAM region to be used for BSS segment.*/
95REGION_ALIAS("BSS_RAM", ram0);
96
97/* RAM region to be used for the default heap.*/
98REGION_ALIAS("HEAP_RAM", ram0);
99
100__eeprom_workarea_start__ = ORIGIN(flash3);
101__eeprom_workarea_size__ = LENGTH(flash3);
102__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__;
103
104/* Generic rules inclusion.*/
105INCLUDE rules.ld
diff --git a/keyboards/handwired/onekey/teensy_lc/mcuconf.h b/keyboards/handwired/onekey/teensy_lc/mcuconf.h
new file mode 100644
index 000000000..ea576df5b
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/mcuconf.h
@@ -0,0 +1,45 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#ifndef _MCUCONF_H_
18#define _MCUCONF_H_
19
20#define KL2x_MCUCONF
21
22/*
23 * HAL driver system settings.
24 */
25/* PEE mode - 48MHz system clock driven by (16 MHz) external crystal. */
26#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE
27#define KINETIS_PLLCLK_FREQUENCY 96000000UL
28#define KINETIS_SYSCLK_FREQUENCY 48000000UL
29
30/*
31 * SERIAL driver system settings.
32 */
33#define KINETIS_SERIAL_USE_UART0 TRUE
34
35/*
36 * USB driver settings
37 */
38#define KINETIS_USB_USE_USB0 TRUE
39
40/* Need to redefine this, since the default (configured for K20x) might not apply
41 * 2 for Teensy LC
42 * 5 for Teensy 3.x */
43#define KINETIS_USB_USB0_IRQ_PRIORITY 2
44
45#endif /* _MCUCONF_H_ */
diff --git a/keyboards/handwired/onekey/teensy_lc/readme.md b/keyboards/handwired/onekey/teensy_lc/readme.md
new file mode 100644
index 000000000..676d794d8
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/readme.md
@@ -0,0 +1,40 @@
1# Teensy LC onekey
2
3To trigger keypress, short together pins *D5* and *B2* (marked on the PCB as *20* and *19*).
4
5## Hardware
6
7### Pins
8When setting matrix pins, you need to use the MCU definitions instead of what is printed on the PCB. Sourced from <https://www.pjrc.com/teensy/schematic_lc.gif>. The following table can be used to convert between the two.
9
10| PCB | MCU | Notes |
11|------- |-----|-------|
12| 0 | B16 | |
13| 1 | B17 | |
14| 2 | D0 | |
15| 3 | A1 | |
16| 4 | A2 | |
17| 5 | D7 | |
18| 6 | D4 | |
19| 7 | D2 | |
20| 8 | D3 | |
21| 9 | C3 | |
22| 10 | C4 | |
23| 11 | C6 | |
24| 12 | C7 | |
25| 13/LED | C5 | |
26| 14/A0 | D1 | |
27| 15/A1 | C0 | |
28| 16/A2 | B0 | |
29| 17/A3 | B1 | |
30| 18/A4 | B3 | |
31| 19/A5 | B2 | |
32| 20/A6 | D5 | |
33| 21/A7 | D6 | |
34| 22/A8 | C1 | |
35| 23/A9 | C2 | |
36| 24/A10 | E2 | |
37| 25/A11 | E21 | *[1]* |
38| 26/A12 | E30 | *[1]* |
39
40*[1]* - Currently not configured and may require extra work to implement.
diff --git a/keyboards/handwired/onekey/teensy_lc/rules.mk b/keyboards/handwired/onekey/teensy_lc/rules.mk
new file mode 100644
index 000000000..7859f6d74
--- /dev/null
+++ b/keyboards/handwired/onekey/teensy_lc/rules.mk
@@ -0,0 +1,41 @@
1## chip/board settings
2# - the next two should match the directories in
3# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
4# - For Teensies, FAMILY = KINETIS and SERIES is either
5# KL2x (LC) or K20x (3.0,3.1,3.2).
6MCU_FAMILY = KINETIS
7MCU_SERIES = KL2x
8
9# Linker script to use
10# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
11# or <this_dir>/ld/
12# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
13# - LDSCRIPT =
14# - MKL26Z64 for Teensy LC
15# - MK20DX128 for Teensy 3.0
16# - MK20DX256 for Teensy 3.1 and 3.2
17MCU_LDSCRIPT = MKL26Z64
18
19# Startup code to use
20# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
21# - STARTUP =
22# - kl2x for Teensy LC
23# - k20x5 for Teensy 3.0
24# - k20x7 for Teensy 3.1 and 3.2
25MCU_STARTUP = kl2x
26
27# Board: it should exist either in <chibios>/os/hal/boards/
28# or <this_dir>/boards
29# - BOARD =
30# - PJRC_TEENSY_LC for Teensy LC
31# - PJRC_TEENSY_3 for Teensy 3.0
32# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
33BOARD = PJRC_TEENSY_LC
34
35# Cortex version
36# Teensy LC is cortex-m0plus; Teensy 3.x are cortex-m4
37MCU = cortex-m0plus
38
39# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
40# I.e. 6 for Teensy LC; 7 for Teensy 3.x
41ARMV = 6