Skip to content

Commit

Permalink
Fix #502: add os_radio(RADIO_TX_AT), version is 3.0.99.8
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Dec 24, 2019
1 parent dfac7d7 commit 9097013
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
10 changes: 8 additions & 2 deletions doc/RadioDriver.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ The radio is placed in continuous receive mode. If a frame is received, `LMIC.os

This operation is not supported in FSK mode.

### `os_radio(RADIO_TX_AT)`

This is like `os_radio(RADIO_TX)`, but the transmission is scheduled at `LMIC.txend`.

## Common parameters

### `LMIC.rps` (IN)
Expand Down Expand Up @@ -109,9 +113,11 @@ The array of data to be sent.

The length of the array to be sent.

### `LMIC.txend` (OUT)
### `LMIC.txend` (IN, OUT)

For `RADIO_TX_AT`, an input parameter, for the scheduled TX time.

The OS time at which the TX end interrupt was recognized.
For all transmissions, updated to the OS time at which the TX end interrupt was recognized.

## Receive parameters

Expand Down
4 changes: 2 additions & 2 deletions src/lmic/lmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extern "C"{
#define ARDUINO_LMIC_VERSION_CALC(major, minor, patch, local) \
(((major) << 24ul) | ((minor) << 16ul) | ((patch) << 8ul) | ((local) << 0ul))

#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 0, 99, 7) /* v3.0.99.7 */
#define ARDUINO_LMIC_VERSION ARDUINO_LMIC_VERSION_CALC(3, 0, 99, 8) /* v3.0.99.8 */

#define ARDUINO_LMIC_VERSION_GET_MAJOR(v) \
(((v) >> 24u) & 0xFFu)
Expand Down Expand Up @@ -219,7 +219,7 @@ struct bcninfo_t {
#endif // !DISABLE_BEACONS

// purpose of receive window - lmic_t.rxState
enum { RADIO_RST=0, RADIO_TX=1, RADIO_RX=2, RADIO_RXON=3 };
enum { RADIO_RST=0, RADIO_TX=1, RADIO_RX=2, RADIO_RXON=3, RADIO_TX_AT=4, };
// Netid values / lmic_t.netid
enum { NETID_NONE=(int)~0U, NETID_MASK=(int)0xFFFFFF };
// MAC operation modes (lmic_t.opmode).
Expand Down
11 changes: 11 additions & 0 deletions src/lmic/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,8 @@ static void txfsk () {
hal_pin_rxtx(1);

// now we actually start the transmission
if (LMIC.txend)
hal_waitUntil(LMIC.txend); // busy wait until exact rx time
LMICOS_logEventUint32("+Tx FSK", LMIC.dataLen);
opmode(OPMODE_TX);
}
Expand Down Expand Up @@ -826,6 +828,8 @@ static void txlora () {
hal_pin_rxtx(1);

// now we actually start the transmission
if (LMIC.txend)
hal_waitUntil(LMIC.txend); // busy wait until exact rx time
LMICOS_logEventUint32("+Tx LoRa", LMIC.dataLen);
opmode(OPMODE_TX);

Expand Down Expand Up @@ -1350,9 +1354,16 @@ void os_radio (u1_t mode) {

case RADIO_TX:
// transmit frame now
LMIC.txend = 0;
starttx(); // buf=LMIC.frame, len=LMIC.dataLen
break;

case RADIO_TX_AT:
if (LMIC.txend == 0)
LMIC.txend = 1;
starttx();
break;

case RADIO_RX:
// receive frame now (exactly at rxtime)
startrx(RXMODE_SINGLE); // buf=LMIC.frame, time=LMIC.rxtime, timeout=LMIC.rxsyms
Expand Down

0 comments on commit 9097013

Please sign in to comment.