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:
parent
79a33cee83
commit
da80e8bf65
6
API.md
6
API.md
@ -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()`.
|
||||
|
18
src/LoRa.cpp
18
src/LoRa.cpp
@ -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();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user