1
0
mirror of https://github.com/sandeepmistry/arduino-LoRa.git synced 2025-04-25 09:22:31 +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.
#### 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
Override the default SPI frequency of 10 MHz used by the library. **Must** be called before `LoRa.begin()`.

View File

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