Skip to content

Commit

Permalink
Cirque Gen trackpad driver
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Jul 25, 2023
1 parent c48f6c6 commit b63b72c
Show file tree
Hide file tree
Showing 20 changed files with 732 additions and 510 deletions.
2 changes: 1 addition & 1 deletion app/boards/arm/bt60/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on (BOARD_BT60_V1_HS || BOARD_BT60_V1)
depends on BOARD_BT60
6 changes: 1 addition & 5 deletions app/boards/arm/bt60/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Copyright (c) 2021 Polarity Works
# SPDX-License-Identifier: MIT

config BOARD_BT60_V1
config BOARD_BT60
bool "bt60"
depends on SOC_NRF52840_QIAA

config BOARD_BT60_V1_HS
bool "bt60 hotswap"
depends on SOC_NRF52840_QIAA
2 changes: 1 addition & 1 deletion app/boards/arm/bt60/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2021 Polarity Works
# SPDX-License-Identifier: MIT

if BOARD_BT60_V1_HS || BOARD_BT60_V1
if BOARD_BT60

config BOARD
default "bt60"
Expand Down
75 changes: 37 additions & 38 deletions app/boards/arm/bt60/bt60.dtsi → app/boards/arm/bt60/bt60.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,38 @@

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>

#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/matrix_transform.h>

#include "pinctrl.dtsi"

/ {
model = "BT60";
compatible = "polarityworks,bt60";
compatible = "polarityworks,bt60v2";

chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
zephyr,console = &cdc_acm_uart;

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder>;
};

kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "col2row";

col-gpios
= <&gpio0 24 GPIO_ACTIVE_HIGH>
;

left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
row-gpios
= <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};


leds {
compatible = "gpio-leds";
blue_led: led_0 {
Expand All @@ -47,19 +46,13 @@
};
};

vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 806000)>;
};
};

&adc {
status = "okay";
};


&gpiote {
status = "okay";
};
Expand All @@ -72,24 +65,12 @@
status = "okay";
};

&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <17>;
scl-pin = <20>;
};

&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <6>;
rx-pin = <8>;
};

&usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};


Expand Down Expand Up @@ -132,3 +113,21 @@
};
};
};

&i2c1 {
compatible = "nordic,nrf-twim";
/* Cannot be used together with spi1. */
status = "okay";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
clock-frequency = <I2C_BITRATE_FAST>;
trackpad: trackpad@2c {
compatible = "cirque,gen4";
status = "okay";
reg = <0x2C>;
dr-gpios = <&gpio0 17 (GPIO_ACTIVE_LOW)>;
rotate-90;
sleep;
};
};
21 changes: 21 additions & 0 deletions app/boards/arm/bt60/bt60.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>

/ {
keymap {
compatible = "zmk,keymap";

default_layer {
// ------------------------------------------------------------------------------------------
// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | "|" |
// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER |
// | SHIFT | Z | X | C | V | B | N | M | , | . | SHIFT(/) | ^ | DEL |
// | CTL | WIN | ALT | SPACE | ALT | MO(1) | <- | v | -> |
// ------------------------------------------------------------------------------------------
bindings = <
&kp ESC
>;
};
};
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
identifier: bt60_v1
name: BT60 V1 Soldered
identifier: bt60
name: bt60
type: mcu
arch: arm
toolchain:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,36 @@

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BT60_V1=y
CONFIG_BOARD_BT60=y

# Enable MPU
CONFIG_ARM_MPU=y

# enable GPIO
CONFIG_GPIO=y

# encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_PINCTRL=y

CONFIG_ZMK_USB_LOGGING=y

CONFIG_I2C=y
CONFIG_GEN4=y
CONFIG_GEN4_TRIGGER_GLOBAL_THREAD=y


CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=y

CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_LOG_BUFFER_SIZE=38000
CONFIG_USB_CDC_ACM_RINGBUF_SIZE=38000
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000

CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

CONFIG_BUILD_OUTPUT_UF2=y
113 changes: 0 additions & 113 deletions app/boards/arm/bt60/bt60_v1.dts

This file was deleted.

Loading

0 comments on commit b63b72c

Please sign in to comment.