Basic MAC data interface for LoRa transceiver
Dependents: LoRaBaseStation LoRaTerminal
Diff: AlohaTransceiver.cpp
- Revision:
- 36:09c105fe77c0
- Parent:
- 35:4cfad781d98b
- Child:
- 37:9e895f3ffd41
--- a/AlohaTransceiver.cpp Sat Sep 03 05:45:39 2016 +0000 +++ b/AlohaTransceiver.cpp Sun Sep 04 03:18:17 2016 +0000 @@ -12,6 +12,7 @@ #define TOGGLE_FLAG(t, x) (t) ^= 1 << (x) #define CHECK_FLAG(t, x) (t) >> (x) & 1 + // declear the type of radio state typedef enum { @@ -58,10 +59,10 @@ #endif + /* * Abstract interface for accessing radio driver */ - AlohaTransceiver::AlohaTransceiver(uint8_t id): AlohaTxQueue(32) { @@ -77,6 +78,7 @@ // assume all station is clear to transmit isAcked = 0xffff; + // configure properties #if USE_MODEM_LORA == 1 Settings.Power = TX_OUTPUT_POWER; @@ -199,7 +201,7 @@ uint8_t foreign_seqid = frame->getSequenceID(); // compare the local sequence id and foreign sequence id for specific host - if (seqid[src_addr] == foreign_seqid) + if (seqid[src_addr] <= foreign_seqid) { setAckedFlag(src_addr); } @@ -283,8 +285,11 @@ uint8_t dest_addr = frame->getDestinationAddress(); // depending on the availability of the destination host, - // the radio will on transmit the packet when acked - if (getAckedFlag(dest_addr)) + // the radio will on transmit the packet when acked. + // + // in the test build, we are not going to enable this feature + // if (getAckedFlag(dest_addr)) + if (true) { sendFrame(frame); @@ -589,3 +594,4 @@ #endif } +