This commit is contained in:
Pete Johanson 2023-11-27 18:54:38 +01:00 committed by GitHub
commit 3bece681d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
121 changed files with 678 additions and 197 deletions

View file

@ -1,4 +1,4 @@
FROM docker.io/zmkfirmware/zmk-dev-arm:3.2
FROM docker.io/zmkfirmware/zmk-dev-arm:3.5-branch
COPY .bashrc tmp
RUN mv /tmp/.bashrc ~/.bashrc

View file

@ -17,7 +17,7 @@ jobs:
if: ${{ always() }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.2
image: docker.io/zmkfirmware/zmk-build-arm:3.5-branch
needs: compile-matrix
strategy:
matrix:

View file

@ -18,7 +18,7 @@ jobs:
validate-metadata:
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-dev-arm:3.2
image: docker.io/zmkfirmware/zmk-dev-arm:3.5-branch
steps:
- uses: actions/checkout@v3
- name: Install dependencies

View file

@ -33,7 +33,7 @@ jobs:
test: ${{ fromJSON(needs.collect-tests.outputs.test-dirs) }}
runs-on: ubuntu-latest
container:
image: docker.io/zmkfirmware/zmk-build-arm:3.2
image: docker.io/zmkfirmware/zmk-build-arm:3.5-branch
steps:
- name: Checkout
uses: actions/checkout@v3

View file

@ -17,6 +17,9 @@ project(zmk)
zephyr_linker_sources(RODATA include/linker/zmk-events.ld)
zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/behavior.h)
zephyr_syscall_header(${APPLICATION_SOURCE_DIR}/include/drivers/ext_power.h)
# Add your source file to the "app" target. This must come after
# find_package(Zephyr) which defines the target.
target_include_directories(app PRIVATE include)

View file

@ -131,11 +131,6 @@ if ZMK_BLE
config BT_TINYCRYPT_ECC
default y if BT_HCI && !BT_CTLR
choice BT_LL_SW_LLCP_IMPL
default BT_LL_SW_LLCP_LEGACY
endchoice
config SYSTEM_WORKQUEUE_STACK_SIZE
default 4096 if SOC_RP2040
default 2048
@ -342,13 +337,12 @@ config ZMK_IDLE_TIMEOUT
config ZMK_SLEEP
bool "Enable deep sleep support"
depends on HAS_POWEROFF
select POWEROFF
imply USB
if ZMK_SLEEP
config PM_DEVICE
default y
config ZMK_IDLE_SLEEP_TIMEOUT
int "Milliseconds of inactivity before entering deep sleep"
default 900000

View file

@ -5,9 +5,6 @@ CONFIG_SOC_STM32F303XC=y
# 72MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000
# enable pinmux
CONFIG_PINMUX=y
# enable GPIO
CONFIG_GPIO=y

View file

@ -6,7 +6,7 @@ CONFIG_SOC_STM32F072XB=y
# 48MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
# enable PINMUX
# enable PINCTRL
CONFIG_PINCTRL=y
# enable GPIO

View file

@ -1,6 +1,3 @@
if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

View file

@ -21,9 +21,6 @@ endif # USB
config BT_CTLR
default BT
config PINMUX
default y
choice BOARD_MIKOTO_CHARGER_CURRENT
default BOARD_MIKOTO_CHARGER_CURRENT_100MA
endchoice

View file

@ -11,8 +11,7 @@
#include <zephyr/sys/sys_io.h>
#include <zephyr/devicetree.h>
static int pinmux_mikoto_init(const struct device *port) {
ARG_UNUSED(port);
static int pinmux_mikoto_init(void) {
#if CONFIG_BOARD_MIKOTO_520
const struct device *p0 = DEVICE_DT_GET(DT_NODELABEL(gpio0));

View file

@ -1,6 +1,3 @@
if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

View file

@ -18,9 +18,6 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT
config PINMUX
default y
if BOARD_NRFMICRO_13 || BOARD_NRFMICRO_13_52833
config BOARD_NRFMICRO_CHARGER

View file

@ -5,9 +5,6 @@ CONFIG_SOC_STM32F303XC=y
# 72MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000
# enable pinmux
CONFIG_PINMUX=y
CONFIG_PINCTRL=y
# enable GPIO

View file

@ -1,6 +1,3 @@
if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)

View file

@ -16,7 +16,4 @@ endif # USB_DEVICE_STACK
config BT_CTLR
default BT
config PINMUX
default y
endif # BOARD_PUCHI_BLE_v1

View file

@ -21,9 +21,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -31,7 +28,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -78,6 +78,7 @@ 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
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -55,6 +55,7 @@ RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -22,9 +22,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -32,7 +29,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -94,6 +94,7 @@ 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
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -14,9 +14,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -24,7 +21,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -76,6 +76,7 @@
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -22,9 +22,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -32,7 +29,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -57,5 +57,6 @@
display-offset = <0>;
multiplex-ratio = <63>;
prechargep = <0x22>;
inversion-on;
};
};

View file

