refactor: Align drivers with Zephyr file system conventions

PR: #400
This commit is contained in:
innovaker 2020-11-19 17:20:43 +00:00 committed by Pete Johanson
parent 177b28f01d
commit 8d9ae1fdf3
24 changed files with 79 additions and 46 deletions

View file

@ -0,0 +1,5 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
add_subdirectory_ifdef(CONFIG_KSCAN kscan)
add_subdirectory_ifdef(CONFIG_SENSOR sensor)

5
app/drivers/Kconfig Normal file
View file

@ -0,0 +1,5 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
rsource "kscan/Kconfig"
rsource "sensor/Kconfig"

View file

@ -0,0 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_matrix.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_direct.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_KSCAN_GPIO_DRIVER kscan_gpio_demux.c)

25
app/drivers/kscan/Kconfig Normal file
View file

@ -0,0 +1,25 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config ZMK_KSCAN_GPIO_DRIVER
bool "Enable GPIO kscan driver to simulate key presses"
default y
select GPIO
if ZMK_KSCAN_GPIO_DRIVER
config ZMK_KSCAN_MATRIX_POLLING
bool "Poll for key event triggers instead of using interrupts on matrix boards."
default n
config ZMK_KSCAN_DIRECT_POLLING
bool "Poll for key event triggers instead of using interrupts on direct wired boards."
default n
endif
config ZMK_KSCAN_INIT_PRIORITY
int "Keyboard scan driver init priority"
default 40
help
Keyboard scan device driver initialization priority.

View file

@ -0,0 +1,5 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
add_subdirectory_ifdef(CONFIG_ZMK_BATTERY_VOLTAGE_DIVIDER battery_voltage_divider)
add_subdirectory_ifdef(CONFIG_EC11 ec11)

View file

@ -0,0 +1,5 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
rsource "battery_voltage_divider/Kconfig"
rsource "ec11/Kconfig"

View file

@ -0,0 +1,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_library()
zephyr_library_sources(battery_voltage_divider.c)

View file

@ -0,0 +1,8 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config ZMK_BATTERY_VOLTAGE_DIVIDER
bool "ZMK battery voltage divider"
select ADC
help
Enable ZMK battery voltage divider driver for battery monitoring.

View file

@ -0,0 +1,9 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
zephyr_include_directories(.)
zephyr_library()
zephyr_library_sources(ec11.c)
zephyr_library_sources_ifdef(CONFIG_EC11_TRIGGER ec11_trigger.c)

View file

@ -1,35 +1,6 @@
# Copyright (c) 2020 The ZMK Contributors # Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
config ZMK_KSCAN_GPIO_DRIVER
bool "Enable GPIO kscan driver to simulate key presses"
default y
select GPIO
if ZMK_KSCAN_GPIO_DRIVER
config ZMK_KSCAN_MATRIX_POLLING
bool "Poll for key event triggers instead of using interrupts on matrix boards."
default n
config ZMK_KSCAN_DIRECT_POLLING
bool "Poll for key event triggers instead of using interrupts on direct wired boards."
default n
endif
config ZMK_KSCAN_INIT_PRIORITY
int "Keyboard scan driver init priority"
default 40
help
Keyboard scan device driver initialization priority.
config ZMK_BATTERY_VOLTAGE_DIVIDER
bool "ZMK battery voltage divider"
select ADC
help
Enable ZMK battery voltage divider driver for battery monitoring.
menuconfig EC11 menuconfig EC11
bool "EC11 Incremental Encoder Sensor" bool "EC11 Incremental Encoder Sensor"
depends on GPIO depends on GPIO
@ -76,4 +47,4 @@ config EC11_THREAD_STACK_SIZE
help help
Stack size of thread used by the driver to handle interrupts. Stack size of thread used by the driver to handle interrupts.
endif # EC11 endif # EC11

View file

@ -1,14 +0,0 @@
if(CONFIG_ZMK_KSCAN_GPIO_DRIVER)
zephyr_include_directories(.)
zephyr_library()
zephyr_library_sources(
kscan_gpio_matrix.c
kscan_gpio_direct.c
kscan_gpio_demux.c
)
zephyr_library_sources_ifdef(CONFIG_EC11 ec11.c)
zephyr_library_sources_ifdef(CONFIG_EC11_TRIGGER ec11_trigger.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_BATTERY_VOLTAGE_DIVIDER battery_voltage_divider.c)
endif()

View file

@ -1,3 +1,3 @@
build: build:
cmake: zephyr cmake: .
kconfig: zephyr/Kconfig kconfig: Kconfig