-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add PCF957X driver test application
- Loading branch information
Showing
4 changed files
with
517 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
include ../Makefile.tests_common | ||
|
||
ifeq (,$(filter pcf857%,$(USEMODULE))) | ||
# default expander module | ||
USEMODULE += pcf8575 | ||
endif | ||
|
||
USEMODULE += shell | ||
USEMODULE += benchmark | ||
|
||
include $(RIOTBASE)/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Texas Instruments PCF857X I2C I/O expanders test application | ||
|
||
## Overview | ||
|
||
This test appliation demonstrates the usage of the PCF857X driver interface | ||
and can be used to test each PCF857X expander I/O pin with shell commands. | ||
|
||
The application bases on the test application for GPIO peripheral drivers | ||
which is under following copyright: | ||
|
||
Copyright (C) 2014,2017 Freie Universität Berlin | ||
@author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
|
||
## Usage | ||
|
||
To use the test application, compile it with one or more of the pseudomodules | ||
`pcf8574`, `pcf8574a` or `pcf8575` to enable the driver for your | ||
expander modules. Please check the default configuration parameters in | ||
`$(RIOTBASE)/drivers/pcf857x/include/pcf857x_params.h` and adopt them | ||
if necessary. | ||
|
||
USEMODULE=pcf8575 make -C tests/driver_pcf857x BOARD=... | ||
|
||
**Please note:** When no pseudomodule is given, `pcf8575` is used by default. | ||
|
||
The usage of the PCF857X low-active open-drain interrupt signal is | ||
recommended to be able to use external interrupts with the expander I/O | ||
pins. Add module `periph_gpio_irq` for this purpose and define the | ||
MCU interrupt pin by parameter `PCF857X_PARAM_INT_PIN`, e.g. | ||
|
||
CFLAGS="-DPCF857X_PARAM_INT_PIN=\(GPIO\(0,6\)\)" \ | ||
USEMODULE="pcf8575 periph_gpio_irq" make -C tests/driver_pcf857x BOARD=... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2018 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. | ||
*/ | ||
|
||
/** | ||
* @ingroup tests | ||
* @brief GPIO extension for Texas Instruments PCF857X I2C I/O expanders | ||
* @author Gunar Schorcht <gunar@schorcht.net> | ||
* @file | ||
*/ | ||
|
||
#ifndef GPIO_EXT_CONF_H | ||
#define GPIO_EXT_CONF_H | ||
|
||
#if MODULE_EXTEND_GPIO | ||
|
||
#include <stddef.h> | ||
|
||
#include "extend/gpio.h" | ||
#include "pcf857x_params.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Reference to PCF857X device driver struct | ||
*/ | ||
extern const gpio_ext_driver_t pcf857x_extend_gpio_driver; | ||
/** @} */ | ||
|
||
/** | ||
* @brief References to the PCF857X devices | ||
*/ | ||
extern pcf857x_t pcf857x_dev[]; | ||
|
||
/** | ||
* @brief GPIO extension list of PCF857X expanders | ||
*/ | ||
static const gpio_ext_t gpio_ext_list[] = | ||
{ | ||
{ | ||
.driver = &pcf857x_extend_gpio_driver, | ||
.dev = (void *)&pcf857x_dev[0], | ||
}, | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* MODULE_EXTEND_GPIO */ | ||
|
||
#endif /* GPIO_EXT_CONF_H */ | ||
/** @} */ |
Oops, something went wrong.