@ -34,9 +34,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -44,7 +41,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -87,6 +87,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -85,6 +85,7 @@ RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(3,4) RC(3,5) RC(2,5) RC(2,6) RC(2,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -22,9 +22,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -32,7 +29,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -77,6 +77,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -86,6 +86,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -46,6 +46,7 @@ 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)
display-offset = <0>;
multiplex-ratio = <31>;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -14,9 +14,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -24,7 +21,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -70,6 +70,7 @@
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -14,9 +14,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -24,7 +21,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -70,6 +70,7 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9)
display-offset = <0>;
multiplex-ratio = <31>;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -6,7 +6,7 @@ if SHIELD_NICE_VIEW
config LV_Z_VDB_SIZE
default 100
config LV_Z_DPI
config LV_DPI_DEF
default 161
config LV_Z_BITS_PER_PIXEL
@ -24,6 +24,9 @@ choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice
config LV_Z_MEM_POOL_SIZE
default 4096 if ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
config ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
imply NICE_VIEW_WIDGET_STATUS

View file

@ -149,7 +149,7 @@ static void draw_middle(lv_obj_t *widget, lv_color_t cbuf[], const struct status
for (int i = 0; i < 5; i++) {
bool selected = i == state->active_profile_index;
lv_canvas_draw_arc(canvas, circle_offsets[i][0], circle_offsets[i][1], 13, 0, 359,
lv_canvas_draw_arc(canvas, circle_offsets[i][0], circle_offsets[i][1], 13, 0, 360,
&arc_dsc);
if (selected) {
@ -180,7 +180,7 @@ static void draw_bottom(lv_obj_t *widget, lv_color_t cbuf[], const struct status
// Draw layer
if (state->layer_label == NULL) {
char text[9] = {};
char text[10] = {};
sprintf(text, "LAYER %i", state->layer_index);

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -81,6 +81,7 @@ RC(5,7) RC(5,6) RC(5,5) RC(5,4) RC(5,2) RC(5,0) RC(5,15)
display-offset = <0>;
multiplex-ratio = <31>;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -86,6 +86,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -30,9 +30,6 @@ config SSD1306
config I2C
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -40,7 +37,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -88,6 +88,7 @@ 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
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -28,9 +28,6 @@ config SSD1306
config I2C
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL

View file

@ -74,6 +74,7 @@
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -30,9 +30,6 @@ config SSD1306
config I2C
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -40,7 +37,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -74,6 +74,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,1) RC(4,10) RC(3,6) RC(3,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -28,9 +28,6 @@ config SSD1306
config I2C
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL

View file

@ -74,6 +74,7 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(4,5) RC(4,6) RC(3,6) RC(3,7)
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -30,9 +30,6 @@ config SSD1306
config I2C
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -40,7 +37,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -76,6 +76,7 @@
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -15,9 +15,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -25,7 +22,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -112,6 +112,7 @@
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -22,9 +22,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -32,7 +29,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -106,5 +106,6 @@ RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5)
display-offset = <0>;
multiplex-ratio = <63>;
prechargep = <0x22>;
inversion-on;
};
};

View file

@ -24,9 +24,6 @@ config I2C
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
@ -34,7 +31,7 @@ if LVGL
config LV_Z_VDB_SIZE
default 64
config LV_Z_DPI
config LV_DPI_DEF
default 148
config LV_Z_BITS_PER_PIXEL

View file

@ -84,5 +84,6 @@ RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) R
display-offset = <0>;
multiplex-ratio = <31>;
prechargep = <0x22>;
inversion-on;
};
};

View file

@ -0,0 +1,18 @@
properties:
dr-gpios:
type: phandle-array
description: Data ready pin for the trackpad
rotate-90:
type: boolean
sleep:
type: boolean
no-taps:
type: boolean
sensitivity:
type: string
enum:
- 1x
- 2x
- 3x
- 4x
description: ADC attenuation (sensitivity) setting.

View file

@ -0,0 +1,6 @@
description: |
Sensor driver for the Cirque Pinnacle trackpad ASICs, using the I2C interface
compatible: "cirque,pinnacle"
include: ["i2c-device.yaml", "cirque,pinnacle-common.yaml"]

View file

@ -0,0 +1,6 @@
description: |
Sensor driver for the Cirque Pinnacle trackpad ASICs, using the SPI interface
compatible: "cirque,pinnacle"
include: ["spi-device.yaml", "cirque,pinnacle-common.yaml"]

View file

@ -5,3 +5,4 @@ add_subdirectory_ifdef(CONFIG_GPIO gpio)
add_subdirectory_ifdef(CONFIG_KSCAN kscan)
add_subdirectory_ifdef(CONFIG_SENSOR sensor)
add_subdirectory_ifdef(CONFIG_DISPLAY display)
add_subdirectory_ifdef(CONFIG_INPUT input)

View file

@ -5,3 +5,4 @@ rsource "gpio/Kconfig"
rsource "kscan/Kconfig"
rsource "sensor/Kconfig"
rsource "display/Kconfig"
rsource "input/Kconfig"

View file

@ -0,0 +1,6 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_library_amend()
zephyr_library_sources_ifdef(CONFIG_INPUT_PINNACLE input_pinnacle.c)

View file

@ -0,0 +1,10 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
menuconfig INPUT_PINNACLE
bool "Cirque Pinnacle trackpads"
depends on GPIO
depends on SPI || I2C
depends on INPUT
help
Enable driver for Cirque Pinnacle trackpads

View file

