Merge remote-tracking branch 'refs/remotes/tmk/master'
This commit is contained in:
commit
126dbd2f2b
@ -7,6 +7,9 @@ The latest source code is available here: <http://github.com/tmk/tmk_keyboard>
|
|||||||
|
|
||||||
Updates
|
Updates
|
||||||
-------
|
-------
|
||||||
|
#### 2017/01/11
|
||||||
|
Changed action code for `ACTION_LAYER_MODS` and this may cause incompatibility with existent shared URL and downloaded firmwware of keymap editor. If you are using the action you just have to redefine it on keymap editor. Existent keymap code should not suffer.
|
||||||
|
|
||||||
#### 2016/06/26
|
#### 2016/06/26
|
||||||
Keymap framework was updated. `fn_actions[]` should be defined as `action_t` instead of `uint16_t`. And default code for keymap handling is now included in core you just need define `uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]` and `action_t fn_actions[]`.
|
Keymap framework was updated. `fn_actions[]` should be defined as `action_t` instead of `uint16_t`. And default code for keymap handling is now included in core you just need define `uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]` and `action_t fn_actions[]`.
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,8 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "unimap_common.h"
|
#include "unimap_common.h"
|
||||||
|
|
||||||
|
|
||||||
#define AC_FN0 ACTION_LAYER_TAP_KEY(1, KC_GRV)
|
#define AC_FN0 ACTION_LAYER_TAP_KEY(1, KC_GRV)
|
||||||
#define AC_FN1 ACTION_LAYER_TAP_KEY(1, KC_BSLS)
|
#define AC_FN1 ACTION_LAYER_TAP_KEY(1, KC_BSLS)
|
||||||
|
#define AC_PKEY ACTION_MODS_TAP_KEY(MOD_NONE, KC_POWER)
|
||||||
|
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
|
||||||
@ -26,7 +27,7 @@ const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section ("
|
|||||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
|
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
|
||||||
#endif
|
#endif
|
||||||
UNIMAP(
|
UNIMAP(
|
||||||
MPLY,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, F24,
|
MPLY,NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, PKEY,
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,
|
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE,
|
||||||
FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
|
FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST,
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, FN1, DEL, END, PGDN, P7, P8, P9, PMNS,
|
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, FN1, DEL, END, PGDN, P7, P8, P9, PMNS,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "unimap_trans.h"
|
#include "unimap_trans.h"
|
||||||
|
|
||||||
|
|
||||||
#define AC_L1 ACTION_LAYER_MOMENTARY(1)
|
#define AC_L1 ACTION_LAYER_TAP_KEY(1, KC_RGUI)
|
||||||
|
|
||||||
|
|
||||||
#ifdef KEYMAP_SECTION_ENABLE
|
#ifdef KEYMAP_SECTION_ENABLE
|
||||||
@ -43,7 +43,7 @@ const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
|
|||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, \
|
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, \
|
||||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
|
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, \
|
||||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,ESC, \
|
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,ESC, \
|
||||||
LCTL,LGUI,LALT, SPC, APP, RALT,RGUI,L1),
|
LCTL,LGUI,LALT, SPC, APP, RALT,L1, RCTL),
|
||||||
|
|
||||||
[1] = UNIMAP_ALPS64( \
|
[1] = UNIMAP_ALPS64( \
|
||||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
|
||||||
|
@ -96,7 +96,7 @@ ARCH ?= AVR8
|
|||||||
F_USB ?= $(F_CPU)
|
F_USB ?= $(F_CPU)
|
||||||
|
|
||||||
# Interrupt driven control endpoint task
|
# Interrupt driven control endpoint task
|
||||||
#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||||
|
|
||||||
|
|
||||||
# Boot Section Size in *bytes*
|
# Boot Section Size in *bytes*
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -9,10 +9,10 @@
|
|||||||
void battery_init(void)
|
void battery_init(void)
|
||||||
{
|
{
|
||||||
// blink
|
// blink
|
||||||
battery_led(LED_ON); _delay_ms(500);
|
battery_led(LED_ON); _delay_ms(100);
|
||||||
battery_led(LED_OFF); _delay_ms(500);
|
battery_led(LED_OFF); _delay_ms(100);
|
||||||
battery_led(LED_ON); _delay_ms(500);
|
battery_led(LED_ON); _delay_ms(100);
|
||||||
battery_led(LED_OFF); _delay_ms(500);
|
battery_led(LED_OFF); _delay_ms(100);
|
||||||
// LED indicates charger status
|
// LED indicates charger status
|
||||||
battery_led(LED_CHARGER);
|
battery_led(LED_CHARGER);
|
||||||
|
|
||||||
|
70
keyboard/kl27z_kbd/Makefile
Normal file
70
keyboard/kl27z_kbd/Makefile
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Target file name (without extension).
|
||||||
|
PROJECT = kl27z_kbd
|
||||||
|
|
||||||
|
# Directory common source files exist
|
||||||
|
TMK_DIR = ../../tmk_core
|
||||||
|
|
||||||
|
# Directory keyboard dependent files exist
|
||||||
|
TARGET_DIR = .
|
||||||
|
|
||||||
|
# project specific files
|
||||||
|
SRC = $(PROJECT).c
|
||||||
|
|
||||||
|
CONFIG_H = config.h
|
||||||
|
|
||||||
|
## chip/board settings
|
||||||
|
# - the next two should match the directories in
|
||||||
|
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||||
|
# - For Teensies, FAMILY = KINETIS and SERIES is either
|
||||||
|
# KL2x (LC) or K20x (3.0,3.1,3.2).
|
||||||
|
MCU_FAMILY = KINETIS
|
||||||
|
MCU_SERIES = KL2x
|
||||||
|
|
||||||
|
# Linker script to use
|
||||||
|
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||||
|
# or <this_dir>/ld/
|
||||||
|
# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
|
||||||
|
# - LDSCRIPT =
|
||||||
|
# - MKL26Z64 for Teensy LC
|
||||||
|
# - MK20DX128 for Teensy 3.0
|
||||||
|
# - MK20DX256 for Teensy 3.1 and 3.2
|
||||||
|
MCU_LDSCRIPT = MKL27Z256
|
||||||
|
|
||||||
|
# Startup code to use
|
||||||
|
# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
|
||||||
|
# - STARTUP =
|
||||||
|
# - kl2x for Teensy LC
|
||||||
|
# - k20x5 for Teensy 3.0
|
||||||
|
# - k20x7 for Teensy 3.1 and 3.2
|
||||||
|
MCU_STARTUP = kl2x
|
||||||
|
|
||||||
|
# Board: it should exist either in <chibios>/os/hal/boards/
|
||||||
|
# or <this_dir>/boards
|
||||||
|
# - BOARD =
|
||||||
|
# - PJRC_TEENSY_LC for Teensy LC
|
||||||
|
# - PJRC_TEENSY_3 for Teensy 3.0
|
||||||
|
# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
|
||||||
|
BOARD = ELF
|
||||||
|
|
||||||
|
# Cortex version
|
||||||
|
# Teensy LC is cortex-m0plus; Teensy 3.x are cortex-m4
|
||||||
|
MCU = cortex-m0plus
|
||||||
|
|
||||||
|
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||||
|
# I.e. 6 for Teensy LC; 7 for Teensy 3.x
|
||||||
|
ARMV = 6
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# comment out to disable the options.
|
||||||
|
#
|
||||||
|
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||||
|
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
|
||||||
|
#MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = yes # Console for debug
|
||||||
|
#COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
|
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
|
|
||||||
|
include $(TMK_DIR)/tool/chibios/common.mk
|
||||||
|
include $(TMK_DIR)/tool/chibios/chibios.mk
|
34
keyboard/kl27z_kbd/Matrix.txt
Normal file
34
keyboard/kl27z_kbd/Matrix.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
COL
|
||||||
|
---
|
||||||
|
Anode side, senses keys with internal pull-up.
|
||||||
|
|
||||||
|
Left to right:
|
||||||
|
|
||||||
|
PTD6
|
||||||
|
PTD5
|
||||||
|
PTD4
|
||||||
|
PTD3
|
||||||
|
|
||||||
|
PTA19
|
||||||
|
PTA18
|
||||||
|
PTA4 NMI
|
||||||
|
PTA2
|
||||||
|
PTA1
|
||||||
|
|
||||||
|
PTE25
|
||||||
|
PTE24
|
||||||
|
PTE30
|
||||||
|
PTE29
|
||||||
|
PTE21
|
||||||
|
|
||||||
|
ROW
|
||||||
|
----
|
||||||
|
Cathod side, given strobe with output low.
|
||||||
|
|
||||||
|
Top to bottom:
|
||||||
|
|
||||||
|
PTB3
|
||||||
|
PTB16
|
||||||
|
PTB17
|
||||||
|
PTC0
|
||||||
|
PTC1
|
161
keyboard/kl27z_kbd/README.md
Normal file
161
keyboard/kl27z_kbd/README.md
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
KL27Z128/256 board
|
||||||
|
==================
|
||||||
|
2016/11/30
|
||||||
|
|
||||||
|
KL27Z is configured to use internal 48MHz RC oscillator.
|
||||||
|
|
||||||
|
The board has push button on PTA4 and LED on PTD7. The button works as 'a' key and the LED as an indicator for capslock.
|
||||||
|
|
||||||
|
|
||||||
|
ELF board
|
||||||
|
---------
|
||||||
|
This board acommodates 48QFN chip.
|
||||||
|
|
||||||
|
### prototypte pinout
|
||||||
|
- pcb layout https://deskthority.net/resources/image/33293
|
||||||
|
- schematic https://deskthority.net/resources/image/33252
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
G G
|
||||||
|
N 5 D D N F D D D D D D
|
||||||
|
D V - + D G \ USB / 6 5 4 3 2 1
|
||||||
|
,--------------------- | Conn | --------------------.
|
||||||
|
|39 40 41 42 43 44 | | 1 2 3 4 5 6 |
|
||||||
|
3.3V|38 |_________| 7 |D0
|
||||||
|
A0|37 RST 8 |C7
|
||||||
|
A3|36 9 |C6
|
||||||
|
+A20|35 10|C5+
|
||||||
|
E20|34 11|C4
|
||||||
|
E21|33 BL 12|C3
|
||||||
|
E29|32 13|C2
|
||||||
|
|31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14|
|
||||||
|
`-------------------------------------------------------'
|
||||||
|
E E E A A A 3 A G A C B B B B B C C
|
||||||
|
3 2 2 1 2 4 . 1 N 1 1 1 2 3 1 1 0 1
|
||||||
|
0 4 5 + + 3V 8 D 9 6 7
|
||||||
|
|
||||||
|
|
||||||
|
1 PTD6 12 PTC3 23 GND 34 PTE20*
|
||||||
|
2 PTD5 13 PTC2 24 PTA18 35 PTA20/Reset+
|
||||||
|
3 PTD4 14 PTC1 25 3.3V 36 PTA3/SWD_DIO
|
||||||
|
4 PTD3* 15 PTC0* 26 PTA4/NMI+ 37 PTA0/SWD_CLK
|
||||||
|
5 PTD2* 16 PTB17* 27 PTA2 38 3.3V
|
||||||
|
6 PTD1* 17 PTB16* 28 PTA1+ 39 GND
|
||||||
|
7 PTD0* 18 PTB3* 29 PTE25* 40 VBUS/VREGIN/5V
|
||||||
|
8 PTC7 19 PTB2* 30 PTE24* 41 USB D-
|
||||||
|
9 PTC6 20 PTB1 31 PTE30 42 USB D+
|
||||||
|
10 PTC5+ 21 PTB0 32 PTE29* 43 GND
|
||||||
|
11 PTC4 22 PTA19 33 PTE21* 44 USB Shield/FB
|
||||||
|
+: Pins with resistor or switch
|
||||||
|
*: Pins which don't exist in QFN32
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
TMK KL27Z breakout
|
||||||
|
------------------
|
||||||
|
This board acommodates 48QFN chip.
|
||||||
|
|
||||||
|
### Pinputs
|
||||||
|
|
||||||
|
_\ conn /_
|
||||||
|
1 28
|
||||||
|
: :
|
||||||
|
: PROG :
|
||||||
|
: RST :
|
||||||
|
14 15
|
||||||
|
----------
|
||||||
|
|
||||||
|
1 VUSB 28 GND
|
||||||
|
2 VIN/VREGIN 27 PTD4
|
||||||
|
3 PTD5 26 PTC7
|
||||||
|
4 PTD6 25 PTC6
|
||||||
|
5 PTD7 24 PTC5+
|
||||||
|
6 PTE0* 23 PTC4
|
||||||
|
|
||||||
|
7 3.3V 22 GND
|
||||||
|
8 PTE30 21 PTC3
|
||||||
|
9 PTA0/SWD_CLK 20 PTC2
|
||||||
|
10 PTA1+ 19 PTC1
|
||||||
|
11 PTA2 18 PTB1
|
||||||
|
12 PTA3/SWD_DIO 17 PTB0
|
||||||
|
13 PTA4/NMI+ 16 PTA20/Reset+
|
||||||
|
14 PTA18 15 PTA19
|
||||||
|
*: Pin which doesn't exist in QFN48
|
||||||
|
|
||||||
|
|
||||||
|
#### Pinouts difference between 32QFN and 48QFN
|
||||||
|
48QFN doesn't have PTE0
|
||||||
|
32QFN doesn't have PTD0-3, PTC0, PTE20-21,24,25,29, PTB2-3,16,17
|
||||||
|
|
||||||
|
### ROM bootloader pins
|
||||||
|
See Reference Manual Chapter 13.
|
||||||
|
|
||||||
|
PTA2 LPUART0_TX
|
||||||
|
PTA1 LPUART0_RX *
|
||||||
|
PTB0 I2C0_SCL
|
||||||
|
PTB1 I2C0_SDA
|
||||||
|
PTC4 SPI0_SS_b *
|
||||||
|
PTC7 SPI0_MISO
|
||||||
|
PTC6 SPI0_MOSI
|
||||||
|
PTC5 SPI0_SCK *
|
||||||
|
|
||||||
|
Due to errata e9457, need to pull-up `SPI0_SS_b`(or `SPI0_SCK`) to prevent false detection of SPI.
|
||||||
|
The errata doesn't refer UART though, `LPUART0_RX` also requires pull-up or down resisitor from experience.
|
||||||
|
Without resistor it easily false-detects activity on UART interface with finger touch on the pin.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Resources
|
||||||
|
---------
|
||||||
|
### Deskthority thread
|
||||||
|
https://deskthority.net/workshop-f7/can-we-design-the-teensy-alternative-for-keyboards-t13662-510.html
|
||||||
|
|
||||||
|
### Kinetis KL2x
|
||||||
|
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-based-on-arm-cortex-m0-plus:KL2x
|
||||||
|
|
||||||
|
### KL27Z128/256 Data Sheet
|
||||||
|
http://www.nxp.com/assets/documents/data/en/data-sheets/KL27P64M48SF6.pdf
|
||||||
|
|
||||||
|
### KL27Z128/256 Reference Manual
|
||||||
|
http://www.nxp.com/assets/documents/data/en/reference-manuals/KL27P64M48SF6RM.pdf
|
||||||
|
|
||||||
|
### Errata
|
||||||
|
http://www.nxp.com/assets/documents/data/en/errata/KINETIS_L_1N71K.pdf
|
||||||
|
|
||||||
|
>>
|
||||||
|
e9457: Kinetis Flashloader/ ROM Bootloader: The peripheral auto-detect code in
|
||||||
|
bootloader can falsely detect presence of SPI host causing non-responsive
|
||||||
|
bootloader
|
||||||
|
Description: During the active peripheral detection process, the bootloader can interpret spurious data on
|
||||||
|
the SPI peripheral as valid data. The spurious data causes the bootloader to shutdown all
|
||||||
|
peripherals except the “falsely detected" SPI and enter the command phase loop using the
|
||||||
|
SPI. After the bootloader enters the command phase loop using the SPI, the other peripherals
|
||||||
|
are ignored, so the desired peripheral is no longer active.
|
||||||
|
The bootloader will not falsely detect activity on the I2C, UART, or USB interfaces, so only the
|
||||||
|
SPI interface is affected.
|
||||||
|
Workaround: Ensure that there is an external pull-up on the SPI chip-select pin or that the pin is driven high.
|
||||||
|
This will prevent the bootloader from seeing spurious data due to activity on the SPI clock pin.
|
||||||
|
|
||||||
|
### Kinetis Bootloader and blhost
|
||||||
|
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/kinetis-symbols-footprints-and-models/kinetis-bootloader:KBOOT
|
||||||
|
|
||||||
|
|
||||||
|
Build
|
||||||
|
-----
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
|
||||||
|
Program
|
||||||
|
-------
|
||||||
|
Flash firmware with ROM bootloader.
|
||||||
|
|
||||||
|
blhost -u -- flash-image build/kl27z.hex erase
|
||||||
|
|
||||||
|
|
||||||
|
TODO
|
||||||
|
----
|
||||||
|
- Fix boards/ELF files
|
||||||
|
- add macro `USBx_CTL_RESUME` to ChibiOS-Contrib/os/common/ext/CMSIS/KINETIS/kl27zxxx.h
|
158
keyboard/kl27z_kbd/boards/ELF/board.c
Normal file
158
keyboard/kl27z_kbd/boards/ELF/board.c
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ch.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if HAL_USE_PAL || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief PAL setup.
|
||||||
|
* @details Digital I/O ports static configuration as defined in @p board.h.
|
||||||
|
* This variable is used by the HAL when initializing the PAL driver.
|
||||||
|
*/
|
||||||
|
const PALConfig pal_default_config =
|
||||||
|
{
|
||||||
|
.ports = {
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTA setup.
|
||||||
|
*
|
||||||
|
* on pads: PTA1, PTA2, PTA5, PTA18, PTA19
|
||||||
|
*
|
||||||
|
* PTA0/3 SWD (default SWD, ALT_7: SWD, ALT_1: PTA0/3)
|
||||||
|
* PTA4 NMI button (default NMI_b, ALT_1: PTA4)
|
||||||
|
* PTA20 RESET button (default RESET, ALT_7: RESET, ALT_1: PTA20)
|
||||||
|
*/
|
||||||
|
.port = IOPORT1,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_OUTPUT_PUSHPULL,
|
||||||
|
PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_ALTERNATIVE_7,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTB setup.
|
||||||
|
*
|
||||||
|
* on pads: PTB0, PTB1
|
||||||
|
* LED: PTB18
|
||||||
|
*/
|
||||||
|
.port = IOPORT2,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTC setup.
|
||||||
|
*
|
||||||
|
* on pads: PTC1, PTC2, PTC3, PTC6, PTC7, PTC8, PTC9
|
||||||
|
*/
|
||||||
|
.port = IOPORT3,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTD setup.
|
||||||
|
*
|
||||||
|
* on pads: PTD0 - PTD7
|
||||||
|
*/
|
||||||
|
.port = IOPORT4,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTE setup.
|
||||||
|
*
|
||||||
|
* on pads: PTE0, PTE1, PTE24, PTE25, PTE29, PTE30
|
||||||
|
*/
|
||||||
|
.port = IOPORT5,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Early initialization code.
|
||||||
|
* @details This initialization must be performed just after stack setup
|
||||||
|
* and before any other initialization.
|
||||||
|
*/
|
||||||
|
void __early_init(void) {
|
||||||
|
|
||||||
|
kl2x_clock_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Board-specific initialization code.
|
||||||
|
* @todo Add your board-specific code, if any.
|
||||||
|
*/
|
||||||
|
void boardInit(void) {
|
||||||
|
}
|
56
keyboard/kl27z_kbd/boards/ELF/board.h
Normal file
56
keyboard/kl27z_kbd/boards/ELF/board.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BOARD_H_
|
||||||
|
#define _BOARD_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup for a custom KL27Z breakout board.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Board identifier.
|
||||||
|
*/
|
||||||
|
#define BOARD_KL27Z_BREAKOUT
|
||||||
|
#define BOARD_NAME "Custom KL27Z breakout"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MCU type
|
||||||
|
*/
|
||||||
|
#define KL27Zxxx
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Onboard features.
|
||||||
|
*/
|
||||||
|
//#define GPIO_LED IOPORT1
|
||||||
|
//#define PIN_LED 2
|
||||||
|
// PTD7 on ELF
|
||||||
|
#define GPIO_LED IOPORT4
|
||||||
|
#define PIN_LED 7
|
||||||
|
#define GPIO_BUTTON IOPORT1
|
||||||
|
#define PIN_BUTTON 4
|
||||||
|
|
||||||
|
#if !defined(_FROM_ASM_)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void boardInit(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* _FROM_ASM_ */
|
||||||
|
|
||||||
|
#endif /* _BOARD_H_ */
|
5
keyboard/kl27z_kbd/boards/ELF/board.mk
Normal file
5
keyboard/kl27z_kbd/boards/ELF/board.mk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# List of all the board related files.
|
||||||
|
BOARDSRC = ./boards/ELF/board.c
|
||||||
|
|
||||||
|
# Required include directories
|
||||||
|
BOARDINC = ./boards/ELF
|
524
keyboard/kl27z_kbd/chconf.h
Normal file
524
keyboard/kl27z_kbd/chconf.h
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/chconf.h
|
||||||
|
* @brief Configuration file template.
|
||||||
|
* @details A copy of this file must be placed in each project directory, it
|
||||||
|
* contains the application specific kernel settings.
|
||||||
|
*
|
||||||
|
* @addtogroup config
|
||||||
|
* @details Kernel related settings and hooks.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHCONF_H
|
||||||
|
#define CHCONF_H
|
||||||
|
|
||||||
|
#define _CHIBIOS_RT_CONF_
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name System timers settings
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System time counter resolution.
|
||||||
|
* @note Allowed values are 16 or 32 bits.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_RESOLUTION 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System tick frequency.
|
||||||
|
* @details Frequency of the system timer that drives the system ticks. This
|
||||||
|
* setting also defines the system tick time unit.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_FREQUENCY 1000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Time delta constant for the tick-less mode.
|
||||||
|
* @note If this value is zero then the system uses the classic
|
||||||
|
* periodic tick. This value represents the minimum number
|
||||||
|
* of ticks that is safe to specify in a timeout directive.
|
||||||
|
* The value one is not valid, timeouts are rounded up to
|
||||||
|
* this value.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_TIMEDELTA 0
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Kernel parameters and options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Round robin interval.
|
||||||
|
* @details This constant is the number of system ticks allowed for the
|
||||||
|
* threads before preemption occurs. Setting this value to zero
|
||||||
|
* disables the preemption for threads with equal priority and the
|
||||||
|
* round robin becomes cooperative. Note that higher priority
|
||||||
|
* threads can still preempt, the kernel is always preemptive.
|
||||||
|
* @note Disabling the round robin preemption makes the kernel more compact
|
||||||
|
* and generally faster.
|
||||||
|
* @note The round robin preemption is not supported in tickless mode and
|
||||||
|
* must be set to zero in that case.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_TIME_QUANTUM 20
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Managed RAM size.
|
||||||
|
* @details Size of the RAM area to be managed by the OS. If set to zero
|
||||||
|
* then the whole available RAM is used. The core memory is made
|
||||||
|
* available to the heap allocator and/or can be used directly through
|
||||||
|
* the simplified core memory allocator.
|
||||||
|
*
|
||||||
|
* @note In order to let the OS manage the whole RAM the linker script must
|
||||||
|
* provide the @p __heap_base__ and @p __heap_end__ symbols.
|
||||||
|
* @note Requires @p CH_CFG_USE_MEMCORE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_MEMCORE_SIZE 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread automatic spawn suppression.
|
||||||
|
* @details When this option is activated the function @p chSysInit()
|
||||||
|
* does not spawn the idle thread. The application @p main()
|
||||||
|
* function becomes the idle thread and must implement an
|
||||||
|
* infinite loop.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_NO_IDLE_THREAD FALSE
|
||||||
|
|
||||||
|
/* Use __WFI in the idle thread for waiting. Does lower the power
|
||||||
|
* consumption. */
|
||||||
|
#define CORTEX_ENABLE_WFI_IDLE TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Performance options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief OS optimization.
|
||||||
|
* @details If enabled then time efficient rather than space efficient code
|
||||||
|
* is used when two possible implementations exist.
|
||||||
|
*
|
||||||
|
* @note This is not related to the compiler optimization options.
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_OPTIMIZE_SPEED TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Subsystem options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Time Measurement APIs.
|
||||||
|
* @details If enabled then the time measurement APIs are included in
|
||||||
|
* the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_TM FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads registry APIs.
|
||||||
|
* @details If enabled then the registry APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_REGISTRY TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads synchronization APIs.
|
||||||
|
* @details If enabled then the @p chThdWait() function is included in
|
||||||
|
* the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_WAITEXIT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Semaphores APIs.
|
||||||
|
* @details If enabled then the Semaphores APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_SEMAPHORES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Semaphores queuing mode.
|
||||||
|
* @details If enabled then the threads are enqueued on semaphores by
|
||||||
|
* priority rather than in FIFO order.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE. Enable this if you have special
|
||||||
|
* requirements.
|
||||||
|
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mutexes APIs.
|
||||||
|
* @details If enabled then the mutexes APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MUTEXES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables recursive behavior on mutexes.
|
||||||
|
* @note Recursive mutexes are heavier and have an increased
|
||||||
|
* memory footprint.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MUTEXES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conditional Variables APIs.
|
||||||
|
* @details If enabled then the conditional variables APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MUTEXES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_CONDVARS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conditional Variables APIs with timeout.
|
||||||
|
* @details If enabled then the conditional variables APIs with timeout
|
||||||
|
* specification are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_CONDVARS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Events Flags APIs.
|
||||||
|
* @details If enabled then the event flags APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_EVENTS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Events Flags APIs with timeout.
|
||||||
|
* @details If enabled then the events APIs with timeout specification
|
||||||
|
* are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_EVENTS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Synchronous Messages APIs.
|
||||||
|
* @details If enabled then the synchronous messages APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MESSAGES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Synchronous Messages queuing mode.
|
||||||
|
* @details If enabled then messages are served by priority rather than in
|
||||||
|
* FIFO order.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE. Enable this if you have special
|
||||||
|
* requirements.
|
||||||
|
* @note Requires @p CH_CFG_USE_MESSAGES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mailboxes APIs.
|
||||||
|
* @details If enabled then the asynchronous messages (mailboxes) APIs are
|
||||||
|
* included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MAILBOXES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Core Memory Manager APIs.
|
||||||
|
* @details If enabled then the core memory manager APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MEMCORE TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Heap Allocator APIs.
|
||||||
|
* @details If enabled then the memory heap allocator APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
|
||||||
|
* @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
* @note Mutexes are recommended.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_HEAP TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Memory Pools Allocator APIs.
|
||||||
|
* @details If enabled then the memory pools allocator APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MEMPOOLS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dynamic Threads APIs.
|
||||||
|
* @details If enabled then the dynamic threads creation APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_WAITEXIT.
|
||||||
|
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_DYNAMIC TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Debug options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, kernel statistics.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_STATISTICS FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, system state check.
|
||||||
|
* @details If enabled the correct call protocol for system APIs is checked
|
||||||
|
* at runtime.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, parameters checks.
|
||||||
|
* @details If enabled then the checks on the API functions input
|
||||||
|
* parameters are activated.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_CHECKS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, consistency checks.
|
||||||
|
* @details If enabled then all the assertions in the kernel code are
|
||||||
|
* activated. This includes consistency checks inside the kernel,
|
||||||
|
* runtime anomalies and port-defined checks.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_ASSERTS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, trace buffer.
|
||||||
|
* @details If enabled then the trace buffer is activated.
|
||||||
|
*
|
||||||
|
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace buffer entries.
|
||||||
|
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
|
||||||
|
* different from @p CH_DBG_TRACE_MASK_DISABLED.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_TRACE_BUFFER_SIZE 128
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, stack checks.
|
||||||
|
* @details If enabled then a runtime stack check is performed.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note The stack check is performed in a architecture/port dependent way.
|
||||||
|
* It may not be implemented or some ports.
|
||||||
|
* @note The default failure mode is to halt the system with the global
|
||||||
|
* @p panic_msg variable set to @p NULL.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, stacks initialization.
|
||||||
|
* @details If enabled then the threads working area is filled with a byte
|
||||||
|
* value when a thread is created. This can be useful for the
|
||||||
|
* runtime measurement of the used stack.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_FILL_THREADS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, threads profiling.
|
||||||
|
* @details If enabled then a field is added to the @p thread_t structure that
|
||||||
|
* counts the system ticks occurred while executing the thread.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note This debug option is not currently compatible with the
|
||||||
|
* tickless mode.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_THREADS_PROFILING FALSE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Kernel hooks
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads descriptor structure extension.
|
||||||
|
* @details User fields added to the end of the @p thread_t structure.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
||||||
|
/* Add threads custom fields here.*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads initialization hook.
|
||||||
|
* @details User initialization code added to the @p chThdInit() API.
|
||||||
|
*
|
||||||
|
* @note It is invoked from within @p chThdInit() and implicitly from all
|
||||||
|
* the threads creation APIs.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
||||||
|
/* Add threads initialization code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads finalization hook.
|
||||||
|
* @details User finalization code added to the @p chThdExit() API.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
||||||
|
/* Add threads finalization code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Context switch hook.
|
||||||
|
* @details This hook is invoked just before switching between threads.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
||||||
|
/* Context switch code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR enter hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
||||||
|
/* IRQ prologue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR exit hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
||||||
|
/* IRQ epilogue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread enter hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to activate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_ENTER_HOOK() { \
|
||||||
|
/* Idle-enter code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread leave hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to deactivate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_LEAVE_HOOK() { \
|
||||||
|
/* Idle-leave code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle Loop hook.
|
||||||
|
* @details This hook is continuously invoked by the idle thread loop.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_LOOP_HOOK() { \
|
||||||
|
/* Idle loop code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System tick event hook.
|
||||||
|
* @details This hook is invoked in the system tick handler immediately
|
||||||
|
* after processing the virtual timers queue.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_SYSTEM_TICK_HOOK() { \
|
||||||
|
/* System tick event code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System halt hook.
|
||||||
|
* @details This hook is invoked in case to a system halting error before
|
||||||
|
* the system is halted.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||||
|
/* System halt code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace hook.
|
||||||
|
* @details This hook is invoked each time a new record is written in the
|
||||||
|
* trace buffer.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_TRACE_HOOK(tep) { \
|
||||||
|
/* Trace code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Port-specific settings (override port settings defaulted in chcore.h). */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#endif /* CHCONF_H */
|
||||||
|
|
||||||
|
/** @} */
|
80
keyboard/kl27z_kbd/config.h
Normal file
80
keyboard/kl27z_kbd/config.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x1111
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||||
|
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||||
|
#define MANUFACTURER "TMK"
|
||||||
|
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00'
|
||||||
|
#define PRODUCT "ChibiOS TMK test"
|
||||||
|
#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
|
||||||
|
#define DESCRIPTION "TMK keyboard firmware over ChibiOS"
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 5
|
||||||
|
#define MATRIX_COLS 14
|
||||||
|
|
||||||
|
/* define if matrix has ghost */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature disable options
|
||||||
|
* These options are also useful to firmware size reduction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* disable debug print */
|
||||||
|
//#define NO_DEBUG
|
||||||
|
|
||||||
|
/* disable print */
|
||||||
|
//#define NO_PRINT
|
||||||
|
|
||||||
|
/* disable action features */
|
||||||
|
//#define NO_ACTION_LAYER
|
||||||
|
//#define NO_ACTION_TAPPING
|
||||||
|
//#define NO_ACTION_ONESHOT
|
||||||
|
//#define NO_ACTION_MACRO
|
||||||
|
//#define NO_ACTION_FUNCTION
|
||||||
|
|
||||||
|
// TODO: add this to ChibiOS-Contrib/os/common/ext/CMSIS/KINETIS/kl27zxxx.h
|
||||||
|
#ifndef USBx_CTL_RESUME
|
||||||
|
#define USBx_CTL_RESUME ((uint8_t)0x04) /*!< Executes resume signaling */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
187
keyboard/kl27z_kbd/halconf.h
Normal file
187
keyboard/kl27z_kbd/halconf.h
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/halconf.h
|
||||||
|
* @brief HAL configuration header.
|
||||||
|
* @details HAL configuration file, this file allows to enable or disable the
|
||||||
|
* various device drivers from your application. You may also use
|
||||||
|
* this file in order to override the device drivers default settings.
|
||||||
|
*
|
||||||
|
* @addtogroup HAL_CONF
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HALCONF_H_
|
||||||
|
#define _HALCONF_H_
|
||||||
|
|
||||||
|
#include "mcuconf.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the PAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_PAL TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ADC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_ADC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the CAN subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_CAN FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the DAC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_DAC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the EXT subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_EXT FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the GPT subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_GPT FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the I2C subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_I2C FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the I2S subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_I2S FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ICU subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_ICU FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MAC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_MAC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MMC_SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_MMC_SPI FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the PWM subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_PWM FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the RTC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_RTC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SDC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SDC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SERIAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SERIAL FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SERIAL over USB subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SERIAL_USB FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SPI FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the UART subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_UART FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the USB subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_USB TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the WDG subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_WDG FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* USB driver related settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables synchronous APIs.
|
||||||
|
* @note Disabling this option saves both code and data space.
|
||||||
|
*/
|
||||||
|
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||||
|
#define USB_USE_WAIT TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _HALCONF_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
234
keyboard/kl27z_kbd/kl27z_kbd.c
Normal file
234
keyboard/kl27z_kbd/kl27z_kbd.c
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ch.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* scan matrix
|
||||||
|
*/
|
||||||
|
#include "print.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "wait.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "led.h"
|
||||||
|
#include "keymap.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Matrix
|
||||||
|
* COL: input with pullup to sense
|
||||||
|
* PTD6 PTD5 PTD4 PTD3 PTA19 PTA18 PTA4 PTA2 PTA1 PTE25 PTE24 PTE30 PTE29 PTE21
|
||||||
|
*
|
||||||
|
* ROW: output low to strobe
|
||||||
|
* PTB3 PTB16 PTB17 PTC0 PTC1
|
||||||
|
*
|
||||||
|
* State(1:on, 0:off)
|
||||||
|
*/
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS];
|
||||||
|
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||||
|
static bool debouncing = false;
|
||||||
|
static uint16_t debouncing_time = 0;
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_rows(void)
|
||||||
|
{
|
||||||
|
return MATRIX_ROWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_cols(void)
|
||||||
|
{
|
||||||
|
return MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init(void)
|
||||||
|
{
|
||||||
|
debug_matrix = true;
|
||||||
|
memset(matrix, 0, MATRIX_ROWS);
|
||||||
|
memset(matrix_debouncing, 0, MATRIX_ROWS);
|
||||||
|
|
||||||
|
// COL: internal pull-up
|
||||||
|
palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOD, 5, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOD, 4, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOD, 3, PAL_MODE_INPUT_PULLUP);
|
||||||
|
|
||||||
|
palSetPadMode(GPIOA, 19, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOA, 18, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOA, 1, PAL_MODE_INPUT_PULLUP);
|
||||||
|
|
||||||
|
palSetPadMode(GPIOE, 25, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOE, 24, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOE, 30, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOE, 29, PAL_MODE_INPUT_PULLUP);
|
||||||
|
palSetPadMode(GPIOE, 21, PAL_MODE_INPUT_PULLUP);
|
||||||
|
|
||||||
|
// ROW: Output high
|
||||||
|
palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOB, 17, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOB, 3);
|
||||||
|
palSetPad(GPIOB, 16);
|
||||||
|
palSetPad(GPIOB, 17);
|
||||||
|
palSetPad(GPIOC, 0);
|
||||||
|
palSetPad(GPIOC, 1);
|
||||||
|
|
||||||
|
|
||||||
|
// LED blink
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palClearPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palClearPad(GPIOD, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void)
|
||||||
|
{
|
||||||
|
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix_row_t data = 0;
|
||||||
|
|
||||||
|
// strobe row
|
||||||
|
switch (row) {
|
||||||
|
case 0: palClearPad(GPIOB, 3); break;
|
||||||
|
case 1: palClearPad(GPIOB, 16); break;
|
||||||
|
case 2: palClearPad(GPIOB, 17); break;
|
||||||
|
case 3: palClearPad(GPIOC, 0); break;
|
||||||
|
case 4: palClearPad(GPIOC, 1); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//wait_us(1);
|
||||||
|
//chThdSleepMicroseconds(1); // TODO: sleep around 1ms for some reason
|
||||||
|
//chThdSleepMilliseconds(1); // seems to work correctly
|
||||||
|
|
||||||
|
data = (!palReadPad(GPIOD, 6) << 0UL) |
|
||||||
|
(!palReadPad(GPIOD, 5) << 1UL) |
|
||||||
|
(!palReadPad(GPIOD, 4) << 2UL) |
|
||||||
|
(!palReadPad(GPIOD, 3) << 3UL) |
|
||||||
|
(!palReadPad(GPIOA, 19) << 4UL) |
|
||||||
|
(!palReadPad(GPIOA, 18) << 5UL) |
|
||||||
|
(!palReadPad(GPIOA, 4) << 6UL) |
|
||||||
|
(!palReadPad(GPIOA, 2) << 7UL) |
|
||||||
|
(!palReadPad(GPIOA, 1) << 8UL) |
|
||||||
|
(!palReadPad(GPIOE, 25) << 9UL) |
|
||||||
|
(!palReadPad(GPIOE, 24) << 10UL) |
|
||||||
|
(!palReadPad(GPIOE, 30) << 11UL) |
|
||||||
|
(!palReadPad(GPIOE, 29) << 12UL) |
|
||||||
|
(!palReadPad(GPIOE, 21) << 13UL);
|
||||||
|
|
||||||
|
// unstrobe row
|
||||||
|
switch (row) {
|
||||||
|
case 0: palSetPad(GPIOB, 3); break;
|
||||||
|
case 1: palSetPad(GPIOB, 16); break;
|
||||||
|
case 2: palSetPad(GPIOB, 17); break;
|
||||||
|
case 3: palSetPad(GPIOC, 0); break;
|
||||||
|
case 4: palSetPad(GPIOC, 1); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matrix_debouncing[row] != data) {
|
||||||
|
matrix_debouncing[row] = data;
|
||||||
|
debouncing = true;
|
||||||
|
debouncing_time = timer_read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
|
||||||
|
for (int row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
matrix[row] = matrix_debouncing[row];
|
||||||
|
}
|
||||||
|
debouncing = false;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||||
|
{
|
||||||
|
return (matrix[row] & (1<<col));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
matrix_row_t matrix_get_row(uint8_t row)
|
||||||
|
{
|
||||||
|
return matrix[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
xprintf("\nr/c 0123456789ABCDEF\n");
|
||||||
|
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||||
|
xprintf("%02X: ", row);
|
||||||
|
matrix_row_t data = matrix_get_row(row);
|
||||||
|
for (int col = 0; col < MATRIX_COLS; col++) {
|
||||||
|
if (data & (1<<col))
|
||||||
|
xprintf("1");
|
||||||
|
else
|
||||||
|
xprintf("0");
|
||||||
|
}
|
||||||
|
xprintf("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// LED
|
||||||
|
//
|
||||||
|
void led_set(uint8_t usb_led) {
|
||||||
|
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
||||||
|
// output high
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
} else {
|
||||||
|
// Hi-Z
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Keymap
|
||||||
|
//
|
||||||
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = {
|
||||||
|
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS },
|
||||||
|
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC },
|
||||||
|
{ KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_NO },
|
||||||
|
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, KC_FN0 },
|
||||||
|
{ KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_SPC, KC_NO, KC_NO, KC_NO, KC_NLCK, KC_CAPS, KC_MENU, KC_RALT, KC_RGUI, KC_RCTL },
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
{ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL },
|
||||||
|
{ KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_INS, KC_TRNS },
|
||||||
|
{ KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT, KC_TRNS },
|
||||||
|
{ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS, KC_TRNS },
|
||||||
|
{ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const action_t fn_actions[] = {
|
||||||
|
[0] = ACTION_LAYER_TAP_KEY(1, KC_GRV),
|
||||||
|
};
|
80
keyboard/kl27z_kbd/mcuconf.h
Normal file
80
keyboard/kl27z_kbd/mcuconf.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MCUCONF_H_
|
||||||
|
#define _MCUCONF_H_
|
||||||
|
|
||||||
|
#define KL2x_MCUCONF
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HAL driver system settings.
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
/* High-frequency internal RC, 48MHz, possible USB clock recovery */
|
||||||
|
#define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_HIRC
|
||||||
|
#define KINETIS_SYSCLK_FREQUENCY 48000000UL
|
||||||
|
#define KINETIS_CLKDIV1_OUTDIV1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Low-frequency internal RC, 8 MHz mode */
|
||||||
|
#define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_LIRC8M
|
||||||
|
#define KINETIS_SYSCLK_FREQUENCY 8000000UL
|
||||||
|
#define KINETIS_CLKDIV1_OUTDIV1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SERIAL driver system settings.
|
||||||
|
*/
|
||||||
|
#define KINETIS_SERIAL_USE_UART0 TRUE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* USB driver settings
|
||||||
|
*/
|
||||||
|
#define KINETIS_USB_USE_USB0 TRUE
|
||||||
|
/* need to redefine this, since the default is for K20x */
|
||||||
|
#define KINETIS_USB_USB0_IRQ_PRIORITY 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Kinetis FOPT configuration byte
|
||||||
|
*/
|
||||||
|
/* for KL27: */
|
||||||
|
#define KINETIS_NV_FOPT_BYTE 0x39
|
||||||
|
#define KINETIS_NV_FSEC_BYTE 0x7E
|
||||||
|
/* NV_FOPT: bit7-6/BOOTSRC_SEL=0b00 (11=from ROM; 00=from FLASH)
|
||||||
|
bit5/FAST_INIT=1, bit4/LPBOOT1=1,
|
||||||
|
bit3/RESET_PIN_CFG=1, bit2/NMI_DIS=1,
|
||||||
|
bit1/BOOTPIN_OPT=0, bit0/LPBOOT0=1 */
|
||||||
|
/* BOOTPIN_OPT: 1=boot depends on BOOTSRC_SEL
|
||||||
|
0=boot samples BOOTCFG0=NMI pin */
|
||||||
|
/* Boot sequence, page 88 of manual:
|
||||||
|
* - If the NMI/BOOTCFG0 input is high or the NMI function is disabled in FTFA_FOPT, the CPU begins execution at the PC location.
|
||||||
|
* - If the NMI/BOOTCFG0 input is low, the NMI function is enabled in FTFA_FOPT, and FTFA_FOPT[BOOTPIN_OPT] = 1, this results in an NMI interrupt. The processor executes an Exception Entry and reads the NMI interrupt handler address from vector-table offset 8. The CPU begins execution at the NMI interrupt handler.
|
||||||
|
* - When FTFA_FOPT[BOOTPIN_OPT] = 0, it forces boot from ROM if NMI/BOOTCFG0 pin set to 0.
|
||||||
|
*
|
||||||
|
* Observed behaviour:
|
||||||
|
* - when BOOTPIN_OPT=0, BOOTSRC_SEL still matters:
|
||||||
|
* - if 0b11 (from ROM), it still boots from ROM, even if BOOTCFG0 pin
|
||||||
|
* is high/floating, but leaves ROM and runs user app after
|
||||||
|
* 5 seconds delay.
|
||||||
|
* - if 0b00 (from FLASH), reset/powerup jumps to user app unless
|
||||||
|
* BOOTCFG0 pin is asserted.
|
||||||
|
* - in any case, reset when in bootloader induces the 5 second delay
|
||||||
|
* before starting the user app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _MCUCONF_H_ */
|
70
keyboard/kl27z_onekey/Makefile
Normal file
70
keyboard/kl27z_onekey/Makefile
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Target file name (without extension).
|
||||||
|
PROJECT = kl27z_onekey
|
||||||
|
|
||||||
|
# Directory common source files exist
|
||||||
|
TMK_DIR = ../../tmk_core
|
||||||
|
|
||||||
|
# Directory keyboard dependent files exist
|
||||||
|
TARGET_DIR = .
|
||||||
|
|
||||||
|
# project specific files
|
||||||
|
SRC = $(PROJECT).c
|
||||||
|
|
||||||
|
CONFIG_H = config.h
|
||||||
|
|
||||||
|
## chip/board settings
|
||||||
|
# - the next two should match the directories in
|
||||||
|
# <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||||
|
# - For Teensies, FAMILY = KINETIS and SERIES is either
|
||||||
|
# KL2x (LC) or K20x (3.0,3.1,3.2).
|
||||||
|
MCU_FAMILY = KINETIS
|
||||||
|
MCU_SERIES = KL2x
|
||||||
|
|
||||||
|
# Linker script to use
|
||||||
|
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||||
|
# or <this_dir>/ld/
|
||||||
|
# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
|
||||||
|
# - LDSCRIPT =
|
||||||
|
# - MKL26Z64 for Teensy LC
|
||||||
|
# - MK20DX128 for Teensy 3.0
|
||||||
|
# - MK20DX256 for Teensy 3.1 and 3.2
|
||||||
|
MCU_LDSCRIPT = MKL27Z256
|
||||||
|
|
||||||
|
# Startup code to use
|
||||||
|
# - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
|
||||||
|
# - STARTUP =
|
||||||
|
# - kl2x for Teensy LC
|
||||||
|
# - k20x5 for Teensy 3.0
|
||||||
|
# - k20x7 for Teensy 3.1 and 3.2
|
||||||
|
MCU_STARTUP = kl2x
|
||||||
|
|
||||||
|
# Board: it should exist either in <chibios>/os/hal/boards/
|
||||||
|
# or <this_dir>/boards
|
||||||
|
# - BOARD =
|
||||||
|
# - PJRC_TEENSY_LC for Teensy LC
|
||||||
|
# - PJRC_TEENSY_3 for Teensy 3.0
|
||||||
|
# - PJRC_TEENSY_3_1 for Teensy 3.1 or 3.2
|
||||||
|
BOARD = ELF
|
||||||
|
|
||||||
|
# Cortex version
|
||||||
|
# Teensy LC is cortex-m0plus; Teensy 3.x are cortex-m4
|
||||||
|
MCU = cortex-m0plus
|
||||||
|
|
||||||
|
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||||
|
# I.e. 6 for Teensy LC; 7 for Teensy 3.x
|
||||||
|
ARMV = 6
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# comment out to disable the options.
|
||||||
|
#
|
||||||
|
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||||
|
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
|
||||||
|
#MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
|
#EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = yes # Console for debug
|
||||||
|
#COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
|
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||||
|
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
|
|
||||||
|
include $(TMK_DIR)/tool/chibios/common.mk
|
||||||
|
include $(TMK_DIR)/tool/chibios/chibios.mk
|
144
keyboard/kl27z_onekey/README.md
Normal file
144
keyboard/kl27z_onekey/README.md
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
KL27Z128/256 board
|
||||||
|
==================
|
||||||
|
2016/11/30
|
||||||
|
|
||||||
|
KL27Z is configured to use internal 48MHz RC oscillator.
|
||||||
|
|
||||||
|
The board has push button on PTA4 and LED on PTD7. The button works as 'a' key and the LED as an indicator for capslock.
|
||||||
|
|
||||||
|
|
||||||
|
ELF board
|
||||||
|
---------
|
||||||
|
This board acommodates 48QFN chip.
|
||||||
|
|
||||||
|
### prototypte pinout
|
||||||
|
- pcb layout https://deskthority.net/resources/image/33293
|
||||||
|
- schematic https://deskthority.net/resources/image/33252
|
||||||
|
|
||||||
|
|
||||||
|
39 ..... 44 \ conn / 1 ..... 6
|
||||||
|
38 |______| LED 7
|
||||||
|
: Rst :
|
||||||
|
: :
|
||||||
|
32 Bl 13
|
||||||
|
31 .........24 23............ 14
|
||||||
|
|
||||||
|
1 PTD6 12 PTC3 23 GND 34 PTE20*
|
||||||
|
2 PTD5 13 PTC2 24 PTA18 35 PTA20 Reset
|
||||||
|
3 PTD4 14 PTC1 25 3.3V 36 PTA3 SWD_DIO
|
||||||
|
4 PTD3* 15 PTC0* 26 PTA4 NMI 37 PTA0 SWD_CLK
|
||||||
|
5 PTD2* 16 PTB17* 27 PTA2 38 3.3V
|
||||||
|
6 PTD1* 17 PTB16* 28 PTA1 39 GND
|
||||||
|
7 PTD0* 18 PTB3* 29 PTE25* 40 VBUS VREGIN
|
||||||
|
8 PTC7 19 PTB2* 30 PTE24* 41 USB D-
|
||||||
|
9 PTC6 20 PTB1 31 PTE30 42 USB D+
|
||||||
|
10 PTC5 21 PTB0 32 PTE29* 43 GND
|
||||||
|
11 PTC4 22 PTA19 33 PTE21* 44 USB Shield
|
||||||
|
|
||||||
|
|
||||||
|
TMK KL27Z breakout
|
||||||
|
------------------
|
||||||
|
This board acommodates 48QFN chip.
|
||||||
|
|
||||||
|
### Pinputs
|
||||||
|
|
||||||
|
_\ conn /_
|
||||||
|
1 28
|
||||||
|
: :
|
||||||
|
: PROG :
|
||||||
|
: RST :
|
||||||
|
14 15
|
||||||
|
----------
|
||||||
|
|
||||||
|
1 VUSB 28 GND
|
||||||
|
2 VIN VREGIN 27 PTD4
|
||||||
|
3 PTD5 26 PTC7
|
||||||
|
4 PTD6 25 PTC6
|
||||||
|
5 PTD7 24 PTC5
|
||||||
|
6 PTE0* 23 PTC4
|
||||||
|
|
||||||
|
7 3.3V 22 GND
|
||||||
|
8 PTE30 21 PTC3
|
||||||
|
9 PTA0 SWD_CLK 20 PTC2
|
||||||
|
10 PTA1 19 PTC1
|
||||||
|
11 PTA2 18 PTB1
|
||||||
|
12 PTA3 SWD_DIO 17 PTB0
|
||||||
|
13 PTA4 NMI 16 PTA20 Reset
|
||||||
|
14 PTA18 15 PTA19
|
||||||
|
|
||||||
|
|
||||||
|
#### Pinouts difference between 32QFN and 48QFN
|
||||||
|
48QFN doesn't have PTE0
|
||||||
|
32QFN doesn't have PTD0-3, PTC0, PTE20-21,24,25,29, PTB2-3,16,17
|
||||||
|
|
||||||
|
### ROM bootloader pins
|
||||||
|
See Reference Manual Chapter 13.
|
||||||
|
|
||||||
|
PTA2 LPUART0_TX
|
||||||
|
PTA1 LPUART0_RX *
|
||||||
|
PTB0 I2C0_SCL
|
||||||
|
PTB1 I2C0_SDA
|
||||||
|
PTC4 SPI0_SS_b *
|
||||||
|
PTC7 SPI0_MISO
|
||||||
|
PTC6 SPI0_MOSI
|
||||||
|
PTC5 SPI0_SCK *
|
||||||
|
|
||||||
|
Due to errata e9457, need to pull-up `SPI0_SS_b`(or `SPI0_SCK`) to prevent false detection of SPI.
|
||||||
|
The errata doesn't refer UART though, `LPUART0_RX` also requires pull-up or down resisitor from experience.
|
||||||
|
Without resistor it easily false-detects activity on UART interface with finger touch on the pin.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Resources
|
||||||
|
---------
|
||||||
|
### Deskthority thread
|
||||||
|
https://deskthority.net/workshop-f7/can-we-design-the-teensy-alternative-for-keyboards-t13662-510.html
|
||||||
|
|
||||||
|
### Kinetis KL2x
|
||||||
|
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/l-series-ultra-low-power-m0-plus/kinetis-kl2x-48-mhz-usb-ultra-low-power-microcontrollers-based-on-arm-cortex-m0-plus:KL2x
|
||||||
|
|
||||||
|
### KL27Z128/256 Data Sheet
|
||||||
|
http://www.nxp.com/assets/documents/data/en/data-sheets/KL27P64M48SF6.pdf
|
||||||
|
|
||||||
|
### KL27Z128/256 Reference Manual
|
||||||
|
http://www.nxp.com/assets/documents/data/en/reference-manuals/KL27P64M48SF6RM.pdf
|
||||||
|
|
||||||
|
### Errata
|
||||||
|
http://www.nxp.com/assets/documents/data/en/errata/KINETIS_L_1N71K.pdf
|
||||||
|
|
||||||
|
>>
|
||||||
|
e9457: Kinetis Flashloader/ ROM Bootloader: The peripheral auto-detect code in
|
||||||
|
bootloader can falsely detect presence of SPI host causing non-responsive
|
||||||
|
bootloader
|
||||||
|
Description: During the active peripheral detection process, the bootloader can interpret spurious data on
|
||||||
|
the SPI peripheral as valid data. The spurious data causes the bootloader to shutdown all
|
||||||
|
peripherals except the “falsely detected" SPI and enter the command phase loop using the
|
||||||
|
SPI. After the bootloader enters the command phase loop using the SPI, the other peripherals
|
||||||
|
are ignored, so the desired peripheral is no longer active.
|
||||||
|
The bootloader will not falsely detect activity on the I2C, UART, or USB interfaces, so only the
|
||||||
|
SPI interface is affected.
|
||||||
|
Workaround: Ensure that there is an external pull-up on the SPI chip-select pin or that the pin is driven high.
|
||||||
|
This will prevent the bootloader from seeing spurious data due to activity on the SPI clock pin.
|
||||||
|
|
||||||
|
### Kinetis Bootloader and blhost
|
||||||
|
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/kinetis-cortex-m-mcus/kinetis-symbols-footprints-and-models/kinetis-bootloader:KBOOT
|
||||||
|
|
||||||
|
|
||||||
|
Build
|
||||||
|
-----
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
|
||||||
|
Program
|
||||||
|
-------
|
||||||
|
Flash firmware with ROM bootloader.
|
||||||
|
|
||||||
|
blhost -u -- flash-image build/kl27z.hex erase
|
||||||
|
|
||||||
|
|
||||||
|
TODO
|
||||||
|
----
|
||||||
|
- Fix boards/ELF files
|
||||||
|
- add macro `USBx_CTL_RESUME` to ChibiOS-Contrib/os/common/ext/CMSIS/KINETIS/kl27zxxx.h
|
158
keyboard/kl27z_onekey/boards/ELF/board.c
Normal file
158
keyboard/kl27z_onekey/boards/ELF/board.c
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ch.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
#if HAL_USE_PAL || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @brief PAL setup.
|
||||||
|
* @details Digital I/O ports static configuration as defined in @p board.h.
|
||||||
|
* This variable is used by the HAL when initializing the PAL driver.
|
||||||
|
*/
|
||||||
|
const PALConfig pal_default_config =
|
||||||
|
{
|
||||||
|
.ports = {
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTA setup.
|
||||||
|
*
|
||||||
|
* on pads: PTA1, PTA2, PTA5, PTA18, PTA19
|
||||||
|
*
|
||||||
|
* PTA0/3 SWD (default SWD, ALT_7: SWD, ALT_1: PTA0/3)
|
||||||
|
* PTA4 NMI button (default NMI_b, ALT_1: PTA4)
|
||||||
|
* PTA20 RESET button (default RESET, ALT_7: RESET, ALT_1: PTA20)
|
||||||
|
*/
|
||||||
|
.port = IOPORT1,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_OUTPUT_PUSHPULL,
|
||||||
|
PAL_MODE_ALTERNATIVE_7, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_ALTERNATIVE_7,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTB setup.
|
||||||
|
*
|
||||||
|
* on pads: PTB0, PTB1
|
||||||
|
* LED: PTB18
|
||||||
|
*/
|
||||||
|
.port = IOPORT2,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTC setup.
|
||||||
|
*
|
||||||
|
* on pads: PTC1, PTC2, PTC3, PTC6, PTC7, PTC8, PTC9
|
||||||
|
*/
|
||||||
|
.port = IOPORT3,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTD setup.
|
||||||
|
*
|
||||||
|
* on pads: PTD0 - PTD7
|
||||||
|
*/
|
||||||
|
.port = IOPORT4,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* PORTE setup.
|
||||||
|
*
|
||||||
|
* on pads: PTE0, PTE1, PTE24, PTE25, PTE29, PTE30
|
||||||
|
*/
|
||||||
|
.port = IOPORT5,
|
||||||
|
.pads = {
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_PULLUP,
|
||||||
|
PAL_MODE_INPUT_PULLUP, PAL_MODE_UNCONNECTED,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Early initialization code.
|
||||||
|
* @details This initialization must be performed just after stack setup
|
||||||
|
* and before any other initialization.
|
||||||
|
*/
|
||||||
|
void __early_init(void) {
|
||||||
|
|
||||||
|
kl2x_clock_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Board-specific initialization code.
|
||||||
|
* @todo Add your board-specific code, if any.
|
||||||
|
*/
|
||||||
|
void boardInit(void) {
|
||||||
|
}
|
56
keyboard/kl27z_onekey/boards/ELF/board.h
Normal file
56
keyboard/kl27z_onekey/boards/ELF/board.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BOARD_H_
|
||||||
|
#define _BOARD_H_
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup for a custom KL27Z breakout board.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Board identifier.
|
||||||
|
*/
|
||||||
|
#define BOARD_KL27Z_BREAKOUT
|
||||||
|
#define BOARD_NAME "Custom KL27Z breakout"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MCU type
|
||||||
|
*/
|
||||||
|
#define KL27Zxxx
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Onboard features.
|
||||||
|
*/
|
||||||
|
//#define GPIO_LED IOPORT1
|
||||||
|
//#define PIN_LED 2
|
||||||
|
// PTD7 on ELF
|
||||||
|
#define GPIO_LED IOPORT4
|
||||||
|
#define PIN_LED 7
|
||||||
|
#define GPIO_BUTTON IOPORT1
|
||||||
|
#define PIN_BUTTON 4
|
||||||
|
|
||||||
|
#if !defined(_FROM_ASM_)
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void boardInit(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* _FROM_ASM_ */
|
||||||
|
|
||||||
|
#endif /* _BOARD_H_ */
|
5
keyboard/kl27z_onekey/boards/ELF/board.mk
Normal file
5
keyboard/kl27z_onekey/boards/ELF/board.mk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# List of all the board related files.
|
||||||
|
BOARDSRC = ./boards/ELF/board.c
|
||||||
|
|
||||||
|
# Required include directories
|
||||||
|
BOARDINC = ./boards/ELF
|
524
keyboard/kl27z_onekey/chconf.h
Normal file
524
keyboard/kl27z_onekey/chconf.h
Normal file
@ -0,0 +1,524 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/chconf.h
|
||||||
|
* @brief Configuration file template.
|
||||||
|
* @details A copy of this file must be placed in each project directory, it
|
||||||
|
* contains the application specific kernel settings.
|
||||||
|
*
|
||||||
|
* @addtogroup config
|
||||||
|
* @details Kernel related settings and hooks.
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHCONF_H
|
||||||
|
#define CHCONF_H
|
||||||
|
|
||||||
|
#define _CHIBIOS_RT_CONF_
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name System timers settings
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System time counter resolution.
|
||||||
|
* @note Allowed values are 16 or 32 bits.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_RESOLUTION 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System tick frequency.
|
||||||
|
* @details Frequency of the system timer that drives the system ticks. This
|
||||||
|
* setting also defines the system tick time unit.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_FREQUENCY 1000
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Time delta constant for the tick-less mode.
|
||||||
|
* @note If this value is zero then the system uses the classic
|
||||||
|
* periodic tick. This value represents the minimum number
|
||||||
|
* of ticks that is safe to specify in a timeout directive.
|
||||||
|
* The value one is not valid, timeouts are rounded up to
|
||||||
|
* this value.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_ST_TIMEDELTA 0
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Kernel parameters and options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Round robin interval.
|
||||||
|
* @details This constant is the number of system ticks allowed for the
|
||||||
|
* threads before preemption occurs. Setting this value to zero
|
||||||
|
* disables the preemption for threads with equal priority and the
|
||||||
|
* round robin becomes cooperative. Note that higher priority
|
||||||
|
* threads can still preempt, the kernel is always preemptive.
|
||||||
|
* @note Disabling the round robin preemption makes the kernel more compact
|
||||||
|
* and generally faster.
|
||||||
|
* @note The round robin preemption is not supported in tickless mode and
|
||||||
|
* must be set to zero in that case.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_TIME_QUANTUM 20
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Managed RAM size.
|
||||||
|
* @details Size of the RAM area to be managed by the OS. If set to zero
|
||||||
|
* then the whole available RAM is used. The core memory is made
|
||||||
|
* available to the heap allocator and/or can be used directly through
|
||||||
|
* the simplified core memory allocator.
|
||||||
|
*
|
||||||
|
* @note In order to let the OS manage the whole RAM the linker script must
|
||||||
|
* provide the @p __heap_base__ and @p __heap_end__ symbols.
|
||||||
|
* @note Requires @p CH_CFG_USE_MEMCORE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_MEMCORE_SIZE 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread automatic spawn suppression.
|
||||||
|
* @details When this option is activated the function @p chSysInit()
|
||||||
|
* does not spawn the idle thread. The application @p main()
|
||||||
|
* function becomes the idle thread and must implement an
|
||||||
|
* infinite loop.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_NO_IDLE_THREAD FALSE
|
||||||
|
|
||||||
|
/* Use __WFI in the idle thread for waiting. Does lower the power
|
||||||
|
* consumption. */
|
||||||
|
#define CORTEX_ENABLE_WFI_IDLE TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Performance options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief OS optimization.
|
||||||
|
* @details If enabled then time efficient rather than space efficient code
|
||||||
|
* is used when two possible implementations exist.
|
||||||
|
*
|
||||||
|
* @note This is not related to the compiler optimization options.
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_OPTIMIZE_SPEED TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Subsystem options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Time Measurement APIs.
|
||||||
|
* @details If enabled then the time measurement APIs are included in
|
||||||
|
* the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_TM FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads registry APIs.
|
||||||
|
* @details If enabled then the registry APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_REGISTRY TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads synchronization APIs.
|
||||||
|
* @details If enabled then the @p chThdWait() function is included in
|
||||||
|
* the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_WAITEXIT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Semaphores APIs.
|
||||||
|
* @details If enabled then the Semaphores APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_SEMAPHORES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Semaphores queuing mode.
|
||||||
|
* @details If enabled then the threads are enqueued on semaphores by
|
||||||
|
* priority rather than in FIFO order.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE. Enable this if you have special
|
||||||
|
* requirements.
|
||||||
|
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mutexes APIs.
|
||||||
|
* @details If enabled then the mutexes APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MUTEXES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables recursive behavior on mutexes.
|
||||||
|
* @note Recursive mutexes are heavier and have an increased
|
||||||
|
* memory footprint.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MUTEXES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conditional Variables APIs.
|
||||||
|
* @details If enabled then the conditional variables APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MUTEXES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_CONDVARS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conditional Variables APIs with timeout.
|
||||||
|
* @details If enabled then the conditional variables APIs with timeout
|
||||||
|
* specification are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_CONDVARS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Events Flags APIs.
|
||||||
|
* @details If enabled then the event flags APIs are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_EVENTS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Events Flags APIs with timeout.
|
||||||
|
* @details If enabled then the events APIs with timeout specification
|
||||||
|
* are included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_EVENTS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Synchronous Messages APIs.
|
||||||
|
* @details If enabled then the synchronous messages APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MESSAGES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Synchronous Messages queuing mode.
|
||||||
|
* @details If enabled then messages are served by priority rather than in
|
||||||
|
* FIFO order.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE. Enable this if you have special
|
||||||
|
* requirements.
|
||||||
|
* @note Requires @p CH_CFG_USE_MESSAGES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mailboxes APIs.
|
||||||
|
* @details If enabled then the asynchronous messages (mailboxes) APIs are
|
||||||
|
* included in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MAILBOXES TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Core Memory Manager APIs.
|
||||||
|
* @details If enabled then the core memory manager APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MEMCORE TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Heap Allocator APIs.
|
||||||
|
* @details If enabled then the memory heap allocator APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
|
||||||
|
* @p CH_CFG_USE_SEMAPHORES.
|
||||||
|
* @note Mutexes are recommended.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_HEAP TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Memory Pools Allocator APIs.
|
||||||
|
* @details If enabled then the memory pools allocator APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_MEMPOOLS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dynamic Threads APIs.
|
||||||
|
* @details If enabled then the dynamic threads creation APIs are included
|
||||||
|
* in the kernel.
|
||||||
|
*
|
||||||
|
* @note The default is @p TRUE.
|
||||||
|
* @note Requires @p CH_CFG_USE_WAITEXIT.
|
||||||
|
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_USE_DYNAMIC TRUE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Debug options
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, kernel statistics.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_STATISTICS FALSE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, system state check.
|
||||||
|
* @details If enabled the correct call protocol for system APIs is checked
|
||||||
|
* at runtime.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, parameters checks.
|
||||||
|
* @details If enabled then the checks on the API functions input
|
||||||
|
* parameters are activated.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_CHECKS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, consistency checks.
|
||||||
|
* @details If enabled then all the assertions in the kernel code are
|
||||||
|
* activated. This includes consistency checks inside the kernel,
|
||||||
|
* runtime anomalies and port-defined checks.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_ASSERTS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, trace buffer.
|
||||||
|
* @details If enabled then the trace buffer is activated.
|
||||||
|
*
|
||||||
|
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace buffer entries.
|
||||||
|
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
|
||||||
|
* different from @p CH_DBG_TRACE_MASK_DISABLED.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_TRACE_BUFFER_SIZE 128
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, stack checks.
|
||||||
|
* @details If enabled then a runtime stack check is performed.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note The stack check is performed in a architecture/port dependent way.
|
||||||
|
* It may not be implemented or some ports.
|
||||||
|
* @note The default failure mode is to halt the system with the global
|
||||||
|
* @p panic_msg variable set to @p NULL.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_ENABLE_STACK_CHECK TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, stacks initialization.
|
||||||
|
* @details If enabled then the threads working area is filled with a byte
|
||||||
|
* value when a thread is created. This can be useful for the
|
||||||
|
* runtime measurement of the used stack.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_FILL_THREADS TRUE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Debug option, threads profiling.
|
||||||
|
* @details If enabled then a field is added to the @p thread_t structure that
|
||||||
|
* counts the system ticks occurred while executing the thread.
|
||||||
|
*
|
||||||
|
* @note The default is @p FALSE.
|
||||||
|
* @note This debug option is not currently compatible with the
|
||||||
|
* tickless mode.
|
||||||
|
*/
|
||||||
|
#define CH_DBG_THREADS_PROFILING FALSE
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/**
|
||||||
|
* @name Kernel hooks
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads descriptor structure extension.
|
||||||
|
* @details User fields added to the end of the @p thread_t structure.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
||||||
|
/* Add threads custom fields here.*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads initialization hook.
|
||||||
|
* @details User initialization code added to the @p chThdInit() API.
|
||||||
|
*
|
||||||
|
* @note It is invoked from within @p chThdInit() and implicitly from all
|
||||||
|
* the threads creation APIs.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
||||||
|
/* Add threads initialization code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Threads finalization hook.
|
||||||
|
* @details User finalization code added to the @p chThdExit() API.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
|
||||||
|
/* Add threads finalization code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Context switch hook.
|
||||||
|
* @details This hook is invoked just before switching between threads.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
||||||
|
/* Context switch code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR enter hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
||||||
|
/* IRQ prologue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ISR exit hook.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
||||||
|
/* IRQ epilogue code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread enter hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to activate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_ENTER_HOOK() { \
|
||||||
|
/* Idle-enter code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle thread leave hook.
|
||||||
|
* @note This hook is invoked within a critical zone, no OS functions
|
||||||
|
* should be invoked from here.
|
||||||
|
* @note This macro can be used to deactivate a power saving mode.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_LEAVE_HOOK() { \
|
||||||
|
/* Idle-leave code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Idle Loop hook.
|
||||||
|
* @details This hook is continuously invoked by the idle thread loop.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_IDLE_LOOP_HOOK() { \
|
||||||
|
/* Idle loop code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System tick event hook.
|
||||||
|
* @details This hook is invoked in the system tick handler immediately
|
||||||
|
* after processing the virtual timers queue.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_SYSTEM_TICK_HOOK() { \
|
||||||
|
/* System tick event code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief System halt hook.
|
||||||
|
* @details This hook is invoked in case to a system halting error before
|
||||||
|
* the system is halted.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||||
|
/* System halt code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace hook.
|
||||||
|
* @details This hook is invoked each time a new record is written in the
|
||||||
|
* trace buffer.
|
||||||
|
*/
|
||||||
|
#define CH_CFG_TRACE_HOOK(tep) { \
|
||||||
|
/* Trace code here.*/ \
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Port-specific settings (override port settings defaulted in chcore.h). */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#endif /* CHCONF_H */
|
||||||
|
|
||||||
|
/** @} */
|
80
keyboard/kl27z_onekey/config.h
Normal file
80
keyboard/kl27z_onekey/config.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0xFEED
|
||||||
|
#define PRODUCT_ID 0x1111
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||||
|
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||||
|
#define MANUFACTURER "TMK"
|
||||||
|
#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00'
|
||||||
|
#define PRODUCT "ChibiOS TMK test"
|
||||||
|
#define USBSTR_PRODUCT 'C', '\x00', 'h', '\x00', 'i', '\x00', 'b', '\x00', 'i', '\x00', 'O', '\x00', 'S', '\x00', ' ', '\x00', 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', 't', '\x00', 'e', '\x00', 's', '\x00', 't', '\x00'
|
||||||
|
#define DESCRIPTION "TMK keyboard firmware over ChibiOS"
|
||||||
|
|
||||||
|
/* key matrix size */
|
||||||
|
#define MATRIX_ROWS 1
|
||||||
|
#define MATRIX_COLS 1
|
||||||
|
|
||||||
|
/* define if matrix has ghost */
|
||||||
|
//#define MATRIX_HAS_GHOST
|
||||||
|
|
||||||
|
/* Set 0 if debouncing isn't needed */
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
|
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||||
|
#define LOCKING_SUPPORT_ENABLE
|
||||||
|
/* Locking resynchronize hack */
|
||||||
|
#define LOCKING_RESYNC_ENABLE
|
||||||
|
|
||||||
|
/* key combination for command */
|
||||||
|
#define IS_COMMAND() ( \
|
||||||
|
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Feature disable options
|
||||||
|
* These options are also useful to firmware size reduction.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* disable debug print */
|
||||||
|
//#define NO_DEBUG
|
||||||
|
|
||||||
|
/* disable print */
|
||||||
|
//#define NO_PRINT
|
||||||
|
|
||||||
|
/* disable action features */
|
||||||
|
//#define NO_ACTION_LAYER
|
||||||
|
//#define NO_ACTION_TAPPING
|
||||||
|
//#define NO_ACTION_ONESHOT
|
||||||
|
//#define NO_ACTION_MACRO
|
||||||
|
//#define NO_ACTION_FUNCTION
|
||||||
|
|
||||||
|
// TODO: add this to ChibiOS-Contrib/os/common/ext/CMSIS/KINETIS/kl27zxxx.h
|
||||||
|
#ifndef USBx_CTL_RESUME
|
||||||
|
#define USBx_CTL_RESUME ((uint8_t)0x04) /*!< Executes resume signaling */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
187
keyboard/kl27z_onekey/halconf.h
Normal file
187
keyboard/kl27z_onekey/halconf.h
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file templates/halconf.h
|
||||||
|
* @brief HAL configuration header.
|
||||||
|
* @details HAL configuration file, this file allows to enable or disable the
|
||||||
|
* various device drivers from your application. You may also use
|
||||||
|
* this file in order to override the device drivers default settings.
|
||||||
|
*
|
||||||
|
* @addtogroup HAL_CONF
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HALCONF_H_
|
||||||
|
#define _HALCONF_H_
|
||||||
|
|
||||||
|
#include "mcuconf.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the PAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_PAL TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ADC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_ADC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the CAN subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_CAN FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the DAC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_DAC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the EXT subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_EXT FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the GPT subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_GPT FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the I2C subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_I2C FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the I2S subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_I2S FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ICU subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_ICU FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MAC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_MAC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the MMC_SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_MMC_SPI FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the PWM subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_PWM FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the RTC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_RTC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SDC subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SDC FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SERIAL subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SERIAL FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SERIAL over USB subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SERIAL_USB FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the SPI subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_SPI FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the UART subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_UART FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the USB subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_USB TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the WDG subsystem.
|
||||||
|
*/
|
||||||
|
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
|
||||||
|
#define HAL_USE_WDG FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* USB driver related settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables synchronous APIs.
|
||||||
|
* @note Disabling this option saves both code and data space.
|
||||||
|
*/
|
||||||
|
#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
|
||||||
|
#define USB_USE_WAIT TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _HALCONF_H_ */
|
||||||
|
|
||||||
|
/** @} */
|
102
keyboard/kl27z_onekey/kl27z_onekey.c
Normal file
102
keyboard/kl27z_onekey/kl27z_onekey.c
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ch.h"
|
||||||
|
#include "hal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* scan matrix
|
||||||
|
*/
|
||||||
|
#include "print.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "wait.h"
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "led.h"
|
||||||
|
#include "keymap.h"
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_rows(void)
|
||||||
|
{
|
||||||
|
return MATRIX_ROWS;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
uint8_t matrix_cols(void)
|
||||||
|
{
|
||||||
|
return MATRIX_COLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_init(void)
|
||||||
|
{
|
||||||
|
// internal pull-up
|
||||||
|
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_PULLUP);
|
||||||
|
|
||||||
|
// LED blink
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palClearPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
chThdSleepMilliseconds(200);
|
||||||
|
palClearPad(GPIOD, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t matrix_scan(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||||
|
{
|
||||||
|
return !palReadPad(GPIOA, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
matrix_row_t matrix_get_row(uint8_t row)
|
||||||
|
{
|
||||||
|
return !palReadPad(GPIOA, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void matrix_print(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void led_set(uint8_t usb_led) {
|
||||||
|
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
|
||||||
|
// output high
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
|
palSetPad(GPIOD, 7);
|
||||||
|
} else {
|
||||||
|
// Hi-Z
|
||||||
|
palSetPadMode(GPIOD, 7, PAL_MODE_INPUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Keymap
|
||||||
|
//
|
||||||
|
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
{{KC_A}},
|
||||||
|
};
|
||||||
|
|
||||||
|
const action_t fn_actions[] = {
|
||||||
|
};
|
80
keyboard/kl27z_onekey/mcuconf.h
Normal file
80
keyboard/kl27z_onekey/mcuconf.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _MCUCONF_H_
|
||||||
|
#define _MCUCONF_H_
|
||||||
|
|
||||||
|
#define KL2x_MCUCONF
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HAL driver system settings.
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
/* High-frequency internal RC, 48MHz, possible USB clock recovery */
|
||||||
|
#define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_HIRC
|
||||||
|
#define KINETIS_SYSCLK_FREQUENCY 48000000UL
|
||||||
|
#define KINETIS_CLKDIV1_OUTDIV1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Low-frequency internal RC, 8 MHz mode */
|
||||||
|
#define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_LIRC8M
|
||||||
|
#define KINETIS_SYSCLK_FREQUENCY 8000000UL
|
||||||
|
#define KINETIS_CLKDIV1_OUTDIV1 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SERIAL driver system settings.
|
||||||
|
*/
|
||||||
|
#define KINETIS_SERIAL_USE_UART0 TRUE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* USB driver settings
|
||||||
|
*/
|
||||||
|
#define KINETIS_USB_USE_USB0 TRUE
|
||||||
|
/* need to redefine this, since the default is for K20x */
|
||||||
|
#define KINETIS_USB_USB0_IRQ_PRIORITY 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Kinetis FOPT configuration byte
|
||||||
|
*/
|
||||||
|
/* for KL27: */
|
||||||
|
#define KINETIS_NV_FOPT_BYTE 0x39
|
||||||
|
#define KINETIS_NV_FSEC_BYTE 0x7E
|
||||||
|
/* NV_FOPT: bit7-6/BOOTSRC_SEL=0b00 (11=from ROM; 00=from FLASH)
|
||||||
|
bit5/FAST_INIT=1, bit4/LPBOOT1=1,
|
||||||
|
bit3/RESET_PIN_CFG=1, bit2/NMI_DIS=1,
|
||||||
|
bit1/BOOTPIN_OPT=0, bit0/LPBOOT0=1 */
|
||||||
|
/* BOOTPIN_OPT: 1=boot depends on BOOTSRC_SEL
|
||||||
|
0=boot samples BOOTCFG0=NMI pin */
|
||||||
|
/* Boot sequence, page 88 of manual:
|
||||||
|
* - If the NMI/BOOTCFG0 input is high or the NMI function is disabled in FTFA_FOPT, the CPU begins execution at the PC location.
|
||||||
|
* - If the NMI/BOOTCFG0 input is low, the NMI function is enabled in FTFA_FOPT, and FTFA_FOPT[BOOTPIN_OPT] = 1, this results in an NMI interrupt. The processor executes an Exception Entry and reads the NMI interrupt handler address from vector-table offset 8. The CPU begins execution at the NMI interrupt handler.
|
||||||
|
* - When FTFA_FOPT[BOOTPIN_OPT] = 0, it forces boot from ROM if NMI/BOOTCFG0 pin set to 0.
|
||||||
|
*
|
||||||
|
* Observed behaviour:
|
||||||
|
* - when BOOTPIN_OPT=0, BOOTSRC_SEL still matters:
|
||||||
|
* - if 0b11 (from ROM), it still boots from ROM, even if BOOTCFG0 pin
|
||||||
|
* is high/floating, but leaves ROM and runs user app after
|
||||||
|
* 5 seconds delay.
|
||||||
|
* - if 0b00 (from FLASH), reset/powerup jumps to user app unless
|
||||||
|
* BOOTCFG0 pin is asserted.
|
||||||
|
* - in any case, reset when in bootloader induces the 5 second delay
|
||||||
|
* before starting the user app.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* _MCUCONF_H_ */
|
@ -21,6 +21,7 @@ SRC += $(COMMON_DIR)/host.c \
|
|||||||
ifeq (yes,$(strip $(UNIMAP_ENABLE)))
|
ifeq (yes,$(strip $(UNIMAP_ENABLE)))
|
||||||
SRC += $(COMMON_DIR)/unimap.c
|
SRC += $(COMMON_DIR)/unimap.c
|
||||||
OPT_DEFS += -DUNIMAP_ENABLE
|
OPT_DEFS += -DUNIMAP_ENABLE
|
||||||
|
OPT_DEFS += -DACTIONMAP_ENABLE
|
||||||
else
|
else
|
||||||
ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
|
ifeq (yes,$(strip $(ACTIONMAP_ENABLE)))
|
||||||
SRC += $(COMMON_DIR)/actionmap.c
|
SRC += $(COMMON_DIR)/actionmap.c
|
||||||
|
@ -101,7 +101,7 @@ void process_action(keyrecord_t *record)
|
|||||||
{
|
{
|
||||||
uint8_t mods = (action.kind.id == ACT_LMODS_TAP) ? action.key.mods :
|
uint8_t mods = (action.kind.id == ACT_LMODS_TAP) ? action.key.mods :
|
||||||
action.key.mods<<4;
|
action.key.mods<<4;
|
||||||
switch (action.layer_tap.code) {
|
switch (action.key.code) {
|
||||||
#ifndef NO_ACTION_ONESHOT
|
#ifndef NO_ACTION_ONESHOT
|
||||||
case MODS_ONESHOT:
|
case MODS_ONESHOT:
|
||||||
// Oneshot modifier
|
// Oneshot modifier
|
||||||
@ -247,14 +247,18 @@ void process_action(keyrecord_t *record)
|
|||||||
case ACT_LAYER_TAP:
|
case ACT_LAYER_TAP:
|
||||||
case ACT_LAYER_TAP_EXT:
|
case ACT_LAYER_TAP_EXT:
|
||||||
switch (action.layer_tap.code) {
|
switch (action.layer_tap.code) {
|
||||||
case 0xe0 ... 0xef:
|
case 0xc0 ... 0xdf:
|
||||||
/* layer On/Off with modifiers(left only) */
|
/* layer On/Off with modifiers */
|
||||||
if (event.pressed) {
|
if (event.pressed) {
|
||||||
layer_on(action.layer_tap.val);
|
layer_on(action.layer_tap.val);
|
||||||
register_mods(action.layer_tap.code & 0x0f);
|
register_mods((action.layer_tap.code & 0x10) ?
|
||||||
|
(action.layer_tap.code & 0x0f) << 4 :
|
||||||
|
(action.layer_tap.code & 0x0f));
|
||||||
} else {
|
} else {
|
||||||
layer_off(action.layer_tap.val);
|
layer_off(action.layer_tap.val);
|
||||||
unregister_mods(action.layer_tap.code & 0x0f);
|
unregister_mods((action.layer_tap.code & 0x10) ?
|
||||||
|
(action.layer_tap.code & 0x0f) << 4 :
|
||||||
|
(action.layer_tap.code & 0x0f));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OP_TAP_TOGGLE:
|
case OP_TAP_TOGGLE:
|
||||||
@ -532,10 +536,20 @@ bool is_tap_key(keypos_t key)
|
|||||||
switch (action.kind.id) {
|
switch (action.kind.id) {
|
||||||
case ACT_LMODS_TAP:
|
case ACT_LMODS_TAP:
|
||||||
case ACT_RMODS_TAP:
|
case ACT_RMODS_TAP:
|
||||||
|
switch (action.key.code) {
|
||||||
|
case MODS_ONESHOT:
|
||||||
|
case MODS_TAP_TOGGLE:
|
||||||
|
case KC_A ... KC_EXSEL: // tap key
|
||||||
|
case KC_LCTRL ... KC_RGUI: // tap key
|
||||||
|
return true;
|
||||||
|
}
|
||||||
case ACT_LAYER_TAP:
|
case ACT_LAYER_TAP:
|
||||||
case ACT_LAYER_TAP_EXT:
|
case ACT_LAYER_TAP_EXT:
|
||||||
switch (action.layer_tap.code) {
|
switch (action.layer_tap.code) {
|
||||||
case 0x00 ... 0xdf:
|
case 0xc0 ... 0xdf: // with modifiers
|
||||||
|
return false;
|
||||||
|
case KC_A ... KC_EXSEL: // tap key
|
||||||
|
case KC_LCTRL ... KC_RGUI: // tap key
|
||||||
case OP_TAP_TOGGLE:
|
case OP_TAP_TOGGLE:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
* 000r|0000|0000 0001 Transparent code
|
* 000r|0000|0000 0001 Transparent code
|
||||||
* 000r|0000| keycode Key
|
* 000r|0000| keycode Key
|
||||||
* 000r|mods|0000 0000 Modifiers
|
* 000r|mods|0000 0000 Modifiers
|
||||||
* 000r|mods| keycode Modifiers+Key(Modified key)
|
* 000r|mods| keycode Modifiers+key(Modified key)
|
||||||
* r: Left/Right flag(Left:0, Right:1)
|
* r: Left/Right flag(Left:0, Right:1)
|
||||||
*
|
*
|
||||||
* ACT_MODS_TAP(001r):
|
* ACT_MODS_TAP(001r):
|
||||||
* 001r|mods|0000 0000 Modifiers with OneShot
|
* 001r|mods|0000 0000 Modifiers with OneShot[TAP]
|
||||||
* 001r|mods|0000 0001 Modifiers with tap toggle
|
* 001r|mods|0000 0001 Modifiers with tap toggle[TAP]
|
||||||
* 001r|mods|0000 00xx (reserved)
|
* 001r|mods|0000 00xx (reserved) (0x02-03)
|
||||||
* 001r|mods| keycode Modifiers with Tap Key(Dual role)
|
* 001r|mods| keycode Modifiers with tap key(0x04-A4, E0-E7)[TAP]
|
||||||
|
* (reserved) (0xA5-DF, E8-FF)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Other Keys(01xx)
|
* Other Keys(01xx)
|
||||||
@ -70,13 +71,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
* 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
|
* 1001|oopp|BBBB BBBB 8-bit Bitwise Operation???
|
||||||
*
|
*
|
||||||
* ACT_LAYER_TAP(101x):
|
* ACT_LAYER_TAP(101x):
|
||||||
* 101E|LLLL| keycode On/Off with tap key (0x00-DF)[TAP]
|
* 101E|LLLL| keycode On/Off with tap key (0x04-A4, E0-E7)[TAP]
|
||||||
* 101E|LLLL|1110 mods On/Off with modifiers (0xE0-EF)[NOT TAP]
|
* 101E|LLLL|110r mods On/Off with modifiers (0xC0-DF)[NOT TAP]
|
||||||
|
* r: Left/Right flag(Left:0, Right:1)
|
||||||
|
* (reserved) (0xA5-BF, E8-EF)
|
||||||
* 101E|LLLL|1111 0000 Invert with tap toggle (0xF0) [TAP]
|
* 101E|LLLL|1111 0000 Invert with tap toggle (0xF0) [TAP]
|
||||||
* 101E|LLLL|1111 0001 On/Off (0xF1) [NOT TAP]
|
* 101E|LLLL|1111 0001 On/Off (0xF1) [NOT TAP]
|
||||||
* 101E|LLLL|1111 0010 Off/On (0xF2) [NOT TAP]
|
* 101E|LLLL|1111 0010 Off/On (0xF2) [NOT TAP]
|
||||||
* 101E|LLLL|1111 0011 Set/Clear (0xF3) [NOT TAP]
|
* 101E|LLLL|1111 0011 Set/Clear (0xF3) [NOT TAP]
|
||||||
* 101E|LLLL|1111 xxxx Reserved (0xF4-FF)
|
* 101E|LLLL|1111 xxxx (reserved) (0xF4-FF)
|
||||||
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
|
* ELLLL: layer 0-31(E: extra bit for layer 16-31)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -197,6 +200,7 @@ typedef union {
|
|||||||
* bit 4 +----- LR flag(Left:0, Right:1)
|
* bit 4 +----- LR flag(Left:0, Right:1)
|
||||||
*/
|
*/
|
||||||
enum mods_bit {
|
enum mods_bit {
|
||||||
|
MOD_NONE = 0x00,
|
||||||
MOD_LCTL = 0x01,
|
MOD_LCTL = 0x01,
|
||||||
MOD_LSFT = 0x02,
|
MOD_LSFT = 0x02,
|
||||||
MOD_LALT = 0x04,
|
MOD_LALT = 0x04,
|
||||||
@ -267,7 +271,7 @@ enum layer_pram_tap_op {
|
|||||||
#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
|
#define ACTION_LAYER_ON_OFF(layer) ACTION_LAYER_TAP((layer), OP_ON_OFF)
|
||||||
#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
|
#define ACTION_LAYER_OFF_ON(layer) ACTION_LAYER_TAP((layer), OP_OFF_ON)
|
||||||
#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
|
#define ACTION_LAYER_SET_CLEAR(layer) ACTION_LAYER_TAP((layer), OP_SET_CLEAR)
|
||||||
#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xe0 | ((mods)&0x0f))
|
#define ACTION_LAYER_MODS(layer, mods) ACTION_LAYER_TAP((layer), 0xc0 | ((mods)&0x1f))
|
||||||
/* With Tapping */
|
/* With Tapping */
|
||||||
#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
|
#define ACTION_LAYER_TAP_KEY(layer, key) ACTION_LAYER_TAP((layer), (key))
|
||||||
#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)
|
#define ACTION_LAYER_TAP_TOGGLE(layer) ACTION_LAYER_TAP((layer), OP_TAP_TOGGLE)
|
||||||
|
@ -25,7 +25,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
|
#define IS_ERROR(code) (KC_ROLL_OVER <= (code) && (code) <= KC_UNDEFINED)
|
||||||
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
|
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
|
||||||
|
|
||||||
|
#ifndef ACTIONMAP_ENABLE
|
||||||
#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
|
#define IS_KEY(code) (KC_A <= (code) && (code) <= KC_EXSEL)
|
||||||
|
#else
|
||||||
|
#define IS_KEY(code) ((KC_A <= (code) && (code) <= KC_EXSEL) || \
|
||||||
|
(KC_KP_00 <= (code) && (code) <= KC_KP_HEXADECIMAL))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI)
|
#define IS_MOD(code) (KC_LCTRL <= (code) && (code) <= KC_RGUI)
|
||||||
|
|
||||||
|
|
||||||
@ -179,7 +186,7 @@ enum hid_keyboard_keypad_usage {
|
|||||||
KC_ROLL_OVER,
|
KC_ROLL_OVER,
|
||||||
KC_POST_FAIL,
|
KC_POST_FAIL,
|
||||||
KC_UNDEFINED,
|
KC_UNDEFINED,
|
||||||
KC_A,
|
KC_A, /* 0x04 */
|
||||||
KC_B,
|
KC_B,
|
||||||
KC_C,
|
KC_C,
|
||||||
KC_D,
|
KC_D,
|
||||||
@ -341,10 +348,7 @@ enum hid_keyboard_keypad_usage {
|
|||||||
KC_CRSEL,
|
KC_CRSEL,
|
||||||
KC_EXSEL, /* 0xA4 */
|
KC_EXSEL, /* 0xA4 */
|
||||||
|
|
||||||
/* NOTE: 0xA5-DF are used for internal special purpose */
|
/* NOTE: Following code range(0xB0-DD) are shared with special codes of 8-bit keymap */
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* NOTE: Following codes(0xB0-DD) are not used. Leave them for reference. */
|
|
||||||
KC_KP_00 = 0xB0,
|
KC_KP_00 = 0xB0,
|
||||||
KC_KP_000,
|
KC_KP_000,
|
||||||
KC_THOUSANDS_SEPARATOR,
|
KC_THOUSANDS_SEPARATOR,
|
||||||
@ -391,7 +395,6 @@ enum hid_keyboard_keypad_usage {
|
|||||||
KC_KP_OCTAL,
|
KC_KP_OCTAL,
|
||||||
KC_KP_DECIMAL,
|
KC_KP_DECIMAL,
|
||||||
KC_KP_HEXADECIMAL, /* 0xDD */
|
KC_KP_HEXADECIMAL, /* 0xDD */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Modifiers */
|
/* Modifiers */
|
||||||
KC_LCTRL = 0xE0,
|
KC_LCTRL = 0xE0,
|
||||||
@ -401,13 +404,11 @@ enum hid_keyboard_keypad_usage {
|
|||||||
KC_RCTRL,
|
KC_RCTRL,
|
||||||
KC_RSHIFT,
|
KC_RSHIFT,
|
||||||
KC_RALT,
|
KC_RALT,
|
||||||
KC_RGUI,
|
KC_RGUI, /* 0xE7 */
|
||||||
|
|
||||||
/* NOTE: 0xE8-FF are used for internal special purpose */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Special keycodes */
|
/* Special keycodes for 8-bit keymap
|
||||||
/* NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
|
NOTE: 0xA5-DF and 0xE8-FF are used for internal special purpose */
|
||||||
enum internal_special_keycodes {
|
enum internal_special_keycodes {
|
||||||
/* System Control */
|
/* System Control */
|
||||||
KC_SYSTEM_POWER = 0xA5,
|
KC_SYSTEM_POWER = 0xA5,
|
||||||
|
@ -569,7 +569,7 @@ This registers modifier key(s) simultaneously with layer switching.
|
|||||||
|
|
||||||
ACTION_LAYER_MODS(2, MOD_LSFT | MOD_LALT)
|
ACTION_LAYER_MODS(2, MOD_LSFT | MOD_LALT)
|
||||||
|
|
||||||
This function can only register left-sided modifiers. The handedness of the modifier (left/right) is an extra bit that is not able to be passed through into the layer system. See: [`common/action_code.h`](../common/action_code.h), the spec for ACT_LAYER_TAP only allows four bits for the mods, whereas the mods themselves require five bits, with the high bit being the left/right handedness.
|
You can combine four modifiers at most but cannot use both left and right modifiers at a time, either left or right modiiers only can be allowed.
|
||||||
|
|
||||||
|
|
||||||
## 4. Tapping
|
## 4. Tapping
|
||||||
|
Loading…
Reference in New Issue
Block a user