Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NiceRF v1.0 module support (separate TX_en / RX_en pins ) #117

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/hal/hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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!)
Expand Down
3 changes: 2 additions & 1 deletion src/hal/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};
Expand Down