@ -0,0 +1,386 @@
#define DT_DRV_COMPAT cirque_pinnacle
#include <zephyr/init.h>
#include <zephyr/input/input.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <zephyr/logging/log.h>
#include "input_pinnacle.h"
LOG_MODULE_REGISTER(pinnacle, CONFIG_INPUT_LOG_LEVEL);
static int pinnacle_seq_read(const struct device *dev, const uint8_t addr, uint8_t *buf,
const uint8_t len) {
const struct pinnacle_config *config = dev->config;
#if DT_INST_ON_BUS(0, spi)
uint8_t tx_buffer[len + 3], rx_dummy[3];
tx_buffer[0] = PINNACLE_READ | addr;
memset(&tx_buffer[1], PINNACLE_AUTOINC, len + 2);
const struct spi_buf tx_buf[2] = {
{
.buf = tx_buffer,
.len = 3,
},
{
.buf = &tx_buffer[3],
.len = len,
},
};
const struct spi_buf_set tx = {
.buffers = tx_buf,
.count = 2,
};
struct spi_buf rx_buf[2] = {
{
.buf = rx_dummy,
.len = 3,
},
{
.buf = buf,
.len = len,
},
};
const struct spi_buf_set rx = {
.buffers = rx_buf,
.count = 2,
};
int ret = spi_transceive_dt(&config->bus, &tx, &rx);
return ret;
#elif DT_INST_ON_BUS(0, i2c)
return i2c_burst_read_dt(&config->bus, PINNACLE_READ | addr, buf, len);
#endif
}
static int pinnacle_write(const struct device *dev, const uint8_t addr, const uint8_t val) {
const struct pinnacle_config *config = dev->config;
#if DT_INST_ON_BUS(0, spi)
uint8_t tx_buffer[2] = {PINNACLE_WRITE | addr, val};
uint8_t rx_buffer[2];
const struct spi_buf tx_buf = {
.buf = tx_buffer,
.len = 2,
};
const struct spi_buf_set tx = {
.buffers = &tx_buf,
.count = 1,
};
const struct spi_buf rx_buf = {
.buf = rx_buffer,
.len = 2,
};
const struct spi_buf_set rx = {
.buffers = &rx_buf,
.count = 1,
};
const int ret = spi_transceive_dt(&config->bus, &tx, &rx);
if (rx_buffer[1] != PINNACLE_FILLER) {
LOG_ERR("bad ret val %d", rx_buffer[1]);
return -EIO;
}
if (ret < 0) {
LOG_ERR("spi ret: %d", ret);
}
return ret;
#elif DT_INST_ON_BUS(0, i2c)
return i2c_reg_write_byte_dt(&config->bus, PINNACLE_WRITE | addr, val);
#endif
}
static void set_int(const struct device *dev, const bool en) {
const struct pinnacle_config *config = dev->config;
int ret = gpio_pin_interrupt_configure_dt(&config->dr,
en ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE);
if (ret < 0) {
LOG_ERR("can't set interrupt");
}
}
static int pinnacle_clear_status(const struct device *dev) {
int ret = pinnacle_write(dev, PINNACLE_STATUS1, 0);
if (ret < 0) {
LOG_ERR("Failed to clear STATUS1 register: %d", ret);
}
return ret;
}
#if 0
static int pinnacle_era_read(const struct device *dev, const uint16_t addr, uint8_t *val) {
int ret;
set_int(dev, false);
ret = pinnacle_write(dev, PINNACLE_REG_ERA_HIGH_BYTE, (uint8_t)(addr >> 8));
if (ret < 0) {
LOG_ERR("Failed to write ERA high byte (%d)", ret);
return -EIO;
}
ret = pinnacle_write(dev, PINNACLE_REG_ERA_LOW_BYTE, (uint8_t)(addr & 0x00FF));
if (ret < 0) {
LOG_ERR("Failed to write ERA low byte (%d)", ret);
return -EIO;
}
ret = pinnacle_write(dev, PINNACLE_REG_ERA_CONTROL, PINNACLE_ERA_CONTROL_READ);
if (ret < 0) {
LOG_ERR("Failed to write ERA control (%d)", ret);
return -EIO;
}
uint8_t control_val;
do {
ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_CONTROL, &control_val, 1);
if (ret < 0) {
LOG_ERR("Failed to read ERA control (%d)", ret);
return -EIO;
}
} while (control_val != 0x00);
ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_VALUE, val, 1);
if (ret < 0) {
LOG_ERR("Failed to read ERA value (%d)", ret);
return -EIO;
}
ret = pinnacle_clear_status(dev);
set_int(dev, true);
return ret;
}
#endif
static int pinnacle_era_write(const struct device *dev, const uint16_t addr, uint8_t val) {
int ret;
set_int(dev, false);
ret = pinnacle_write(dev, PINNACLE_REG_ERA_VALUE, val);
if (ret < 0) {
LOG_ERR("Failed to write ERA value (%d)", ret);
return -EIO;
}
ret = pinnacle_write(dev, PINNACLE_REG_ERA_HIGH_BYTE, (uint8_t)(addr >> 8));
if (ret < 0) {
LOG_ERR("Failed to write ERA high byte (%d)", ret);
return -EIO;
}
ret = pinnacle_write(dev, PINNACLE_REG_ERA_LOW_BYTE, (uint8_t)(addr & 0x00FF));
if (ret < 0) {
LOG_ERR("Failed to write ERA low byte (%d)", ret);
return -EIO;
}
ret = pinnacle_write(dev, PINNACLE_REG_ERA_CONTROL, PINNACLE_ERA_CONTROL_WRITE);
if (ret < 0) {
LOG_ERR("Failed to write ERA control (%d)", ret);
return -EIO;
}
uint8_t control_val;
do {
ret = pinnacle_seq_read(dev, PINNACLE_REG_ERA_CONTROL, &control_val, 1);
if (ret < 0) {
LOG_ERR("Failed to read ERA control (%d)", ret);
return -EIO;
}
} while (control_val != 0x00);
ret = pinnacle_clear_status(dev);
set_int(dev, true);
return ret;
}
static void pinnacle_report_data(const struct device *dev) {
const struct pinnacle_config *config = dev->config;
uint8_t packet[3];
int ret;
ret = pinnacle_seq_read(dev, PINNACLE_STATUS1, packet, 1);
if (ret < 0) {
LOG_ERR("read status: %d", ret);
return;
}
if (!(packet[0] & PINNACLE_STATUS1_SW_DR)) {
return;
}
ret = pinnacle_seq_read(dev, PINNACLE_2_2_PACKET0, packet, 3);
if (ret < 0) {
LOG_ERR("read packet: %d", ret);
return;
}
struct pinnacle_data *data = dev->data;
uint8_t btn = packet[0] &
(PINNACLE_PACKET0_BTN_PRIM | PINNACLE_PACKET0_BTN_SEC | PINNACLE_PACKET0_BTN_AUX);
int16_t dx = (int16_t)(int8_t)packet[1];
int16_t dy = (int16_t)(int8_t)packet[2];
LOG_DBG("button: %d, dx: %d dy: %d", btn, dx, dy);
if (data->in_int) {
LOG_DBG("Clearing status bit");
ret = pinnacle_clear_status(dev);
data->in_int = true;
}
if (!config->no_taps && (btn || data->btn_cache)) {
for (int i = 0; i < 3; i++) {
uint8_t btn_val = btn & BIT(i);
if (btn_val != (data->btn_cache & BIT(i))) {
input_report_key(dev, INPUT_BTN_0 + i, btn_val ? 1 : 0, false, K_FOREVER);
}
}
}
data->btn_cache = btn;
input_report_rel(dev, INPUT_REL_X, dx, false, K_FOREVER);
input_report_rel(dev, INPUT_REL_Y, dy, true, K_FOREVER);
return;
}
static void pinnacle_work_cb(struct k_work *work) {
struct pinnacle_data *data = CONTAINER_OF(work, struct pinnacle_data, work);
pinnacle_report_data(data->dev);
}
static void pinnacle_gpio_cb(const struct device *port, struct gpio_callback *cb, uint32_t pins) {
struct pinnacle_data *data = CONTAINER_OF(cb, struct pinnacle_data, gpio_cb);
data->in_int = true;
k_work_submit(&data->work);
}
static int pinnacle_adc_sensitivity_reg_value(enum pinnacle_sensitivity sensitivity) {
switch (sensitivity) {
case PINNACLE_SENSITIVITY_1X:
return PINNACLE_TRACKING_ADC_CONFIG_1X;
case PINNACLE_SENSITIVITY_2X:
return PINNACLE_TRACKING_ADC_CONFIG_2X;
case PINNACLE_SENSITIVITY_3X:
return PINNACLE_TRACKING_ADC_CONFIG_3X;
case PINNACLE_SENSITIVITY_4X:
return PINNACLE_TRACKING_ADC_CONFIG_4X;
default:
return PINNACLE_TRACKING_ADC_CONFIG_1X;
}
}
static int pinnacle_init(const struct device *dev) {
struct pinnacle_data *data = dev->data;
const struct pinnacle_config *config = dev->config;
LOG_WRN("pinnacle start");
data->in_int = false;
int ret;
k_msleep(4);
ret = pinnacle_write(dev, PINNACLE_STATUS1, 0); // Clear CC
if (ret < 0) {
LOG_ERR("can't write %d", ret);
return ret;
}
k_usleep(50);
ret = pinnacle_write(dev, PINNACLE_SYS_CFG, PINNACLE_SYS_CFG_RESET);
if (ret < 0) {
LOG_ERR("can't reset %d", ret);
return ret;
}
k_msleep(20);
ret = pinnacle_write(dev, PINNACLE_Z_IDLE, 0x05); // No Z-Idle packets
if (ret < 0) {
LOG_ERR("can't write %d", ret);
return ret;
}
if (config->sleep_en) {
ret = pinnacle_write(dev, PINNACLE_SYS_CFG, PINNACLE_SYS_CFG_EN_SLEEP);
if (ret < 0) {
LOG_ERR("can't write %d", ret);
return ret;
}
}
if (config->sensitivity > PINNACLE_SENSITIVITY_1X) {
ret = pinnacle_era_write(dev, PINNACLE_ERA_REG_TRACKING_ADC_CONFIG,
pinnacle_adc_sensitivity_reg_value(config->sensitivity));
if (ret < 0) {
LOG_ERR("Failed to set ADC sensitivity %d", ret);
return ret;
}
}
uint8_t feed_cfg2 = PINNACLE_FEED_CFG2_EN_IM;
if (config->no_taps) {
feed_cfg2 |= PINNACLE_FEED_CFG2_DIS_TAP;
}
if (config->rotate_90) {
feed_cfg2 |= PINNACLE_FEED_CFG2_ROTATE_90;
}
ret = pinnacle_write(dev, PINNACLE_FEED_CFG2, feed_cfg2);
if (ret < 0) {
LOG_ERR("can't write %d", ret);
return ret;
}
uint8_t feed_cfg1 = PINNACLE_FEED_CFG1_EN_FEED;
if (feed_cfg1) {
ret = pinnacle_write(dev, PINNACLE_FEED_CFG1, feed_cfg1);
}
if (ret < 0) {
LOG_ERR("can't write %d", ret);
return ret;
}
data->dev = dev;
pinnacle_clear_status(dev);
gpio_pin_configure_dt(&config->dr, GPIO_INPUT);
gpio_init_callback(&data->gpio_cb, pinnacle_gpio_cb, BIT(config->dr.pin));
ret = gpio_add_callback(config->dr.port, &data->gpio_cb);
if (ret < 0) {
LOG_ERR("Failed to set DR callback: %d", ret);
return -EIO;
}
k_work_init(&data->work, pinnacle_work_cb);
pinnacle_write(dev, PINNACLE_FEED_CFG1, feed_cfg1);
set_int(dev, true);
return 0;
}
#define PINNACLE_INST(n) \
static struct pinnacle_data pinnacle_data_##n; \
static const struct pinnacle_config pinnacle_config_##n = { \
.bus = COND_CODE_1( \
DT_INST_ON_BUS(0, i2c), (I2C_DT_SPEC_INST_GET(0)), \
(SPI_DT_SPEC_INST_GET(0, \
SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_LINES_SINGLE | \
SPI_TRANSFER_MSB | SPI_MODE_CPHA, \
0))), \
.rotate_90 = DT_INST_PROP(0, rotate_90), \
.sleep_en = DT_INST_PROP(0, sleep), \
.no_taps = DT_INST_PROP(0, no_taps), \
.sensitivity = DT_INST_ENUM_IDX_OR(0, sensitivity, PINNACLE_SENSITIVITY_1X), \
.dr = GPIO_DT_SPEC_GET_OR(DT_DRV_INST(0), dr_gpios, {}), \
}; \
DEVICE_DT_INST_DEFINE(n, pinnacle_init, NULL, &pinnacle_data_##n, &pinnacle_config_##n, \
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, NULL);
DT_INST_FOREACH_STATUS_OKAY(PINNACLE_INST)

