1
0
mirror of https://github.com/sandeepmistry/arduino-LoRa.git synced 2025-04-20 23:47:47 +03:00

saving reset pin (#60)

* releasing pins ss and reset

* only make reset optional

* style and description

* Update API doc
This commit is contained in:
universam1 2017-12-18 02:16:41 +01:00 committed by Sandeep Mistry
parent 79a33cee83
commit da80e8bf65
2 changed files with 16 additions and 8 deletions

6
API.md
View File

@ -32,6 +32,12 @@ LoRa.setPins(ss, reset, dio0);
This call is optional and only needs to be used if you need to change the default pins used. This call is optional and only needs to be used if you need to change the default pins used.
#### No MCU controlled reset pin
To save further pins one could connect the reset pin of the MCU with reset pin of the radio thus resetting only during startup.
* `reset` - set to `-1` to omit this pin
### Set SPI Frequency ### Set SPI Frequency
Override the default SPI frequency of 10 MHz used by the library. **Must** be called before `LoRa.begin()`. Override the default SPI frequency of 10 MHz used by the library. **Must** be called before `LoRa.begin()`.

View File

@ -66,6 +66,10 @@ int LoRaClass::begin(long frequency)
{ {
// setup pins // setup pins
pinMode(_ss, OUTPUT); pinMode(_ss, OUTPUT);
// set SS high
digitalWrite(_ss, HIGH);
if (_reset != -1) {
pinMode(_reset, OUTPUT); pinMode(_reset, OUTPUT);
// perform reset // perform reset
@ -73,9 +77,7 @@ int LoRaClass::begin(long frequency)
delay(10); delay(10);
digitalWrite(_reset, HIGH); digitalWrite(_reset, HIGH);
delay(10); delay(10);
}
// set SS high
digitalWrite(_ss, HIGH);
// start SPI // start SPI
SPI.begin(); SPI.begin();