-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FEC] Added Vitervi encoder * [SX126x] Added initial LR-FHSS transmission support * [CI] Use RPi build for CodeQL * [SX126x] Fix signed comparison warning * [FEC] Make input to Viterbi encoder const * [CI] Drop SX126x examples from Arduino Uno builds * [CI] Build SX123x for CodeQL scan * [FEC] Fix comparison type * [SX126x] Added configurable grid step * [SX126x] Rename convolutional coding class * [SX126x] Fix payload CRC * [SX126x] ADded LR-FHSS example * [SX126x] Make argument const
- Loading branch information
Showing
12 changed files
with
933 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
examples/SX126x/SX126x_LR_FHSS_Modem/SX126x_LR_FHSS_Modem.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
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 using RadioShield | ||
// https://github.com/jgromes/RadioShield | ||
//SX1262 radio = RadioShield.ModuleA; | ||
|
||
// or using CubeCell | ||
//SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE); | ||
|
||
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.