View file

@ -0,0 +1,95 @@
#pragma once
#include <zephyr/device.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/i2c.h>
#define PINNACLE_READ 0xA0
#define PINNACLE_WRITE 0x80
#define PINNACLE_AUTOINC 0xFC
#define PINNACLE_FILLER 0xFB
// Registers
#define PINNACLE_FW_ID 0x00 // ASIC ID.
#define PINNACLE_FW_VER 0x01 // Firmware Version Firmware revision number.
#define PINNACLE_STATUS1 0x02 // Contains status flags about the state of Pinnacle.
#define PINNACLE_STATUS1_SW_DR BIT(2)
#define PINNACLE_STATUS1_SW_CC BIT(3)
#define PINNACLE_SYS_CFG 0x03 // Contains system operation and configuration bits.
#define PINNACLE_SYS_CFG_EN_SLEEP BIT(2)
#define PINNACLE_SYS_CFG_SHUTDOWN BIT(1)
#define PINNACLE_SYS_CFG_RESET BIT(0)
#define PINNACLE_FEED_CFG1 0x04 // Contains feed operation and configuration bits.
#define PINNACLE_FEED_CFG1_EN_FEED BIT(0)
#define PINNACLE_FEED_CFG1_ABS_MODE BIT(1)
#define PINNACLE_FEED_CFG1_DIS_FILT BIT(2)
#define PINNACLE_FEED_CFG1_DIS_X BIT(3)
#define PINNACLE_FEED_CFG1_DIS_Y BIT(4)
#define PINNACLE_FEED_CFG1_INV_X BIT(6)
#define PINNACLE_FEED_CFG1_INV_Y BIT(7)
#define PINNACLE_FEED_CFG2 0x05 // Contains feed operation and configuration bits.
#define PINNACLE_FEED_CFG2_EN_IM BIT(0) // Intellimouse
#define PINNACLE_FEED_CFG2_DIS_TAP BIT(1) // Disable all taps
#define PINNACLE_FEED_CFG2_DIS_SEC BIT(2) // Disable secondary tap
#define PINNACLE_FEED_CFG2_DIS_SCRL BIT(3) // Disable scroll
#define PINNACLE_FEED_CFG2_DIS_GE BIT(4) // Disable GlideExtend
#define PINNACLE_FEED_CFG2_ROTATE_90 BIT(7) // Swap X & Y
#define PINNACLE_CAL_CFG 0x07 // Contains calibration configuration bits.
#define PINNACLE_PS2_AUX 0x08 // Contains Data register for PS/2 Aux Control.
#define PINNACLE_SAMPLE 0x09 // Sample Rate Number of samples generated per second.
#define PINNACLE_Z_IDLE 0x0A // Number of Z=0 packets sent when Z goes from >0 to 0.
#define PINNACLE_Z_SCALER 0x0B // Contains the pen Z_On threshold.
#define PINNACLE_SLEEP_INTERVAL 0x0C // Sleep Interval
#define PINNACLE_SLEEP_TIMER 0x0D // Sleep Timer
#define PINNACLE_AG_PACKET0 0x10 // trackpad Data (Pinnacle AG)
#define PINNACLE_2_2_PACKET0 0x12 // trackpad Data
#define PINNACLE_REG_COUNT 0x18
#define PINNACLE_REG_ERA_VALUE 0x1B
#define PINNACLE_REG_ERA_HIGH_BYTE 0x1C
#define PINNACLE_REG_ERA_LOW_BYTE 0x1D
#define PINNACLE_REG_ERA_CONTROL 0x1E
#define PINNACLE_ERA_CONTROL_READ 0x01
#define PINNACLE_ERA_CONTROL_WRITE 0x02
#define PINNACLE_ERA_REG_TRACKING_ADC_CONFIG 0x0187
#define PINNACLE_TRACKING_ADC_CONFIG_1X 0x00
#define PINNACLE_TRACKING_ADC_CONFIG_2X 0x40
#define PINNACLE_TRACKING_ADC_CONFIG_3X 0x80
#define PINNACLE_TRACKING_ADC_CONFIG_4X 0xC0
#define PINNACLE_PACKET0_BTN_PRIM BIT(0) // Primary button
#define PINNACLE_PACKET0_BTN_SEC BIT(1) // Secondary button
#define PINNACLE_PACKET0_BTN_AUX BIT(2) // Auxiliary (middle?) button
#define PINNACLE_PACKET0_X_SIGN BIT(4) // X delta sign
#define PINNACLE_PACKET0_Y_SIGN BIT(5) // Y delta sign
struct pinnacle_data {
uint8_t btn_cache;
bool in_int;
const struct device *dev;
struct gpio_callback gpio_cb;
struct k_work work;
};
enum pinnacle_sensitivity {
PINNACLE_SENSITIVITY_1X,
PINNACLE_SENSITIVITY_2X,
PINNACLE_SENSITIVITY_3X,
PINNACLE_SENSITIVITY_4X,
};
struct pinnacle_config {
#if DT_INST_ON_BUS(0, i2c)
const struct i2c_dt_spec bus;
#elif DT_INST_ON_BUS(0, spi)
const struct spi_dt_spec bus;
#endif
bool rotate_90, sleep_en, no_taps;
enum pinnacle_sensitivity sensitivity;
const struct gpio_dt_spec dr;
};

