Skip to content

Commit

Permalink
kconfig: add driver for MCP23x17 and test app
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Dec 5, 2021
1 parent 5f7b03c commit e7bc305
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ rsource "ds3231/Kconfig"
rsource "ds3234/Kconfig"
rsource "edbg_eui/Kconfig"
rsource "io1_xplained/Kconfig"
rsource "mcp23x17/Kconfig"
rsource "pcf857x/Kconfig"
rsource "tps6274x/Kconfig"
rsource "uart_half_duplex/Kconfig"
Expand Down
69 changes: 69 additions & 0 deletions drivers/mcp23x17/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) 2021 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#

menuconfig MODULE_MCP23X17
bool "MCP23017/MCP23S17 I/O Expander"
depends on HAS_PERIPH_GPIO
depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO
help
Driver for Microchip Microchip MCP23x17 I/O expanders.
The driver supports the MCP23017 and MC23S17 variants.

if MODULE_MCP23X17

config MODULE_MCP23X17_I2C
bool "MCP23017 with I2C interface is used"
depends on HAS_PERIPH_I2C
select MODULE_PERIPH_I2C

config MODULE_MCP23X17_SPI
bool "MCP23S17 with SPI interface is used"
depends on HAS_PERIPH_SPI
select MODULE_PERIPH_SPI

config MODULE_MCP23X17_IRQ
bool "Interrupt support for MCP23x17 I/O Expander pins"
depends on HAS_PERIPH_GPIO_IRQ
select MODULE_PERIPH_GPIO_IRQ
select MODULE_EVENT
select MODULE_EVENT_THREAD
help
To use the IRQs the MODULE_EVENT_THREAD symbol should be set.

choice
bool "Thread priority"
depends on MODULE_MCP23X17_IRQ
default MODULE_MCP23X17_IRQ_MEDIUM
help
To process IRQs an event thread is used. The MODULE_EVENT_THREAD
symbol should be set. Choose a priority for the thread that
processes the IRQs. The default is medium priority.

config MODULE_MCP23X17_IRQ_MEDIUM
bool "Medium"
select MODULE_EVENT_THREAD_MEDIUM
help
Use event thread with medium priority for interrupt handling.

config MODULE_MCP23X17_IRQ_HIGHEST
bool "Highest"
select MODULE_EVENT_THREAD_HIGHEST
help
Use event thread with highest priority for interrupt handling.

endchoice

config MODULE_MCP23X17_RESET
bool "RESET pin used"
help
If the RESET pin is used, a hardware reset is executed when the
expander device is initialized. The RESET pin of the MCP23x17 I/O
Expanderhas to be connected to a MCU pin that has to be defined
by hardware configuration parameters.

endif # MODULE_MCP23X17
6 changes: 6 additions & 0 deletions tests/driver_mcp23x17/app.config.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this file enables modules defined in Kconfig. Do not use this file for
# application configuration. This is only needed during migration.
CONFIG_MODULE_MCP23X17=y
CONFIG_MODULE_MCP23X17_I2C=y
CONFIG_MODULE_SHELL=y
CONFIG_MODULE_BENCHMARK=y

0 comments on commit e7bc305

Please sign in to comment.