From 91f78b7e5ac848d8676d27e29928b35a314efc93 Mon Sep 17 00:00:00 2001 From: Nicolaivr Date: Tue, 5 Sep 2017 09:31:04 +0200 Subject: [PATCH] Nice rf v1.0 (#1) * RX_en and TX_en pin definition for NiceRF v1 Added RX_en and TX_en pin definitions for a NiceRF v1 module. * Add RX_en and TX_en pin function NiceRF v1.0 Set/Unset RX_en and TX_en outputs for the use of NiceRF v1.0 module with manual antenna switch. --- src/hal/hal.cpp | 12 ++++++++---- src/hal/hal.h | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/hal/hal.cpp b/src/hal/hal.cpp index 53bf359d..d6b045d9 100644 --- a/src/hal/hal.cpp +++ b/src/hal/hal.cpp @@ -24,8 +24,10 @@ static void hal_io_init () { ASSERT(lmic_pins.dio[1] != LMIC_UNUSED_PIN || lmic_pins.dio[2] != LMIC_UNUSED_PIN); pinMode(lmic_pins.nss, OUTPUT); - if (lmic_pins.rxtx != LMIC_UNUSED_PIN) - pinMode(lmic_pins.rxtx, OUTPUT); + if (lmic_pins.rxtx[0] != LMIC_UNUSED_PIN) + pinMode(lmic_pins.rxtx[0], OUTPUT); + if (lmic_pins.rxtx[1] != LMIC_UNUSED_PIN) + pinMode(lmic_pins.rxtx[1], OUTPUT); if (lmic_pins.rst != LMIC_UNUSED_PIN) pinMode(lmic_pins.rst, OUTPUT); @@ -38,8 +40,10 @@ static void hal_io_init () { // val == 1 => tx 1 void hal_pin_rxtx (u1_t val) { - if (lmic_pins.rxtx != LMIC_UNUSED_PIN) - digitalWrite(lmic_pins.rxtx, val); + if (lmic_pins.rxtx[0] != LMIC_UNUSED_PIN) + digitalWrite(lmic_pins.rxtx[0], val); + if (lmic_pins.rxtx[1] != LMIC_UNUSED_PIN) + digitalWrite(lmic_pins.rxtx[1], !val); } // set radio RST pin to given value (or keep floating!) diff --git a/src/hal/hal.h b/src/hal/hal.h index e096569f..c4d66de0 100644 --- a/src/hal/hal.h +++ b/src/hal/hal.h @@ -11,10 +11,11 @@ #define _hal_hal_h_ static const int NUM_DIO = 3; +static const int NUM_RXTX = 2; struct lmic_pinmap { u1_t nss; - u1_t rxtx; + u1_t rxtx[NUM_RXTX]; u1_t rst; u1_t dio[NUM_DIO]; };