You've already forked arduino-LoRa
mirror of
https://github.com/sandeepmistry/arduino-LoRa.git
synced 2025-07-10 22:00:57 +03:00
Add support for Arduino MKR WAN 1300 boards (#105)
* Add support for Arduino MKR WAN 1300 board * Add new LoRa.setSPI(...) API to use radio with a different SPI interface * Disable LoRa.onReceive(...) and LoRa.receive() on Arduino MKR WAN 1300 * Add errors on sketches not compatible with the Arduino MKR WAN 1300
This commit is contained in:
24
src/LoRa.h
24
src/LoRa.h
@ -7,12 +7,22 @@
|
||||
#include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#define LORA_DEFAULT_SS_PIN 10
|
||||
#define LORA_DEFAULT_RESET_PIN 9
|
||||
#define LORA_DEFAULT_DIO0_PIN 2
|
||||
#ifdef ARDUINO_SAMD_MKRWAN1300
|
||||
#define LORA_DEFAULT_SPI SPI1
|
||||
#define LORA_DEFAULT_SPI_FREQUENCY 250000
|
||||
#define LORA_DEFAULT_SS_PIN LORA_IRQ_DUMB
|
||||
#define LORA_DEFAULT_RESET_PIN -1
|
||||
#define LORA_DEFAULT_DIO0_PIN -1
|
||||
#else
|
||||
#define LORA_DEFAULT_SPI SPI
|
||||
#define LORA_DEFAULT_SPI_FREQUENCY 8E6
|
||||
#define LORA_DEFAULT_SS_PIN 10
|
||||
#define LORA_DEFAULT_RESET_PIN 9
|
||||
#define LORA_DEFAULT_DIO0_PIN 2
|
||||
#endif
|
||||
|
||||
#define PA_OUTPUT_RFO_PIN 0
|
||||
#define PA_OUTPUT_PA_BOOST_PIN 1
|
||||
#define PA_OUTPUT_RFO_PIN 0
|
||||
#define PA_OUTPUT_PA_BOOST_PIN 1
|
||||
|
||||
class LoRaClass : public Stream {
|
||||
public:
|
||||
@ -39,9 +49,11 @@ public:
|
||||
virtual int peek();
|
||||
virtual void flush();
|
||||
|
||||
#ifndef ARDUINO_SAMD_MKRWAN1300
|
||||
void onReceive(void(*callback)(int));
|
||||
|
||||
void receive(int size = 0);
|
||||
#endif
|
||||
void idle();
|
||||
void sleep();
|
||||
|
||||
@ -62,6 +74,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 setSPI(SPIClass& spi);
|
||||
void setSPIFrequency(uint32_t frequency);
|
||||
|
||||
void dumpRegisters(Stream& out);
|
||||
@ -85,6 +98,7 @@ private:
|
||||
|
||||
private:
|
||||
SPISettings _spiSettings;
|
||||
SPIClass* _spi;
|
||||
int _ss;
|
||||
int _reset;
|
||||
int _dio0;
|
||||
|
Reference in New Issue
Block a user