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

Add LoRA.setSPIFrequency(frequency) API (#5)

This commit is contained in:
Sandeep Mistry 2017-03-12 15:45:21 -04:00
parent 3ebaa410a7
commit ee09672759
4 changed files with 18 additions and 0 deletions

11
API.md
View File

@ -32,6 +32,17 @@ LoRa.setPins(ss, reset, dio0);
This call is optional and only needs to be used if you need to change the default pins used.
### Set SPI Frequency
Override the default SPI frequency of 10 MHz used by the library. **Must** be called before `LoRa.begin()`.
```arduino
LoRa.setSPIFrequency(frequency);
```
* `frequency` - new SPI frequency to use, defaults to `10E6`
This call is optional and only needs to be used if you need to change the default SPI frequency used. Some logic level converters cannot support high speeds such as 10 MHz, so a lower SPI frequency can be selected with `LoRa.setSPIFrequency(frequency)`.
### End
Stop the library

View File

@ -46,6 +46,7 @@ noCrc KEYWORD2
random KEYWORD2
setPins KEYWORD2
setSPIFrequency KEYWORD2
dumpRegisters KEYWORD2
#######################################

View File

@ -413,6 +413,11 @@ void LoRaClass::setPins(int ss, int reset, int dio0)
_dio0 = dio0;
}
void LoRaClass::setSPIFrequency(uint32_t frequency)
{
_spiSettings = SPISettings(frequency, MSBFIRST, SPI_MODE0);
}
void LoRaClass::dumpRegisters(Stream& out)
{
for (int i = 0; i < 128; i++) {

View File

@ -51,6 +51,7 @@ public:
byte random();
void setPins(int ss = LORA_DEFAULT_SS_PIN, int reset = LORA_DEFAULT_RESET_PIN, int dio0 = LORA_DEFAULT_DIO0_PIN);
void setSPIFrequency(uint32_t frequency);
void dumpRegisters(Stream& out);