summaryrefslogtreecommitdiff
path: root/config/corne_right.overlay
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2024-01-27 00:17:50 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2024-01-27 01:08:56 +0100
commitfa935f17408d7373b9419bf19b9cecc48f363765 (patch)
tree8c8ac112bf0087debd90d844adb6c41e9cf60e31 /config/corne_right.overlay
parent20c10e8ed1d3710cb83367ca18202e7f160f2506 (diff)
downloadzmk-config-fa935f17408d7373b9419bf19b9cecc48f363765.tar.gz
zmk-config-fa935f17408d7373b9419bf19b9cecc48f363765.zip
ps2
Diffstat (limited to 'config/corne_right.overlay')
-rw-r--r--config/corne_right.overlay262
1 files changed, 262 insertions, 0 deletions
diff --git a/config/corne_right.overlay b/config/corne_right.overlay
new file mode 100644
index 0000000..d0b2c61
--- /dev/null
+++ b/config/corne_right.overlay
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2020 Pete Johanson
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#include "boards/shields/corne/corne.dtsi"
+
+/*
+ * PS/2 Mouse / Trackpoint
+ */
+
+// Enable PS/2 drivers on this side of the keyboard.
+// MUST be the central.
+//
+// Comment out the following define to use the GPIO driver instead of UART
+// (this is not recommended unless you can't use the UART driver for whatever
+// reason)
+#define MOUSE_PS2_DRIVER_UART
+
+#ifdef MOUSE_PS2_DRIVER_UART
+ &uart0 {
+ status = "okay";
+ };
+ &uart_ps2 {
+ status = "okay";
+ };
+#else
+ &gpio_ps2 {
+ status = "okay";
+ };
+#endif
+
+&mouse_ps2 {
+ status = "okay";
+
+#ifdef MOUSE_PS2_DRIVER_UART
+ ps2-device = <&uart_ps2>;
+#else
+ ps2-device = <&gpio_ps2>;
+#endif
+};
+
+&input_config {
+ status = "okay";
+};
+
+// Adjust GPIO interrupt priority to the highest level.
+//
+// PS/2 events must be processed within 30-50us, but frequently bluetooth and
+// other interrupts take longer to finish.
+//
+// Therefore we change the default GPIO priority to the highest level (0) and
+// demote all BT interrupt priorities by one level using the kconfig settings:
+// - CONFIG_BT_CTLR_LLL_PRIO 1
+// - CONFIG_BT_CTLR_ULL_HIGH_PRIO 2
+// - CONFIG_BT_CTLR_ULL_LOW_PRIOCONFIG 2
+//
+// These config options are enabled automatically by the PS2 UART and GPIO
+// drivers... so you don't have to enable them manually.
+//
+// Then we lower the interrupt priority of all other devices by 2 levels using
+// the devicetree config below.
+//
+// This allows the PS/2 interrupts to be triggered faster and reduces
+// transmission errors.
+//
+// If you are using the nice_nano_v2 board, you can reuse my config below.
+//
+// Otherwise, you can generate the interrupt overrides using the following
+// script in my zmk fork with the PS/2 mouse driver:
+// app/scripts/gen_interrupt_priority_overrides.py
+//
+// Make sure to do it on a zephyr.dts where the interrupts have not been
+// adjusted yet (i.e. a config that doesn't have the the following options
+// enabled).
+//
+// If you are building using a toolchain you can find the zephyr.dts in the
+// build directory, which by default is: `app/build/zephyr/zephyr.dts`
+//
+// If you are building using the github actions, copy the output of the build
+// step `xxxx_right - nice_nano_v2 Devicetree file` into a file and run the
+// script on it.
+
+// gpiote should have the highest interrupt priority (0)
+&gpiote {
+ interrupts = < 6 0 >;
+};
+
+// All other priorities should be two levels lower than their defaults
+// (which is usually 1 and should be demoted to 3)
+&clock {
+ interrupts = < 0 3 >;
+};
+
+&power {
+ interrupts = < 0 3 >;
+};
+
+&radio {
+ interrupts = < 1 3 >;
+};
+
+&uart0 {
+ interrupts = < 2 3 >;
+};
+
+&i2c0 {
+ interrupts = < 3 3 >;
+};
+
+&spi0 {
+ interrupts = < 3 3 >;
+};
+
+&i2c1 {
+ interrupts = < 4 3 >;
+};
+
+&spi1 {
+ interrupts = < 4 3 >;
+};
+
+&nfct {
+ interrupts = < 5 3 >;
+};
+
+&adc {
+ interrupts = < 7 3 >;
+};
+
+&timer0 {
+ interrupts = < 8 3 >;
+};
+
+&timer1 {
+ interrupts = < 9 3 >;
+};
+
+&timer2 {
+ interrupts = < 10 3 >;
+};
+
+&rtc0 {
+ interrupts = < 11 3 >;
+};
+
+&temp {
+ interrupts = < 12 3 >;
+};
+
+&rng {
+ interrupts = < 13 3 >;
+};
+
+&ecb {
+ interrupts = < 14 3 >;
+};
+
+&ccm {
+ interrupts = < 15 3 >;
+};
+
+&wdt {
+ interrupts = < 16 3 >;
+};
+
+&rtc1 {
+ interrupts = < 17 3 >;
+};
+
+&qdec {
+ interrupts = < 18 3 >;
+};
+
+&comp {
+ interrupts = < 19 3 >;
+};
+
+&egu0 {
+ interrupts = < 20 3 >;
+};
+
+&egu1 {
+ interrupts = < 21 3 >;
+};
+
+&egu2 {
+ interrupts = < 22 3 >;
+};
+
+&egu3 {
+ interrupts = < 23 3 >;
+};
+
+&egu4 {
+ interrupts = < 24 3 >;
+};
+
+&egu5 {
+ interrupts = < 25 3 >;
+};
+
+&timer3 {
+ interrupts = < 26 3 >;
+};
+
+&timer4 {
+ interrupts = < 27 3 >;
+};
+
+&pwm0 {
+ interrupts = < 28 3 >;
+};
+
+&pdm0 {
+ interrupts = < 29 3 >;
+};
+
+&pwm1 {
+ interrupts = < 33 3 >;
+};
+
+&pwm2 {
+ interrupts = < 34 3 >;
+};
+
+&spi2 {
+ interrupts = < 35 3 >;
+};
+
+&rtc2 {
+ interrupts = < 36 3 >;
+};
+
+&i2s0 {
+ interrupts = < 37 3 >;
+};
+
+&usbd {
+ interrupts = < 39 3 >;
+};
+
+&uart1 {
+ interrupts = < 40 3 >;
+};
+
+&qspi {
+ interrupts = < 41 3 >;
+};
+
+&pwm3 {
+ interrupts = < 45 3 >;
+};
+
+&spi3 {
+ interrupts = < 47 3 >;
+};
+
+&cryptocell {
+ interrupts = < 42 3 >;
+};