View file

@ -13,6 +13,14 @@ config ZMK_KSCAN_COMPOSITE_DRIVER
bool
default $(dt_compat_enabled,$(DT_COMPAT_ZMK_KSCAN_COMPOSITE))
if ZMK_KSCAN_COMPOSITE_DRIVER
config ZMK_KSCAN_COMPOSITE_INIT_PRIORITY
int "Init Priority for the composite kscan driver"
default 95
endif
config ZMK_KSCAN_GPIO_DRIVER
bool
select GPIO

View file

@ -109,4 +109,4 @@ static const struct kscan_composite_config kscan_composite_config = {};
static struct kscan_composite_data kscan_composite_data;
DEVICE_DT_INST_DEFINE(0, kscan_composite_init, NULL, &kscan_composite_data, &kscan_composite_config,
POST_KERNEL, CONFIG_KSCAN_INIT_PRIORITY, &mock_driver_api);
POST_KERNEL, CONFIG_ZMK_KSCAN_COMPOSITE_INIT_PRIORITY, &mock_driver_api);

View file

@ -9,6 +9,7 @@
#include <zephyr/device.h>
#include <zephyr/drivers/kscan.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@ -105,7 +106,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
} \
\
static void kscan_gpio_work_handler_##n(struct k_work *work) { \
struct kscan_gpio_data_##n *data = CONTAINER_OF(work, struct kscan_gpio_data_##n, work); \
struct k_work_delayable *d_work = k_work_delayable_from_work(work); \
struct kscan_gpio_data_##n *data = CONTAINER_OF(d_work, struct kscan_gpio_data_##n, work); \
kscan_gpio_read_##n(data->dev); \
} \
\

