Skip to content

Commit b15ad8c

Browse files
committed
Merge branch 'master' into nonblocking
2 parents 12a9112 + b4558aa commit b15ad8c

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

API.md

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ LoRa.setPins(ss, reset, dio0);
3232

3333
This call is optional and only needs to be used if you need to change the default pins used.
3434

35+
#### No MCU controlled reset pin
36+
37+
To save further pins one could connect the reset pin of the MCU with reset pin of the radio thus resetting only during startup.
38+
39+
* `reset` - set to `-1` to omit this pin
40+
3541
### Set SPI Frequency
3642

3743
Override the default SPI frequency of 10 MHz used by the library. **Must** be called before `LoRa.begin()`.

README.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/sandeepmistry/arduino-LoRa.svg?branch=master)](https://travis-ci.org/sandeepmistry/arduino-LoRa)
44

5-
An [Arduino](http://arduino.cc/) library for sending and receiving data using [LoRa](https://www.lora-alliance.org/) radios.
5+
An [Arduino](https://arduino.cc/) library for sending and receiving data using [LoRa](https://www.lora-alliance.org/) radios.
66

77
## Compatible Hardware
88

@@ -27,7 +27,9 @@ An [Arduino](http://arduino.cc/) library for sending and receiving data using [L
2727

2828
`NSS`, `NRESET`, and `DIO0` pins can be changed by using `LoRa.setPins(ss, reset, dio0)`. `DIO0` pin is optional, it is only needed for receive callback mode. If `DIO0` pin is used, it **must** be interrupt capable via [`attachInterrupt(...)`](https://www.arduino.cc/en/Reference/AttachInterrupt).
2929

30-
**NOTE**: Some boards (like the Arduino Nano), cannot supply enough current for the SX127x in TX mode. This will cause lockups when sending, be sure to use an external 3.3V supply that can provide at least 120mA's when using these boards.
30+
**NOTES**:
31+
* Some boards (like the Arduino Nano), cannot supply enough current for the SX127x in TX mode. This will cause lockups when sending, be sure to use an external 3.3V supply that can provide at least 120mA's when using these boards.
32+
* If your Arduino board operates at 5V, like the Arduino Uno, Leonardo or Mega, you will need to use a level converter for the wiring to the Semtech SX127x module. Most Semtech SX127x breakout boards do not have logic level converters built-in.
3133

3234
## Installation
3335

@@ -53,6 +55,34 @@ See [API.md](API.md).
5355

5456
See [examples](examples) folder.
5557

58+
## FAQ
59+
60+
**1) Initilizating the LoRa radio is failing**
61+
62+
Please check the wiring you are using matches what's listed in [Semtech SX1276/77/78/79 wiring](#semtech-sx1276777879-wiring). You can also use `LoRa.setPins(ss, reset, dio0)` to change the default pins used. Some logic level converters cannot operate at 8 MHz, you can call `LoRa.setSPIFrequency(frequency)` to lower the SPI frequency used by the library. Both API's must be called before `LoRa.begin(...)`.
63+
64+
**2) Can other radios see the packets I'm sending?**
65+
66+
Yes, any LoRa radio that are configured with the same radio parameters and in range can see the packets you send.
67+
68+
**3) Is the data I'm sending encrypted?**
69+
70+
No, all data is sent unencrypted. If want your packet data to be encrypted, you must encrypt it before passing it into this library, followed by decrypting on the receiving end.
71+
72+
**4) How does this library differ from LoRaWAN libraries?**
73+
74+
This library exposes the LoRa radio directly, and allows you to send data to any radios in range with same radio parameters. All data is broadcasted and there is no addressing. LoRaWAN builds on top of LoRA, but adds addressing, encryption, and additional layers. It also requires a LoRaWAN gateway and LoRaWAN network and application server.
75+
76+
**5) Does this library honor duty cycles?**
77+
78+
No, you have to manage it by your self.
79+
80+
**6) Which frequencies can I use?**
81+
82+
You can use [this table](https://www.thethingsnetwork.org/wiki/LoRaWAN/Frequencies/By-Country) to lookup the available frequencies by your country. The selectable frequency also depends on your hardware. You can lookup the data sheet or ask your supplier.
83+
84+
Please also notice the frequency dependent duty cycles for legal reasons!
85+
5686
## License
5787

58-
This libary is [licensed](LICENSE) under the [MIT Licence](http://en.wikipedia.org/wiki/MIT_License).
88+
This libary is [licensed](LICENSE) under the [MIT Licence](https://en.wikipedia.org/wiki/MIT_License).

src/LoRa.cpp

+13-9
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ int LoRaClass::begin(long frequency)
6666
{
6767
// setup pins
6868
pinMode(_ss, OUTPUT);
69-
pinMode(_reset, OUTPUT);
70-
71-
// perform reset
72-
digitalWrite(_reset, LOW);
73-
delay(10);
74-
digitalWrite(_reset, HIGH);
75-
delay(10);
76-
7769
// set SS high
7870
digitalWrite(_ss, HIGH);
7971

72+
if (_reset != -1) {
73+
pinMode(_reset, OUTPUT);
74+
75+
// perform reset
76+
digitalWrite(_reset, LOW);
77+
delay(10);
78+
digitalWrite(_reset, HIGH);
79+
delay(10);
80+
}
81+
8082
// start SPI
8183
SPI.begin();
8284

@@ -122,7 +124,7 @@ void LoRaClass::end()
122124

123125
int LoRaClass::beginPacket(int implicitHeader)
124126
{
125-
if (isTransmitting)
127+
if (isTransmitting())
126128
return 0;
127129

128130
// put in standby mode
@@ -297,6 +299,8 @@ void LoRaClass::onReceive(void(*callback)(int))
297299
_onReceive = callback;
298300

299301
if (callback) {
302+
pinMode(_dio0, INPUT);
303+
300304
writeRegister(REG_DIO_MAPPING_1, 0x00);
301305

302306
attachInterrupt(digitalPinToInterrupt(_dio0), LoRaClass::onDio0Rise, RISING);

0 commit comments

Comments
 (0)