Update Radiolib version to 7.1.0
This commit is contained in:
+1
-1
@@ -54,7 +54,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build example
|
- name: Build example
|
||||||
run:
|
run:
|
||||||
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX126x/SX126x_Transmit_Blocking/SX126x_Transmit_Blocking.ino --warnings=all
|
arduino-cli compile --libraries /home/runner/work/RadioLib --fqbn arduino:avr:uno $PWD/examples/SX123x/SX123x_Transmit_Blocking/SX123x_Transmit_Blocking.ino --warnings=all
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v3
|
uses: github/codeql-action/analyze@v3
|
||||||
|
|||||||
+5
-11
@@ -10,12 +10,11 @@ on:
|
|||||||
id:
|
id:
|
||||||
description: The ID of the platform on which the build is run
|
description: The ID of the platform on which the build is run
|
||||||
required: true
|
required: true
|
||||||
default: arduino:avr:uno
|
default: arduino:avr:mega
|
||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- all
|
- all
|
||||||
- none
|
- none
|
||||||
- arduino:avr:uno
|
|
||||||
- arduino:avr:mega
|
- arduino:avr:mega
|
||||||
- arduino:mbed:nano33ble
|
- arduino:mbed:nano33ble
|
||||||
- arduino:mbed:envie_m4
|
- arduino:mbed:envie_m4
|
||||||
@@ -27,7 +26,6 @@ on:
|
|||||||
- esp32:esp32:esp32
|
- esp32:esp32:esp32
|
||||||
- esp8266:esp8266:generic
|
- esp8266:esp8266:generic
|
||||||
- Intel:arc32:arduino_101
|
- Intel:arc32:arduino_101
|
||||||
- SparkFun:apollo3:sfe_artemis
|
|
||||||
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
- STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
||||||
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
|
- STMicroelectronics:stm32:Nucleo_64:pnum=NUCLEO_WL55JC1
|
||||||
- stm32duino:STM32F1:mapleMini
|
- stm32duino:STM32F1:mapleMini
|
||||||
@@ -45,8 +43,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
|
# platform-dependent settings - extra board options, board index URLs, skip patterns etc.
|
||||||
include:
|
include:
|
||||||
- id: arduino:avr:uno
|
|
||||||
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN|LR11x0_Firmware_Update|Pager|APRS|Morse)" >> $GITHUB_OUTPUT
|
|
||||||
- id: arduino:avr:mega
|
- id: arduino:avr:mega
|
||||||
run: |
|
run: |
|
||||||
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
|
echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
|
||||||
@@ -86,11 +82,6 @@ jobs:
|
|||||||
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
echo "skip-pattern=(STM32WL|LR11x0_Firmware_Update)" >> $GITHUB_OUTPUT
|
||||||
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
|
echo "options=':xtal=80,ResetMethod=ck,CrystalFreq=26,FlashFreq=40,FlashMode=qio,eesz=512K'" >> $GITHUB_OUTPUT
|
||||||
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
|
echo "index-url=--additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json" >> $GITHUB_OUTPUT
|
||||||
- id: SparkFun:apollo3:sfe_artemis
|
|
||||||
run: |
|
|
||||||
echo "skip-pattern=(STM32WL|LoRaWAN)" >> $GITHUB_OUTPUT
|
|
||||||
echo "warnings='none'" >> $GITHUB_OUTPUT
|
|
||||||
echo "index-url=--additional-urls https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json" >> $GITHUB_OUTPUT
|
|
||||||
- id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
- id: STMicroelectronics:stm32:GenF3:pnum=BLACKPILL_F303CC
|
||||||
run: |
|
run: |
|
||||||
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
echo "index-url=--additional-urls https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/main/package_stmicroelectronics_index.json" >> $GITHUB_OUTPUT
|
||||||
@@ -131,9 +122,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: ${{ matrix.id }}
|
name: ${{ matrix.id }}
|
||||||
env:
|
env:
|
||||||
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:uno') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
|
run-build: ${{ (inputs.id != 'none' && matrix.id == 'arduino:avr:mega') || contains(github.event.head_commit.message, 'CI_BUILD_ALL') || contains(github.event.head_commit.message, 'Bump version to') || contains(github.event.head_commit.message, format('{0}', matrix.id)) || inputs.id == 'all' || inputs.id == matrix.id }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Free Disk Space (Ubuntu)
|
||||||
|
uses: jlumbroso/free-disk-space@v1.3.1
|
||||||
|
|
||||||
- name: Install arduino-cli
|
- name: Install arduino-cli
|
||||||
if: ${{ env.run-build == 'true' }}
|
if: ${{ env.run-build == 'true' }}
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ SX127x, RFM9x, SX126x, LR11x0 and SX128x
|
|||||||
### Supported Arduino platforms:
|
### Supported Arduino platforms:
|
||||||
* __Arduino__
|
* __Arduino__
|
||||||
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
|
* [__AVR__](https://github.com/arduino/ArduinoCore-avr) - Arduino Uno, Mega, Leonardo, Pro Mini, Nano etc.
|
||||||
|
* NOTE: Arduino boards based on ATmega328 (Uno, Pro Mini, Nano etc.) and smaller are NOT recommended. This is because the ATmega328 MCU is very constrained in terms of program and memory size, so the library will end up taking most of the space available.
|
||||||
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
|
* [__mbed__](https://github.com/arduino/ArduinoCore-mbed) - Arduino Nano 33 BLE and Arduino Portenta H7
|
||||||
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
|
* [__megaAVR__](https://github.com/arduino/ArduinoCore-megaavr) - Arduino Uno WiFi Rev.2 and Nano Every
|
||||||
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
|
* [__SAM__](https://github.com/arduino/ArduinoCore-sam) - Arduino Due
|
||||||
|
|||||||
@@ -35,9 +35,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
@@ -35,9 +35,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
@@ -105,32 +109,49 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print(F("[APRS] Sending position ... "));
|
Serial.println(F("[APRS] Sending location reports"));
|
||||||
|
|
||||||
// send a location without message or timestamp
|
// send a location without message or timestamp
|
||||||
char destination[] = "N0CALL";
|
char destination[] = "N0CALL";
|
||||||
char latitude[] = "4911.67N";
|
char latitude[] = "4911.67N";
|
||||||
char longitude[] = "01635.96E";
|
char longitude[] = "01635.96E";
|
||||||
int state = aprs.sendPosition(destination, 0, latitude, longitude);
|
int state = aprs.sendPosition(destination, 0, latitude, longitude);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
}
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
// send a location with message and without timestamp
|
// send a location with message and without timestamp
|
||||||
char message[] = "I'm here!";
|
char message[] = "I'm here!";
|
||||||
state |= aprs.sendPosition(destination, 0, latitude, longitude, message);
|
state = aprs.sendPosition(destination, 0, latitude, longitude, message);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location and message code "));
|
||||||
|
Serial.println(state);
|
||||||
|
}
|
||||||
delay(500);
|
delay(500);
|
||||||
|
|
||||||
|
// you can also set repeater callsigns and SSIDs
|
||||||
|
// up to 8 repeaters may be used
|
||||||
|
// sendPosition will be sent with "WIDE2-2" path
|
||||||
|
char* repeaterCallsigns[] = { "WIDE2" };
|
||||||
|
uint8_t repeaterSSIDs[] = { 2 };
|
||||||
|
aprs.useRepeaters(repeaterCallsigns, repeaterSSIDs, 1);
|
||||||
|
|
||||||
// send a location with message and timestamp
|
// send a location with message and timestamp
|
||||||
char timestamp[] = "093045z";
|
char timestamp[] = "093045z";
|
||||||
state |= aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
|
state = aprs.sendPosition(destination, 0, latitude, longitude, message, timestamp);
|
||||||
delay(500);
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("[APRS] Failed to send location, message and timestamp code "));
|
||||||
if(state == RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.println(F("success!"));
|
|
||||||
} else {
|
|
||||||
Serial.print(F("failed, code "));
|
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
delay(500);
|
||||||
|
|
||||||
|
// when repeaters are no longer needed, they can be dropped
|
||||||
|
aprs.dropRepeaters();
|
||||||
|
|
||||||
// wait one minute before transmitting again
|
// wait one minute before transmitting again
|
||||||
|
Serial.println(F("[APRS] All done!"));
|
||||||
delay(60000);
|
delay(60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create APRS client instance using the LoRa radio
|
// create APRS client instance using the LoRa radio
|
||||||
APRSClient aprs(&radio);
|
APRSClient aprs(&radio);
|
||||||
|
|||||||
@@ -38,9 +38,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AX.25 client instance using the FSK module
|
// create AX.25 client instance using the FSK module
|
||||||
AX25Client ax25(&radio);
|
AX25Client ax25(&radio);
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AX.25 client instance using the FSK module
|
// create AX.25 client instance using the FSK module
|
||||||
AX25Client ax25(&radio);
|
AX25Client ax25(&radio);
|
||||||
|
|||||||
@@ -32,9 +32,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
@@ -24,9 +24,13 @@
|
|||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -29,9 +29,13 @@
|
|||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -35,9 +35,13 @@ CC1101 radio1 = new Module(10, 2, RADIOLIB_NC, 3);
|
|||||||
// GDO2 pin: 5 (optional)
|
// GDO2 pin: 5 (optional)
|
||||||
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
|
CC1101 radio2 = new Module(9, 4, RADIOLIB_NC, 5);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -24,9 +24,13 @@
|
|||||||
// GDO2 pin: 3 (optional)
|
// GDO2 pin: 3 (optional)
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -28,9 +28,13 @@
|
|||||||
// GDO2 pin: 3
|
// GDO2 pin: 3
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-3
@@ -25,9 +25,13 @@
|
|||||||
// GDO2 pin: 3
|
// GDO2 pin: 3
|
||||||
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
CC1101 radio = new Module(10, 2, RADIOLIB_NC, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//CC1101 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -34,9 +34,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create FSK4 client instance using the FSK module
|
// create FSK4 client instance using the FSK module
|
||||||
FSK4Client fsk4(&radio);
|
FSK4Client fsk4(&radio);
|
||||||
|
|||||||
@@ -32,9 +32,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
+7
-3
@@ -32,9 +32,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Hellschreiber client instance using the FSK module
|
// create Hellschreiber client instance using the FSK module
|
||||||
HellClient hell(&radio);
|
HellClient hell(&radio);
|
||||||
|
|||||||
+7
-3
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
+11
-4
@@ -34,6 +34,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -57,10 +65,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -71,6 +75,9 @@ void setup() {
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
+11
-4
@@ -29,6 +29,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -52,10 +60,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -67,6 +71,9 @@ void setup() {
|
|||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when LoRa packet or timeout is detected
|
// when LoRa packet or timeout is detected
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
|||||||
@@ -48,9 +48,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -26,9 +26,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+182
@@ -0,0 +1,182 @@
|
|||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Almanac Update Example
|
||||||
|
|
||||||
|
This example updates the LR11x0 GNSS almanac.
|
||||||
|
Almanac is a database of orbital predictions of
|
||||||
|
GNSS satellites, which allows the module to predict
|
||||||
|
when different satellites will appear in the sky,
|
||||||
|
and frequency of their signal.
|
||||||
|
|
||||||
|
Up-to-date almanac is necessary for operation!
|
||||||
|
After an update, data will remain valid for 30 days.
|
||||||
|
All GNSS examples require at least limited
|
||||||
|
visibility of the sky!
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS almanac
|
||||||
|
LR11x0GnssAlmanacStatus_t almStatus;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// run GNSS scans until we get at least the time
|
||||||
|
// NOTE: Depending on visibility of satellites,
|
||||||
|
// this may take multiple attempts!
|
||||||
|
while(true) {
|
||||||
|
// run GNSS scan
|
||||||
|
Serial.print(F("[LR1110] Running GNSS scan ... "));
|
||||||
|
state = radio.gnssScan(NULL);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// check almanac status
|
||||||
|
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
|
||||||
|
state = radio.getGnssAlmanacStatus(&almStatus);
|
||||||
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have the status, check if we have demodulated time
|
||||||
|
if(almStatus.gps.status < RADIOLIB_LR11X0_GNSS_ALMANAC_STATUS_UP_TO_DATE) {
|
||||||
|
Serial.println(F("time unknown, another scan needed."));
|
||||||
|
|
||||||
|
} else if(almStatus.gps.numUpdateNeeded > 0) {
|
||||||
|
Serial.print(almStatus.gps.numUpdateNeeded);
|
||||||
|
Serial.println(F(" satellites out-of-date."));
|
||||||
|
break;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("no update needed!"));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// wait until almanac data is available in the signal
|
||||||
|
// multiple attempts are needed for this
|
||||||
|
Serial.print(F("[LR1110] Waiting for subframe ... "));
|
||||||
|
int state = radio.gnssDelayUntilSubframe(&almStatus, RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if(state == RADIOLIB_ERR_GNSS_SUBFRAME_NOT_AVAILABLE) {
|
||||||
|
Serial.println(F("not enough time left."));
|
||||||
|
|
||||||
|
// wait until the next update window
|
||||||
|
delay(2000);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("done!"));
|
||||||
|
|
||||||
|
// we have enough time to start the update
|
||||||
|
Serial.print(F("[LR1110] Starting update ... "));
|
||||||
|
state = radio.updateGnssAlmanac(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
} else {
|
||||||
|
Serial.println(F("done!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether another update is needed
|
||||||
|
Serial.print(F("[LR1110] Checking GNSS almanac ... "));
|
||||||
|
state = radio.getGnssAlmanacStatus(&almStatus);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we have completed the update
|
||||||
|
if(almStatus.gps.numUpdateNeeded == 0) {
|
||||||
|
Serial.println(F("all satellites up-to-date!"));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
} else {
|
||||||
|
Serial.print(almStatus.gps.numUpdateNeeded);
|
||||||
|
Serial.println(F(" satellites out-of-date."));
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait a bit before the next update attempt
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
}
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Autonomous Position Example
|
||||||
|
|
||||||
|
This example performs GNSS scans and calculates
|
||||||
|
position of the device using autonomous mode.
|
||||||
|
In this mode, scan data does not need to be uploaded
|
||||||
|
to LoRaCloud, however, it requires up-to-date almanac
|
||||||
|
data. Run the LR11x0_Almanac_Update example to update
|
||||||
|
the device almanac.
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS scan result
|
||||||
|
LR11x0GnssResult_t gnssResult;
|
||||||
|
|
||||||
|
// structure to save information about the calculated GNSS position
|
||||||
|
LR11x0GnssPosition_t gnssPosition;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println(F("Scan result\t| Latitude\t| Longitude\t| Accuracy\t| Number of satellites"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// run GNSS scan
|
||||||
|
int state = radio.gnssScan(&gnssResult);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
// success!
|
||||||
|
Serial.print(gnssResult.demodStat); Serial.print("\t\t| ");
|
||||||
|
|
||||||
|
// get the actual data
|
||||||
|
state = radio.getGnssPosition(&gnssPosition);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
// print the position
|
||||||
|
Serial.print(gnssPosition.latitude, 6);
|
||||||
|
Serial.print("\t| ");
|
||||||
|
Serial.print(gnssPosition.longitude, 6);
|
||||||
|
Serial.print("\t| ");
|
||||||
|
Serial.print(gnssPosition.accuracy);
|
||||||
|
Serial.print("\t\t| ");
|
||||||
|
Serial.println(gnssPosition.numSatsUsed);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.print(F("Failed to read result, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (solver error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_SOLVER_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.print(F("Scan failed, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (demodulator error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait a bit before the next scan
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
RadioLib LR11x0 GNSS Satellites Example
|
||||||
|
|
||||||
|
This example performs GNSS scans and shows the satellites
|
||||||
|
currently in view. It is mostly useful to verify
|
||||||
|
visibility and antenna setup.
|
||||||
|
|
||||||
|
NOTE: This example will only work for LR11x0 devices
|
||||||
|
with sufficiently recent firmware!
|
||||||
|
LR1110: 4.1
|
||||||
|
LR1120: 2.1
|
||||||
|
If your device firmware reports older firmware,
|
||||||
|
update it using the LR11x0_Firmware_Update example.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---wifi-scan
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// LR1110 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// DIO1 pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
// set RF switch configuration for Wio WM1110
|
||||||
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
|
// NOTE: other boards may be different!
|
||||||
|
static const uint32_t rfswitch_dio_pins[] = {
|
||||||
|
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
|
||||||
|
RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
|
// mode DIO5 DIO6
|
||||||
|
{ LR11x0::MODE_STBY, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_RX, { HIGH, LOW } },
|
||||||
|
{ LR11x0::MODE_TX, { HIGH, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HP, { LOW, HIGH } },
|
||||||
|
{ LR11x0::MODE_TX_HF, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_GNSS, { LOW, LOW } },
|
||||||
|
{ LR11x0::MODE_WIFI, { LOW, LOW } },
|
||||||
|
END_OF_MODE_TABLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// structure to save information about the GNSS scan result
|
||||||
|
LR11x0GnssResult_t gnssResult;
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize LR1110 with default settings
|
||||||
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
|
int state = radio.beginGNSS(RADIOLIB_LR11X0_GNSS_CONSTELLATION_GPS);
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
|
// check the firmware version
|
||||||
|
Serial.print(F("[LR1110] Checking firmware version ... "));
|
||||||
|
state = radio.isGnssScanCapable();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("check passed!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("check failed, firmware update needed."));
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Serial.print(F("[LR1110] Running GNSS scan ... "));
|
||||||
|
int state = radio.gnssScan(&gnssResult);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
// some error occurred
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.print(state);
|
||||||
|
Serial.print(F(" (demodulator error "));
|
||||||
|
Serial.print(RADIOLIB_GET_GNSS_DEMOD_ERROR(state));
|
||||||
|
Serial.println(F(")"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
|
||||||
|
// print the table header
|
||||||
|
Serial.print(F("[LR1110] Detected "));
|
||||||
|
Serial.print(gnssResult.numSatsDet);
|
||||||
|
Serial.println(F(" satellite(s):"));
|
||||||
|
Serial.println(F(" # | ID | C/N0 [dB]\t| Doppler [Hz]"));
|
||||||
|
|
||||||
|
// read all results at once
|
||||||
|
LR11x0GnssSatellite_t satellites[32];
|
||||||
|
state = radio.getGnssSatellites(satellites, gnssResult.numSatsDet);
|
||||||
|
if(state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("Failed to read results, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
} else {
|
||||||
|
// print all the results
|
||||||
|
for(int i = 0; i < gnssResult.numSatsDet; i++) {
|
||||||
|
if(i < 10) { Serial.print(" "); } Serial.print(i); Serial.print(" | ");
|
||||||
|
Serial.print(satellites[i].svId); Serial.print(" | ");
|
||||||
|
Serial.print(satellites[i].c_n0); Serial.print("\t\t| ");
|
||||||
|
Serial.println(satellites[i].doppler);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for a second before scanning again
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
RadioLib LR11x0 LR-FHSS Modem Example
|
RadioLib LR11x0 LR-FHSS Modem Example
|
||||||
|
|
||||||
This example shows how to use LR-FHSS modem in LR11x0 chips.
|
This example shows how to use LR-FHSS modem in LR11x0 chips.
|
||||||
|
This modem can only transmit data, and is not able to receive.
|
||||||
|
|
||||||
NOTE: The sketch below is just a guide on how to use
|
NOTE: The sketch below is just a guide on how to use
|
||||||
LR-FHSS modem, so this code should not be run directly!
|
LR-FHSS modem, so this code should not be run directly!
|
||||||
@@ -26,9 +27,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//LR1110 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
@@ -68,9 +73,7 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// LR-FHSS modem can use the same transmit/receive methods
|
// LR-FHSS modem can only transmit!
|
||||||
// as the LoRa modem, even their interrupt-driven versions
|
|
||||||
|
|
||||||
// transmit LR-FHSS packet
|
// transmit LR-FHSS packet
|
||||||
int state = radio.transmit("Hello World!");
|
int state = radio.transmit("Hello World!");
|
||||||
/*
|
/*
|
||||||
@@ -89,22 +92,4 @@ void loop() {
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// receive LR-FHSS packet
|
|
||||||
String str;
|
|
||||||
state = radio.receive(str);
|
|
||||||
/*
|
|
||||||
byte byteArr[8];
|
|
||||||
int state = radio.receive(byteArr, 8);
|
|
||||||
*/
|
|
||||||
if (state == RADIOLIB_ERR_NONE) {
|
|
||||||
Serial.println(F("[LR1110] Received packet!"));
|
|
||||||
Serial.print(F("[LR1110] Data:\t"));
|
|
||||||
Serial.println(str);
|
|
||||||
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
|
|
||||||
Serial.println(F("[LR1110] Timed out while waiting for packet!"));
|
|
||||||
} else {
|
|
||||||
Serial.print(F("[LR1110] Failed to receive packet, code "));
|
|
||||||
Serial.println(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -66,10 +74,6 @@ void setFlag(void) {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -81,6 +85,9 @@ void setup() {
|
|||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when new packet is received
|
// when new packet is received
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
|||||||
@@ -39,6 +39,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -62,10 +70,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -76,6 +80,9 @@ void setup() {
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
@@ -35,6 +35,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -58,10 +66,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -73,6 +77,9 @@ void setup() {
|
|||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when new packet is received
|
// when new packet is received
|
||||||
radio.setPacketReceivedAction(setFlag);
|
radio.setPacketReceivedAction(setFlag);
|
||||||
|
|||||||
@@ -30,6 +30,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -53,10 +61,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -68,6 +72,9 @@ void setup() {
|
|||||||
delay(1000);
|
delay(1000);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
// counter to keep track of transmitted packets
|
// counter to keep track of transmitted packets
|
||||||
|
|||||||
+11
-4
@@ -31,6 +31,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -57,10 +65,6 @@ int transmissionState = RADIOLIB_ERR_NONE;
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -72,6 +76,9 @@ void setup() {
|
|||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when packet transmission is finished
|
// when packet transmission is finished
|
||||||
radio.setPacketSentAction(setFlag);
|
radio.setPacketSentAction(setFlag);
|
||||||
|
|||||||
+11
-4
@@ -32,6 +32,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -69,6 +73,9 @@ void setup() {
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
+11
-4
@@ -32,6 +32,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
LR1110 radio = new Module(10, 2, 3, 9);
|
LR1110 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// set RF switch configuration for Wio WM1110
|
// set RF switch configuration for Wio WM1110
|
||||||
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
// Wio WM1110 uses DIO5 and DIO6 for RF switching
|
||||||
// NOTE: other boards may be different!
|
// NOTE: other boards may be different!
|
||||||
@@ -55,10 +63,6 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|
||||||
// set RF switch control configuration
|
|
||||||
// this has to be done prior to calling begin()
|
|
||||||
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
|
||||||
|
|
||||||
// initialize LR1110 with default settings
|
// initialize LR1110 with default settings
|
||||||
Serial.print(F("[LR1110] Initializing ... "));
|
Serial.print(F("[LR1110] Initializing ... "));
|
||||||
int state = radio.begin();
|
int state = radio.begin();
|
||||||
@@ -70,6 +74,9 @@ void setup() {
|
|||||||
while (true) { delay(10); }
|
while (true) { delay(10); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set RF switch control configuration
|
||||||
|
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
|
|
||||||
// set the function that will be called
|
// set the function that will be called
|
||||||
// when WiFi scan is complete
|
// when WiFi scan is complete
|
||||||
radio.setIrqAction(setFlag);
|
radio.setIrqAction(setFlag);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// pin 5 is connected to SX1278 DIO2
|
// pin 5 is connected to SX1278 DIO2
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// pin 5 is connected to SX1278 DIO2
|
// pin 5 is connected to SX1278 DIO2
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
@@ -33,9 +33,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Morse client instance using the FSK module
|
// create Morse client instance using the FSK module
|
||||||
MorseClient morse(&radio);
|
MorseClient morse(&radio);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "EspHal.h"
|
#include "hal/ESP-IDF/EspHal.h"
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
EspHal* hal = new EspHal(5, 19, 27);
|
EspHal* hal = new EspHal(5, 19, 27);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ add_executable(${PROJECT_NAME}
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Pull in common dependencies
|
# Pull in common dependencies
|
||||||
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer RadioLib)
|
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi hardware_gpio hardware_timer pico_multicore hardware_pwm RadioLib)
|
||||||
|
|
||||||
|
|
||||||
pico_enable_stdio_usb(${PROJECT_NAME} 1)
|
pico_enable_stdio_usb(${PROJECT_NAME} 1)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "PicoHal.h"
|
#include "hal/RPiPico/PicoHal.h"
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
|
PicoHal* hal = new PicoHal(SPI_PORT, SPI_MISO, SPI_MOSI, SPI_SCK);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "PiHal.h"
|
#include "hal/RPi/PiHal.h"
|
||||||
|
|
||||||
// create a new instance of the HAL class
|
// create a new instance of the HAL class
|
||||||
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
|
// use SPI channel 1, because on Waveshare LoRaWAN Hat,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
|
|
||||||
// include the hardware abstraction layer
|
// include the hardware abstraction layer
|
||||||
#include "libtockHal.h"
|
#include "hal/Tock/libtockHal.h"
|
||||||
|
|
||||||
// the entry point for the program
|
// the entry point for the program
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|||||||
@@ -45,9 +45,13 @@ const int pin = 5;
|
|||||||
// create Pager client instance using the FSK module
|
// create Pager client instance using the FSK module
|
||||||
PagerClient pager(&radio);
|
PagerClient pager(&radio);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create Pager client instance using the FSK module
|
// create Pager client instance using the FSK module
|
||||||
PagerClient pager(&radio);
|
PagerClient pager(&radio);
|
||||||
|
|||||||
+8
@@ -23,6 +23,14 @@
|
|||||||
// extra GPIO/interrupt pin: 3 (unused on some modules)
|
// extra GPIO/interrupt pin: 3 (unused on some modules)
|
||||||
RADIO_TYPE radio = new Module(10, 2, 9, 3);
|
RADIO_TYPE radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// get pointer to the common layer
|
// get pointer to the common layer
|
||||||
PhysicalLayer* phy = (PhysicalLayer*)&radio;
|
PhysicalLayer* phy = (PhysicalLayer*)&radio;
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -23,9 +23,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -21,9 +21,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -33,9 +33,13 @@ RF69 radio1 = new Module(10, 2, 3);
|
|||||||
// RESET pin: 5
|
// RESET pin: 5
|
||||||
RF69 radio2 = new Module(9, 4, 5);
|
RF69 radio2 = new Module(9, 4, 5);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -21,9 +21,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -23,9 +23,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -27,9 +27,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -24,9 +24,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
RF69 radio = new Module(10, 2, 3);
|
RF69 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//RF69 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -32,9 +32,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create RTTY client instance using the FSK module
|
// create RTTY client instance using the FSK module
|
||||||
RTTYClient rtty(&radio);
|
RTTYClient rtty(&radio);
|
||||||
|
|||||||
@@ -29,9 +29,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
@@ -42,9 +42,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create SSTV client instance using the FSK module
|
// create SSTV client instance using the FSK module
|
||||||
SSTVClient sstv(&radio);
|
SSTVClient sstv(&radio);
|
||||||
|
|||||||
@@ -38,9 +38,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// create AFSK client instance using the FSK module
|
// create AFSK client instance using the FSK module
|
||||||
// this requires connection to the module direct
|
// this requires connection to the module direct
|
||||||
|
|||||||
-3
@@ -154,8 +154,5 @@ void loop() {
|
|||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// put module back to listen mode
|
|
||||||
radio.startReceive();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
SX1231 radio = new Module(10, 2, 3);
|
SX1231 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1231 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -28,9 +28,13 @@
|
|||||||
// RESET pin: 3
|
// RESET pin: 3
|
||||||
SX1231 radio = new Module(10, 2, 3);
|
SX1231 radio = new Module(10, 2, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1231 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-6
@@ -30,12 +30,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-6
@@ -25,12 +25,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-6
@@ -27,12 +27,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -26,12 +26,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
RadioLib SX126x LR-FHSS Modem Example
|
||||||
|
|
||||||
|
This example shows how to use LR-FHSS modem in SX126x chips.
|
||||||
|
This modem can only transmit data, and is not able to receive.
|
||||||
|
|
||||||
|
NOTE: The sketch below is just a guide on how to use
|
||||||
|
LR-FHSS modem, so this code should not be run directly!
|
||||||
|
Instead, modify the other examples to use LR-FHSS
|
||||||
|
modem and use the appropriate configuration
|
||||||
|
methods.
|
||||||
|
|
||||||
|
For default module settings, see the wiki page
|
||||||
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lr-fhss-modem
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library
|
||||||
|
#include <RadioLib.h>
|
||||||
|
|
||||||
|
// SX1262 has the following connections:
|
||||||
|
// NSS pin: 10
|
||||||
|
// IRQ pin: 2
|
||||||
|
// NRST pin: 3
|
||||||
|
// BUSY pin: 9
|
||||||
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(9600);
|
||||||
|
|
||||||
|
// initialize SX1262 with default settings
|
||||||
|
Serial.print(F("[SX1262] Initializing ... "));
|
||||||
|
int state = radio.beginLRFHSS();
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// if needed, you can switch between any of the modems
|
||||||
|
//
|
||||||
|
// radio.begin() start LoRa modem (and disable LR-FHSS)
|
||||||
|
// radio.beginLRFHSS() start LR-FHSS modem (and disable LoRa)
|
||||||
|
|
||||||
|
// the following settings can also
|
||||||
|
// be modified at run-time
|
||||||
|
state = radio.setFrequency(433.5);
|
||||||
|
state = radio.setLrFhssConfig(RADIOLIB_SX126X_LR_FHSS_BW_1523_4, // bandwidth
|
||||||
|
RADIOLIB_SX126X_LR_FHSS_CR_1_2, // coding rate
|
||||||
|
3, // header count
|
||||||
|
0x13A); // hopping sequence seed
|
||||||
|
state = radio.setOutputPower(10.0);
|
||||||
|
state = radio.setSyncWord(0x12345678);
|
||||||
|
if (state != RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.print(F("Unable to set configuration, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while (true) { delay(10); }
|
||||||
|
}
|
||||||
|
|
||||||
|
#warning "This sketch is just an API guide! Read the note at line 6."
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// LR-FHSS modem can only transmit!
|
||||||
|
// transmit LR-FHSS packet
|
||||||
|
int state = radio.transmit("Hello World!");
|
||||||
|
/*
|
||||||
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||||
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
|
int state = radio.transmit(byteArr, 8);
|
||||||
|
*/
|
||||||
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
|
Serial.println(F("[SX1262] Packet transmitted successfully!"));
|
||||||
|
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
|
||||||
|
Serial.println(F("[SX1262] Packet too long!"));
|
||||||
|
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
|
||||||
|
Serial.println(F("[SX1262] Timed out while transmitting!"));
|
||||||
|
} else {
|
||||||
|
Serial.println(F("[SX1262] Failed to transmit packet, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
RadioLib SX126x Ping-Pong Example
|
RadioLib SX126x Ping-Pong Example
|
||||||
|
|
||||||
|
This example is intended to run on two SX126x radios,
|
||||||
|
and send packets between the two.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
|
|
||||||
@@ -22,12 +25,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission states between loops
|
// save transmission states between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
Other modules from SX126x family can also be used.
|
Other modules from SX126x family can also be used.
|
||||||
|
|
||||||
Using blocking receive is not recommended, as it will lead
|
Using blocking receive is not recommended, as it will lead
|
||||||
to significant amount of timeouts, inefficient use of processor
|
to significant amount of timeouts, inefficient use of processor
|
||||||
time and can some miss packets!
|
time and can some miss packets!
|
||||||
Instead, interrupt receive is recommended.
|
Instead, interrupt receive is recommended.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
@@ -35,12 +35,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -31,12 +31,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -41,12 +41,13 @@ SX1262 radio1 = new Module(10, 2, 3, 9);
|
|||||||
// BUSY pin: 6
|
// BUSY pin: 6
|
||||||
SX1268 radio2 = new Module(8, 4, 5, 6);
|
SX1268 radio2 = new Module(8, 4, 5, 6);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1261 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -34,6 +34,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
|||||||
+8
@@ -34,6 +34,14 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
|
// or detect the pinout automatically using RadioBoards
|
||||||
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// frequency range in MHz to scan
|
// frequency range in MHz to scan
|
||||||
const float freqStart = 431;
|
const float freqStart = 431;
|
||||||
const float freqEnd = 435;
|
const float freqEnd = 435;
|
||||||
|
|||||||
@@ -30,12 +30,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-6
@@ -27,12 +27,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1262 radio = new Module(10, 2, 3, 9);
|
SX1262 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1262 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
// or using CubeCell
|
#include <RadioBoards.h>
|
||||||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
+7
-3
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-3
@@ -26,9 +26,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Serial port speed must be high enough for this example
|
// Serial port speed must be high enough for this example
|
||||||
|
|||||||
+7
-3
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Serial port speed must be high enough for this example
|
// Serial port speed must be high enough for this example
|
||||||
|
|||||||
@@ -26,9 +26,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
RadioLib SX127x Ping-Pong Example
|
RadioLib SX127x Ping-Pong Example
|
||||||
|
|
||||||
|
This example is intended to run on two SX126x radios,
|
||||||
|
and send packets between the two.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx127xrfm9x---lora-modem
|
||||||
|
|
||||||
@@ -22,9 +25,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission states between loops
|
// save transmission states between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -35,9 +35,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -24,9 +24,13 @@ SX1278 radio = new Module(10, 2, 9, 3);
|
|||||||
// DIO2 pin: 5
|
// DIO2 pin: 5
|
||||||
const int pin = 5;
|
const int pin = 5;
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool receivedFlag = false;
|
volatile bool receivedFlag = false;
|
||||||
@@ -86,6 +90,7 @@ void setup() {
|
|||||||
|
|
||||||
// set hop period in symbols
|
// set hop period in symbols
|
||||||
// this will also enable FHSS
|
// this will also enable FHSS
|
||||||
|
Serial.print(F("[SX1278] Setting hopping period ... "));
|
||||||
state = radio.setFHSSHoppingPeriod(9);
|
state = radio.setFHSSHoppingPeriod(9);
|
||||||
if (state == RADIOLIB_ERR_NONE) {
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
@@ -153,6 +158,9 @@ void loop() {
|
|||||||
// reset the counter
|
// reset the counter
|
||||||
hopsCompleted = 0;
|
hopsCompleted = 0;
|
||||||
|
|
||||||
|
// return to home channel before the next transaction
|
||||||
|
radio.setFrequency(channels[0]);
|
||||||
|
|
||||||
// put the module back to listen mode
|
// put the module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -37,9 +37,13 @@ SX1278 radio1 = new Module(10, 2, 9, 3);
|
|||||||
// DIO1 pin: 6
|
// DIO1 pin: 6
|
||||||
SX1272 radio2 = new Module(9, 4, 5, 6);
|
SX1272 radio2 = new Module(9, 4, 5, 6);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1276 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// flag to indicate that a packet was received
|
// flag to indicate that a packet was received
|
||||||
volatile bool transmittedFlag = false;
|
volatile bool transmittedFlag = false;
|
||||||
@@ -98,6 +102,7 @@ void setup() {
|
|||||||
|
|
||||||
// set hop period in symbols
|
// set hop period in symbols
|
||||||
// this will also enable FHSS
|
// this will also enable FHSS
|
||||||
|
Serial.print(F("[SX1278] Setting hopping period ... "));
|
||||||
state = radio.setFHSSHoppingPeriod(9);
|
state = radio.setFHSSHoppingPeriod(9);
|
||||||
if (state == RADIOLIB_ERR_NONE) {
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
@@ -147,7 +152,7 @@ void loop() {
|
|||||||
hopsCompleted = 0;
|
hopsCompleted = 0;
|
||||||
|
|
||||||
// return to home channel before the next transaction
|
// return to home channel before the next transaction
|
||||||
radio.setFrequency(channels[radio.getFHSSChannel() % numberOfChannels]);
|
radio.setFrequency(channels[0]);
|
||||||
|
|
||||||
// wait a second before transmitting again
|
// wait a second before transmitting again
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|||||||
+7
-3
@@ -27,9 +27,13 @@
|
|||||||
// DIO1 pin: 3
|
// DIO1 pin: 3
|
||||||
SX1278 radio = new Module(10, 2, 9, 3);
|
SX1278 radio = new Module(10, 2, 9, 3);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1278 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
@@ -28,9 +28,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-3
@@ -28,9 +28,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+8
-4
@@ -7,7 +7,7 @@
|
|||||||
Other modules from SX128x family can also be used.
|
Other modules from SX128x family can also be used.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx128x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx128x---lora-modem
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For full API reference, see the GitHub Pages
|
||||||
https://jgromes.github.io/RadioLib/
|
https://jgromes.github.io/RadioLib/
|
||||||
@@ -23,9 +23,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -26,9 +26,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -26,9 +26,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -28,9 +28,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -35,9 +35,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -31,9 +31,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -38,9 +38,13 @@ SX1280 radio1 = new Module(10, 2, 3, 9);
|
|||||||
// BUSY pin: 6
|
// BUSY pin: 6
|
||||||
SX1281 radio2 = new Module(8, 4, 5, 6);
|
SX1281 radio2 = new Module(8, 4, 5, 6);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1282 radio3 = RadioShield.ModuleB;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio3 = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
@@ -30,9 +30,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
|
|||||||
+7
-3
@@ -27,9 +27,13 @@
|
|||||||
// BUSY pin: 9
|
// BUSY pin: 9
|
||||||
SX1280 radio = new Module(10, 2, 3, 9);
|
SX1280 radio = new Module(10, 2, 3, 9);
|
||||||
|
|
||||||
// or using RadioShield
|
// or detect the pinout automatically using RadioBoards
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/radiolib-org/RadioBoards
|
||||||
//SX1280 radio = RadioShield.ModuleA;
|
/*
|
||||||
|
#define RADIO_BOARD_AUTO
|
||||||
|
#include <RadioBoards.h>
|
||||||
|
Radio radio = new RadioModule();
|
||||||
|
*/
|
||||||
|
|
||||||
// save transmission state between loops
|
// save transmission state between loops
|
||||||
int transmissionState = RADIOLIB_ERR_NONE;
|
int transmissionState = RADIOLIB_ERR_NONE;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user