View file

@ -192,10 +192,10 @@ static int kscan_direct_read(const struct device *dev) {
for (int i = 0; i < data->inputs.len; i++) {
const struct kscan_gpio *gpio = &data->inputs.gpios[i];
struct zmk_debounce_state *state = &data->pin_state[gpio->index];
struct zmk_debounce_state *deb_state = &data->pin_state[gpio->index];
if (zmk_debounce_get_changed(state)) {
const bool pressed = zmk_debounce_is_pressed(state);
if (zmk_debounce_get_changed(deb_state)) {
const bool pressed = zmk_debounce_is_pressed(deb_state);
LOG_DBG("Sending event at 0,%i state %s", gpio->index, pressed ? "on" : "off");
data->callback(dev, 0, gpio->index, pressed);
@ -204,7 +204,7 @@ static int kscan_direct_read(const struct device *dev) {
}
}
continue_scan = continue_scan || zmk_debounce_is_active(state);
continue_scan = continue_scan || zmk_debounce_is_active(deb_state);
}
if (continue_scan) {

View file

@ -290,7 +290,7 @@ static int kscan_matrix_read(const struct device *dev) {
}
static void kscan_matrix_work_handler(struct k_work *work) {
struct k_work_delayable *dwork = CONTAINER_OF(work, struct k_work_delayable, work);
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
struct kscan_matrix_data *data = CONTAINER_OF(dwork, struct kscan_matrix_data, work);
kscan_matrix_read(data->dev);
}

View file

@ -9,6 +9,7 @@
#include <stdlib.h>
#include <zephyr/device.h>
#include <zephyr/drivers/kscan.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
@ -61,7 +62,8 @@ static int kscan_mock_configure(const struct device *dev, kscan_callback_t callb
} \
} \
static void kscan_mock_work_handler_##n(struct k_work *work) { \
struct kscan_mock_data *data = CONTAINER_OF(work, struct kscan_mock_data, work); \
struct k_work_delayable *d_work = k_work_delayable_from_work(work); \
struct kscan_mock_data *data = CONTAINER_OF(d_work, struct kscan_mock_data, work); \
const struct kscan_mock_config_##n *cfg = data->dev->config; \
uint32_t ev = cfg->events[data->event_index]; \
LOG_DBG("ev %u row %d column %d state %d\n", ev, ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), \

View file

@ -4,3 +4,4 @@
add_subdirectory_ifdef(CONFIG_ZMK_BATTERY battery)
add_subdirectory_ifdef(CONFIG_EC11 ec11)
add_subdirectory_ifdef(CONFIG_MAX17048 max17048)
add_subdirectory_ifdef(CONFIG_PINNACLE pinnacle)

View file

@ -5,5 +5,5 @@ zephyr_include_directories(.)
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_MAX17048 max17048.c)
zephyr_library_sources_ifndef(CONFIG_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_MAX17048 max17048.c)
zephyr_library_sources_ifndef(CONFIG_ZMK_MAX17048 ${ZEPHYR_BASE}/misc/empty_file.c)

View file

@ -3,7 +3,7 @@
DT_COMPAT_MAXIM_MAX17048 := maxim,max17048
menuconfig MAX17048
menuconfig ZMK_MAX17048
bool "MAX17048/9 I2C-based Fuel Gauge"
default $(dt_compat_enabled,$(DT_COMPAT_MAXIM_MAX17048))
depends on I2C
@ -12,7 +12,7 @@ menuconfig MAX17048
Enable driver for MAX17048/9 I2C-based Fuel Gauge. Supports measuring
battery voltage and state-of-charge.
if MAX17048
if ZMK_MAX17048
config SENSOR_MAX17048_INIT_PRIORITY
int "Init priority"

View file

@ -0,0 +1 @@
CONFIG_APPLICATION_DEFINED_SYSCALL=y

View file

@ -7,7 +7,7 @@
#include <zephyr/device.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/pm/pm.h>
#include <zephyr/sys/poweroff.h>
#include <zephyr/logging/log.h>
@ -70,7 +70,7 @@ void activity_work_handler(struct k_work *work) {
if (inactive_time > MAX_SLEEP_MS && !is_usb_power_present()) {
// Put devices in suspend power mode before sleeping
set_state(ZMK_ACTIVITY_SLEEP);
pm_state_force(0U, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
sys_poweroff();
} else
#endif /* IS_ENABLED(CONFIG_ZMK_SLEEP) */
if (inactive_time > MAX_IDLE_MS) {
@ -84,7 +84,7 @@ void activity_expiry_function() { k_work_submit(&activity_work); }
K_TIMER_DEFINE(activity_timer, activity_expiry_function, NULL);
int activity_init() {
int activity_init(void) {
activity_last_uptime = k_uptime_get();
k_timer_start(&activity_timer, K_SECONDS(1), K_SECONDS(1));

View file

@ -78,7 +78,7 @@ static void backlight_save_work_handler(struct k_work *work) {
static struct k_work_delayable backlight_save_work;
#endif
static int zmk_backlight_init(const struct device *_arg) {
static int zmk_backlight_init(void) {
if (!device_is_ready(backlight_dev)) {
LOG_ERR("Backlight device \"%s\" is not ready", backlight_dev->name);
return -ENODEV;

View file

@ -84,7 +84,7 @@ static void zmk_battery_timer(struct k_timer *timer) {
K_TIMER_DEFINE(battery_timer, zmk_battery_timer, NULL);
static int zmk_battery_init(const struct device *_arg) {
static int zmk_battery_init(void) {
#if !DT_HAS_CHOSEN(zmk_battery)
battery = device_get_binding("BATTERY");

View file

@ -91,7 +91,7 @@ static const struct behavior_driver_api behavior_backlight_driver_api = {
.locality = BEHAVIOR_LOCALITY_GLOBAL,
};
DEVICE_DT_INST_DEFINE(0, behavior_backlight_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_backlight_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_backlight_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -52,7 +52,7 @@ static const struct behavior_driver_api behavior_bt_driver_api = {
.binding_released = on_keymap_binding_released,
};
DEVICE_DT_INST_DEFINE(0, behavior_bt_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_bt_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_bt_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -182,7 +182,7 @@ static int behavior_caps_word_init(const struct device *dev) {
.continuations_count = DT_INST_PROP_LEN(n, continue_list), \
}; \
DEVICE_DT_INST_DEFINE(n, behavior_caps_word_init, NULL, &behavior_caps_word_data_##n, \
&behavior_caps_word_config_##n, APPLICATION, \
&behavior_caps_word_config_##n, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_caps_word_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KP_INST)

View file

@ -74,7 +74,7 @@ static const struct behavior_driver_api behavior_ext_power_driver_api = {
.locality = BEHAVIOR_LOCALITY_GLOBAL,
};
DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_ext_power_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_APPLICATION_INIT_PRIORITY, &behavior_ext_power_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -678,7 +678,8 @@ ZMK_SUBSCRIPTION(behavior_hold_tap, zmk_position_state_changed);
ZMK_SUBSCRIPTION(behavior_hold_tap, zmk_keycode_state_changed);
void behavior_hold_tap_timer_work_handler(struct k_work *item) {
struct active_hold_tap *hold_tap = CONTAINER_OF(item, struct active_hold_tap, work);
struct k_work_delayable *d_work = k_work_delayable_from_work(item);
struct active_hold_tap *hold_tap = CONTAINER_OF(d_work, struct active_hold_tap, work);
if (hold_tap->work_is_cancelled) {
clear_hold_tap(hold_tap);
@ -716,7 +717,7 @@ static int behavior_hold_tap_init(const struct device *dev) {
.hold_trigger_key_positions_len = DT_INST_PROP_LEN(n, hold_trigger_key_positions), \
}; \
DEVICE_DT_INST_DEFINE(n, behavior_hold_tap_init, NULL, NULL, &behavior_hold_tap_config_##n, \
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&behavior_hold_tap_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KP_INST)

View file

@ -36,7 +36,7 @@ static const struct behavior_driver_api behavior_key_press_driver_api = {
.binding_pressed = on_keymap_binding_pressed, .binding_released = on_keymap_binding_released};
#define KP_INST(n) \
DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, NULL, NULL, NULL, APPLICATION, \
DEVICE_DT_INST_DEFINE(n, behavior_key_press_init, NULL, NULL, NULL, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_press_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KP_INST)

View file

@ -117,7 +117,7 @@ static int behavior_key_repeat_init(const struct device *dev) {
.usage_pages_count = DT_INST_PROP_LEN(n, usage_pages), \
}; \
DEVICE_DT_INST_DEFINE(n, behavior_key_repeat_init, NULL, &behavior_key_repeat_data_##n, \
&behavior_key_repeat_config_##n, APPLICATION, \
&behavior_key_repeat_config_##n, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_repeat_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KR_INST)

View file

@ -38,7 +38,7 @@ static const struct behavior_driver_api behavior_key_toggle_driver_api = {
};
#define KT_INST(n) \
DEVICE_DT_INST_DEFINE(n, behavior_key_toggle_init, NULL, NULL, NULL, APPLICATION, \
DEVICE_DT_INST_DEFINE(n, behavior_key_toggle_init, NULL, NULL, NULL, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_key_toggle_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KT_INST)

View file

@ -225,7 +225,7 @@ static const struct behavior_driver_api behavior_macro_driver_api = {
.count = DT_PROP_LEN(inst, bindings), \
.bindings = TRANSFORMED_BEHAVIORS(inst)}; \
DEVICE_DT_DEFINE(inst, behavior_macro_init, NULL, &behavior_macro_state_##inst, \
&behavior_macro_config_##inst, APPLICATION, \
&behavior_macro_config_##inst, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_macro_driver_api);
DT_FOREACH_STATUS_OKAY(zmk_behavior_macro, MACRO_INST)

View file

@ -98,7 +98,7 @@ static int behavior_mod_morph_init(const struct device *dev) { return 0; }
}; \
static struct behavior_mod_morph_data behavior_mod_morph_data_##n = {}; \
DEVICE_DT_INST_DEFINE(n, behavior_mod_morph_init, NULL, &behavior_mod_morph_data_##n, \
&behavior_mod_morph_config_##n, APPLICATION, \
&behavior_mod_morph_config_##n, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mod_morph_driver_api);
DT_INST_FOREACH_STATUS_OKAY(KP_INST)

View file

@ -40,4 +40,4 @@ static const struct behavior_mo_config behavior_mo_config = {};
static struct behavior_mo_data behavior_mo_data;
DEVICE_DT_INST_DEFINE(0, behavior_mo_init, NULL, &behavior_mo_data, &behavior_mo_config,
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mo_driver_api);
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_mo_driver_api);

View file

@ -33,7 +33,7 @@ static const struct behavior_driver_api behavior_none_driver_api = {
.binding_released = on_keymap_binding_released,
};
DEVICE_DT_INST_DEFINE(0, behavior_none_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_none_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_none_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -42,7 +42,7 @@ static const struct behavior_driver_api behavior_outputs_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
};
DEVICE_DT_INST_DEFINE(0, behavior_out_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_out_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_outputs_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -44,7 +44,7 @@ static const struct behavior_driver_api behavior_reset_driver_api = {
static const struct behavior_reset_config behavior_reset_config_##n = { \
.type = DT_INST_PROP(n, type)}; \
DEVICE_DT_INST_DEFINE(n, behavior_reset_init, NULL, NULL, &behavior_reset_config_##n, \
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&behavior_reset_driver_api);
DT_INST_FOREACH_STATUS_OKAY(RST_INST)

View file

@ -149,7 +149,7 @@ static const struct behavior_driver_api behavior_rgb_underglow_driver_api = {
.locality = BEHAVIOR_LOCALITY_GLOBAL,
};
DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, NULL, NULL, NULL, APPLICATION,
DEVICE_DT_INST_DEFINE(0, behavior_rgb_underglow_init, NULL, NULL, NULL, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_rgb_underglow_driver_api);
#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */

View file

@ -36,7 +36,7 @@ static int behavior_sensor_rotate_init(const struct device *dev) { return 0; };
}; \
static struct behavior_sensor_rotate_data behavior_sensor_rotate_data_##n = {}; \
DEVICE_DT_INST_DEFINE(n, behavior_sensor_rotate_init, NULL, &behavior_sensor_rotate_data_##n, \
&behavior_sensor_rotate_config_##n, APPLICATION, \
&behavior_sensor_rotate_config_##n, POST_KERNEL, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&behavior_sensor_rotate_driver_api);

Some files were not shown because too many files have changed in this diff Show more