-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
720bf8a
commit 3284d25
Showing
19 changed files
with
899 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This is global git excludes file which is intended point to location configured core.excludesfile option. | ||
# You can check current value of it by running: | ||
# git config --get core.excludesfile | ||
.env | ||
|
||
# Vim backup, undo files | ||
*.orig | ||
*~ | ||
|
||
# Vim swap files | ||
.*.swp | ||
.*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# The Kconfig.defconfig file is where overrides for various configuration settings that make sense | ||
# to have different defaults when this shield is used. | ||
# One main item that usually has a new default value set here is the ZMK_KEYBOARD_NAME value, | ||
# which controls the display name of the device over USB and BLE. | ||
# The updated new default values should always be wrapped inside a conditional on the shield | ||
# config name defined in the Kconfig.shield file. | ||
# | ||
# The side with the PS2 Mouse / TP has to be the central half | ||
|
||
if SHIELD_THINK_CORNE_RIGHT | ||
|
||
config ZMK_KEYBOARD_NAME | ||
default "ThinkCorne" | ||
|
||
config ZMK_SPLIT_ROLE_CENTRAL | ||
default y | ||
|
||
endif | ||
|
||
if SHIELD_THINK_CORNE_LEFT || SHIELD_THINK_CORNE_RIGHT | ||
|
||
config ZMK_SPLIT | ||
default y | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2020 Pete Johanson | ||
# SPDX-License-Identifier: MIT | ||
|
||
# The Kconfig.shield file defines any additional Kconfig settings that may be relevant when using this keyboard. | ||
# For most keyboards, there is just one additional configuration value for the shield itself. | ||
|
||
config SHIELD_THINK_CORNE_LEFT | ||
def_bool $(shields_list_contains,think_corne_left) | ||
|
||
config SHIELD_THINK_CORNE_RIGHT | ||
def_bool $(shields_list_contains,think_corne_right) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,269 @@ | ||
#include <dt-bindings/zmk/matrix_transform.h> | ||
|
||
/* | ||
* Matrix | ||
*/ | ||
|
||
/ { | ||
chosen { | ||
zmk,kscan = &kscan0; | ||
zmk,matrix_transform = &default_transform; | ||
}; | ||
|
||
default_transform: keymap_transform_0 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <12>; | ||
rows = <4>; | ||
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | | ||
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | | ||
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | | ||
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | | ||
map = < | ||
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) | ||
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) | ||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11) | ||
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) | ||
>; | ||
}; | ||
|
||
five_column_transform: keymap_transform_1 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <10>; | ||
rows = <4>; | ||
// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | | ||
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | | ||
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | | ||
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | | ||
map = < | ||
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) | ||
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) | ||
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) | ||
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) | ||
>; | ||
}; | ||
|
||
kscan0: kscan { | ||
compatible = "zmk,kscan-gpio-matrix"; | ||
|
||
diode-direction = "col2row"; | ||
row-gpios | ||
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
; | ||
|
||
}; | ||
|
||
// TODO: per-key RGB node(s)? | ||
}; | ||
|
||
/* | ||
* Nice!View | ||
*/ | ||
|
||
&pinctrl { | ||
spi0_default: spi0_default { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 17)>, | ||
<NRF_PSEL(SPIM_MISO, 0, 25)>; | ||
}; | ||
}; | ||
spi0_sleep: spi0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(SPIM_SCK, 0, 20)>, | ||
<NRF_PSEL(SPIM_MOSI, 0, 17)>, | ||
<NRF_PSEL(SPIM_MISO, 0, 25)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
nice_view_spi: &spi0 { | ||
compatible = "nordic,nrf-spim"; | ||
pinctrl-0 = <&spi0_default>; | ||
pinctrl-1 = <&spi0_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
cs-gpios = <&pro_micro 9 GPIO_ACTIVE_HIGH>; // Not the default 1 | ||
}; | ||
|
||
&pro_micro_i2c { | ||
status = "disabled"; | ||
}; | ||
|
||
/* | ||
* PS/2 Mouse / Trackpoint | ||
*/ | ||
|
||
// Configure the SCL and SDA pins of the PS/2 mouse/tp using the `&pro_micro` | ||
// notation. | ||
// | ||
// If possible, try to choose the blue high frequency pins to avoid | ||
// bluetooth interference. | ||
// | ||
// On the nice!nano documentation these are green DX pins: | ||
// https://nicekeyboards.com/docs/nice-nano/pinout-schematic | ||
// | ||
#define MOUSE_PS2_PIN_SCL_PRO_MICRO <&pro_micro 1 GPIO_ACTIVE_HIGH> | ||
#define MOUSE_PS2_PIN_SDA_PRO_MICRO <&pro_micro 0 GPIO_ACTIVE_HIGH> | ||
|
||
|
||
// Uncomment and configure this pin if you have an extra free pin and want the | ||
// controller to perform the Power-On-Reset sequence, which many trackpoints | ||
// require, instead of using a trackpoint reset circuit. | ||
// | ||
// It's ok to use a low-frequency pin for this. | ||
#define MOUSE_PS2_PIN_RST_PRO_MICRO <&pro_micro 9 GPIO_ACTIVE_HIGH> | ||
|
||
|
||
// Now configure the same SDA pin using the pinctrl notation. | ||
// | ||
// For that you have to use the PX.XX notation of the nrf52 chip. | ||
// | ||
// On the nice!nano pinout they are shown in blue and purple next to the green | ||
// DX pin. | ||
// | ||
// Enter it like `X, Y` without leading zeroes. | ||
// Examples: | ||
// D0 - P0.08: 0, 8 | ||
// D15 - P1.13: 1, 13 | ||
// | ||
// We don't define the SCL pin, because UART uses a baud rate instead of | ||
// a clock pin. | ||
#define MOUSE_PS2_PIN_SDA_PINCTRL <NRF_PSEL(UART_RX, 0, 8)> | ||
|
||
|
||
// In UART two different pins are used for receiving and transmitting, but PS/2 | ||
// uses the same pin for both. | ||
// | ||
// The UART config still requires both pins to be configured. So we use one of | ||
// the nrf52 pins that are not exposed on the nice!nano board. | ||
#define MOUSE_PS2_PIN_UNEXPOSED_TX <NRF_PSEL(UART_TX, 0, 27)> | ||
#define MOUSE_PS2_PIN_UNEXPOSED_RX <NRF_PSEL(UART_RX, 0, 28)> | ||
|
||
|
||
// The PS/2 GPIO driver | ||
/ { | ||
gpio_ps2: gpio_ps2 { | ||
status = "disabled"; | ||
compatible = "gpio-ps2"; | ||
scl-gpios = MOUSE_PS2_PIN_SCL_PRO_MICRO; | ||
sda-gpios = MOUSE_PS2_PIN_SDA_PRO_MICRO; | ||
}; | ||
}; | ||
|
||
|
||
&pinctrl { | ||
// This pinctrl state is used for receiving | ||
// For `UART_TX`, set an unused and unexposed pin | ||
// For `UART_RX`, set the PS/2 SDA pin number | ||
uart0_ps2_default: uart0_ps2_default { | ||
group1 { | ||
psels = MOUSE_PS2_PIN_UNEXPOSED_TX, | ||
MOUSE_PS2_PIN_SDA_PINCTRL; | ||
}; | ||
}; | ||
|
||
// Set this to the same pins as uart0_ps2_default | ||
uart0_ps2_sleep: uart0_ps2_sleep { | ||
group1 { | ||
psels = MOUSE_PS2_PIN_UNEXPOSED_TX, | ||
MOUSE_PS2_PIN_SDA_PINCTRL; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
// The nrf52 UART controller is not compatible with the PS/2 | ||
// transmission frame. So we don't use UART for transmissions | ||
// and instead use GPIO bitbanging. | ||
// | ||
// When we switch to transmit mode, we free up the SDA pin by switching | ||
// UART to unexposed/unused pins. | ||
// | ||
// Then we can configure the pins to be used with the GPIO controller. | ||
uart0_ps2_off: uart0_ps2_off { | ||
group1 { | ||
psels = MOUSE_PS2_PIN_UNEXPOSED_TX, | ||
MOUSE_PS2_PIN_UNEXPOSED_RX; | ||
}; | ||
}; | ||
}; | ||
|
||
|
||
&uart0 { | ||
status = "disabled"; | ||
compatible = "nordic,nrf-uarte"; | ||
|
||
// PS/2 uses a clock pin to syncronize data transmissions. UART on the | ||
// other hand uses a pre-defined frequency (baud rate). | ||
// | ||
// Fortunately, one of the available baud rates is very close to the | ||
// frequency used in IBM/Lenovo trackpoints. | ||
// | ||
// You can find other configurable baud rates here: | ||
// https://docs.zephyrproject.org/latest/build/dts/api/bindings/serial/nordic,nrf-uarte.html | ||
// | ||
// But most likely you won't need to adjust this. | ||
// | ||
// You can measure the frequency of your mouse/TP using a $5 logic | ||
// analyzer from AliExpress. | ||
// | ||
// Actual frequency of PS/2 trackpoint: 67us | ||
// Correspondent baud rate: 14,925 | ||
// | ||
// Closest available baud rate in zephyr: 14,400 | ||
// Correspondent cycle length: 69.44 microseconds | ||
// | ||
// Calculations: | ||
// | ||
// Convert cycle length in microseconds into baud: | ||
// 1 / PS2_CYCLE_LENGTH * 1000000 = BAUD | ||
// 1 / 67 * 1000000 = 14,925 BAUD | ||
// | ||
// Convert baud into cycle length: | ||
// 1 / BAUD * 1000000 = CYCLE_LEN (in microseconds) | ||
// 1 / 14400 * 1000000 = 69.44 | ||
// | ||
current-speed = <14400>; | ||
pinctrl-0 = <&uart0_ps2_default>; | ||
pinctrl-1 = <&uart0_ps2_off>; | ||
|
||
pinctrl-names = "default", "sleep"; | ||
|
||
uart_ps2: uart_ps2 { | ||
status="disabled"; | ||
compatible = "uart-ps2"; | ||
scl-gpios = MOUSE_PS2_PIN_SCL_PRO_MICRO; | ||
sda-gpios = MOUSE_PS2_PIN_SDA_PRO_MICRO; | ||
}; | ||
}; | ||
|
||
|
||
/ { | ||
mouse_ps2: mouse_ps2 { | ||
status = "disabled"; | ||
compatible = "zmk,input-mouse-ps2"; | ||
|
||
// This will be overriden in your `xxx_right.overlay file`. | ||
// ps2-device = <&gpio_ps2>; | ||
ps2-device = <&uart_ps2>; | ||
|
||
#ifdef MOUSE_PS2_PIN_RST_PRO_MICRO | ||
rst-gpios = MOUSE_PS2_PIN_RST_PRO_MICRO; | ||
#endif | ||
}; | ||
|
||
input_config: input_config { | ||
compatible = "zmk,input-configs"; | ||
status = "disabled"; | ||
|
||
mouse_ps2_config: mouse_ps2_config { | ||
device = <&mouse_ps2>; | ||
|
||
// Some of the available settings depend on the keymap. So they | ||
// are adjusted in... | ||
// ../../../includes/trackpoint.dtsi | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
file_format: "1" | ||
id: think_corne | ||
name: ThinkCorne | ||
type: shield | ||
url: https://github.com/infused-kim/kb_think_corney | ||
requires: [pro_micro] | ||
features: | ||
- keys | ||
- display | ||
siblings: | ||
- think_corne_left | ||
- think_corne_right |
Empty file.
21 changes: 21 additions & 0 deletions
21
config/boards/shields/think_corne/think_corne_left.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2020 Pete Johanson | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
#include "think_corne.dtsi" | ||
|
||
/* | ||
* Matrix | ||
*/ | ||
|
||
&kscan0 { | ||
col-gpios | ||
= <&pro_micro 21 GPIO_ACTIVE_HIGH> | ||
, <&pro_micro 20 GPIO_ACTIVE_HIGH> | ||
, <&pro_micro 19 GPIO_ACTIVE_HIGH> | ||
, <&pro_micro 18 GPIO_ACTIVE_HIGH> | ||
, <&pro_micro 15 GPIO_ACTIVE_HIGH> | ||
, <&pro_micro 14 GPIO_ACTIVE_HIGH> | ||
; | ||
}; |
Empty file.
Oops, something went wrong.