1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 23:12:45 +01:00

Merge pull request #11132 from MichelRottleuthner/pr_sx127x_add_gpio_pull_config

drivers/sx127x: add gpio pull config define for DIO pins
This commit is contained in:
Leandro Lanzieri 2019-03-14 14:05:56 +01:00 committed by GitHub
commit 94a10e9e10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -95,6 +95,9 @@ extern "C" {
#ifdef SX127X_USE_DIO_MULTI #ifdef SX127X_USE_DIO_MULTI
#define SX127X_IRQ_DIO_MULTI (1<<6) /**< DIO MULTI IRQ */ #define SX127X_IRQ_DIO_MULTI (1<<6) /**< DIO MULTI IRQ */
#endif #endif
#ifndef SX127X_DIO_PULL_MODE
#define SX127X_DIO_PULL_MODE (GPIO_IN_PD) /**< pull down DIOx */
#endif
/** @} */ /** @} */
/** /**

View File

@ -234,8 +234,8 @@ static int _init_gpios(sx127x_t *dev)
#ifndef SX127X_USE_DIO_MULTI #ifndef SX127X_USE_DIO_MULTI
/* Check if DIO0 pin is defined */ /* Check if DIO0 pin is defined */
if (dev->params.dio0_pin != GPIO_UNDEF) { if (dev->params.dio0_pin != GPIO_UNDEF) {
res = gpio_init_int(dev->params.dio0_pin, GPIO_IN, GPIO_RISING, res = gpio_init_int(dev->params.dio0_pin, SX127X_DIO_PULL_MODE,
sx127x_on_dio0_isr, dev); GPIO_RISING, sx127x_on_dio0_isr, dev);
if (res < 0) { if (res < 0) {
DEBUG("[sx127x] error: failed to initialize DIO0 pin\n"); DEBUG("[sx127x] error: failed to initialize DIO0 pin\n");
return res; return res;
@ -249,8 +249,8 @@ static int _init_gpios(sx127x_t *dev)
/* Check if DIO1 pin is defined */ /* Check if DIO1 pin is defined */
if (dev->params.dio1_pin != GPIO_UNDEF) { if (dev->params.dio1_pin != GPIO_UNDEF) {
res = gpio_init_int(dev->params.dio1_pin, GPIO_IN, GPIO_RISING, res = gpio_init_int(dev->params.dio1_pin, SX127X_DIO_PULL_MODE,
sx127x_on_dio1_isr, dev); GPIO_RISING, sx127x_on_dio1_isr, dev);
if (res < 0) { if (res < 0) {
DEBUG("[sx127x] error: failed to initialize DIO1 pin\n"); DEBUG("[sx127x] error: failed to initialize DIO1 pin\n");
return res; return res;
@ -259,8 +259,8 @@ static int _init_gpios(sx127x_t *dev)
/* check if DIO2 pin is defined */ /* check if DIO2 pin is defined */
if (dev->params.dio2_pin != GPIO_UNDEF) { if (dev->params.dio2_pin != GPIO_UNDEF) {
res = gpio_init_int(dev->params.dio2_pin, GPIO_IN, GPIO_RISING, res = gpio_init_int(dev->params.dio2_pin, SX127X_DIO_PULL_MODE,
sx127x_on_dio2_isr, dev); GPIO_RISING, sx127x_on_dio2_isr, dev);
if (res < 0) { if (res < 0) {
DEBUG("[sx127x] error: failed to initialize DIO2 pin\n"); DEBUG("[sx127x] error: failed to initialize DIO2 pin\n");
return res; return res;
@ -269,8 +269,8 @@ static int _init_gpios(sx127x_t *dev)
/* check if DIO3 pin is defined */ /* check if DIO3 pin is defined */
if (dev->params.dio3_pin != GPIO_UNDEF) { if (dev->params.dio3_pin != GPIO_UNDEF) {
res = gpio_init_int(dev->params.dio3_pin, GPIO_IN, GPIO_RISING, res = gpio_init_int(dev->params.dio3_pin, SX127X_DIO_PULL_MODE,
sx127x_on_dio3_isr, dev); GPIO_RISING, sx127x_on_dio3_isr, dev);
if (res < 0) { if (res < 0) {
DEBUG("[sx127x] error: failed to initialize DIO3 pin\n"); DEBUG("[sx127x] error: failed to initialize DIO3 pin\n");
return res; return res;
@ -279,8 +279,8 @@ static int _init_gpios(sx127x_t *dev)
#else #else
if (dev->params.dio_multi_pin != GPIO_UNDEF) { if (dev->params.dio_multi_pin != GPIO_UNDEF) {
DEBUG("[sx127x] info: Trying to initialize DIO MULTI pin\n"); DEBUG("[sx127x] info: Trying to initialize DIO MULTI pin\n");
res = gpio_init_int(dev->params.dio_multi_pin, GPIO_IN, GPIO_RISING, res = gpio_init_int(dev->params.dio_multi_pin, SX127X_DIO_PULL_MODE,
sx127x_on_dio_multi_isr, dev); GPIO_RISING, sx127x_on_dio_multi_isr, dev);
if (res < 0) { if (res < 0) {
DEBUG("[sx127x] error: failed to initialize DIO MULTI pin\n"); DEBUG("[sx127x] error: failed to initialize DIO MULTI pin\n");
return res; return res;