Merge branch 'jgromes:master' into master

This commit is contained in:
BayCom GmbH 2023-09-21 01:25:16 +02:00 committed by GitHub
commit cb1a2059b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 83 additions and 44 deletions

View file

@ -17,7 +17,6 @@ on:
- none
- arduino:avr:uno
- arduino:avr:mega
- arduino:avr:leonardo
- arduino:mbed:nano33ble
- arduino:mbed:envie_m4
- arduino:megaavr:uno2018
@ -50,8 +49,6 @@ jobs:
run: echo "skip-pattern=(STM32WL|SSTV|LoRaWAN)" >> $GITHUB_OUTPUT
- id: arduino:avr:mega
run: echo "options=':cpu=atmega2560'" >> $GITHUB_OUTPUT
- id: arduino:avr:leonardo
run: echo "skip-pattern=(STM32WL|SSTV|Pager)" >> $GITHUB_OUTPUT
- id: arduino:mbed:nano33ble
- id: arduino:mbed:envie_m4
- id: arduino:megaavr:uno2018

View file

@ -4,7 +4,7 @@
## Universal wireless communication library for embedded devices
## See the [Wiki](https://github.com/jgromes/RadioLib/wiki) for further information. See the [GitHub Pages](https://jgromes.github.io/RadioLib) for detailed and up-to-date API reference.
## See the [Wiki](https://github.com/jgromes/RadioLib/wiki) and [FAQ](https://github.com/jgromes/RadioLib/wiki/Frequently-Asked-Questions) for further information. See the [GitHub Pages](https://jgromes.github.io/RadioLib) for detailed and up-to-date API reference.
RadioLib allows its users to integrate all sorts of different wireless communication modules, protocols and even digital modes into a single consistent system.
Want to add a Bluetooth interface to your LoRa network? Sure thing! Do you just want to go really old-school and play around with radio teletype, slow-scan TV, or even Hellschreiber using nothing but a cheap radio module? Why not!
@ -88,17 +88,3 @@ SX127x, RFM9x, SX126x and SX128x
* [__Teensy__](https://github.com/PaulStoffregen/cores) - Teensy 2.x, 3.x and 4.x boards
The list above is by no means exhaustive - RadioLib code is independent of the used platform! Compilation of all examples is tested for all platforms officially supported prior to releasing new version. In addition, RadioLib includes an internal hardware abstraction layer, which allows it to be easily ported even to non-Arduino environments.
## Frequently Asked Questions
### Where should I start?
First of all, take a look at the [examples](https://github.com/jgromes/RadioLib/tree/master/examples) and the [Wiki](https://github.com/jgromes/RadioLib/wiki) - especially the [Basics](https://github.com/jgromes/RadioLib/wiki/Basics) page. There's a lot of useful information over there. If something isn't working as expected, try searching the [issues](https://github.com/jgromes/RadioLib/issues/).
### Does RadioLib require Arduino?
While RadioLib was originally written with Arduino in mind, it has since evolved and contains its own lightweight hardware abstraction layer. Thanks to this layer, RadioLib can be used on non-Arduino frameworks as well. See [this Wiki page](https://github.com/jgromes/RadioLib/wiki/Porting-to-non-Arduino-Platforms) for details.
### Help, my module isn't working!
The fastest way to get help is by creating an [issue](https://github.com/jgromes/RadioLib/issues/new/choose) using the appropriate template. It is also highly recommended to try running the examples first - their functionality is tested from time to time and they should work. Finally, RadioLib is still under development, which means that sometimes, backwards-incompatible changes might be introduced. Though these are kept at minimum, sometimes it is unavoidable. You can check the [release changelog](https://github.com/jgromes/RadioLib/releases) to find out if there's been such a major change recently.
### RadioLib doesn't support my module! What should I do?
Start by creating new issue (if it doesn't exist yet). If you have some experience with microcontrollers and C/C++ in general, you can try to add the support yourself! Use the template files in `/extras/` folder to get started. This is by far the fastest way to implement new modules into RadioLib, since I can't be working on everything all the time. If you don't trust your programming skills enough to have a go at it yourself, don't worry. I will try to implement all requested modules, but it will take me a while.

View file

@ -1,8 +1,8 @@
{
"name": "RadioLib",
"version": "6.1.0",
"description": "Universal wireless communication library. User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.).",
"keywords": "radio, communication, morse, cc1101, aprs, sx1276, sx1278, sx1272, rtty, ax25, afsk, nrf24, rfm96, sx1231, rfm96, rfm98, sstv, sx1278, sx1272, sx1276, sx1280, sx1281, sx1282, sx1261, sx1262, sx1268, si4432, rfm22, llcc68, pager, pocsag",
"version": "6.2.0",
"description": "Universal wireless communication library. User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.) and other protocols (Pagers, LoRaWAN).",
"keywords": "radio, communication, morse, cc1101, aprs, sx1276, sx1278, sx1272, rtty, ax25, afsk, nrf24, rfm96, sx1231, rfm96, rfm98, sstv, sx1278, sx1272, sx1276, sx1280, sx1281, sx1282, sx1261, sx1262, sx1268, si4432, rfm22, llcc68, pager, pocsag, lorawan",
"homepage": "https://github.com/jgromes/RadioLib",
"repository":
{

View file

@ -1,9 +1,9 @@
name=RadioLib
version=6.1.0
version=6.2.0
author=Jan Gromes <gromes.jan@gmail.com>
maintainer=Jan Gromes <gromes.jan@gmail.com>
sentence=Universal wireless communication library
paragraph=User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.).
paragraph=User-friendly library for sub-GHz radio modules (SX1278, RF69, CC1101, SX1268, and many others), as well as ham radio digital modes (RTTY, SSTV, AX.25 etc.) and other protocols (Pagers, LoRaWAN).
category=Communication
url=https://github.com/jgromes/RadioLib
architectures=*

View file

@ -2,7 +2,9 @@
#if defined(RADIOLIB_BUILD_ARDUINO)
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#include <EEPROM.h>
#endif
ArduinoHal::ArduinoHal(): RadioLibHal(INPUT, OUTPUT, LOW, HIGH, RISING, FALLING), spi(&RADIOLIB_DEFAULT_SPI), initInterface(true) {}
@ -101,6 +103,7 @@ void inline ArduinoHal::spiEnd() {
}
void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#if defined(RADIOLIB_ESP32)
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
#endif
@ -110,9 +113,11 @@ void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len)
#if defined(RADIOLIB_ESP32)
EEPROM.end();
#endif
#endif
}
void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#if defined(RADIOLIB_ESP32)
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
#endif
@ -123,6 +128,7 @@ void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len
EEPROM.commit();
EEPROM.end();
#endif
#endif
}
void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long duration) {

View file

@ -105,6 +105,7 @@
#elif defined(SAMD_SERIES)
// Adafruit SAMD boards (M0 and M4)
#define RADIOLIB_PLATFORM "Adafruit SAMD"
#define RADIOLIB_EEPROM_UNSUPPORTED
#elif defined(ARDUINO_ARCH_SAMD)
// Arduino SAMD (Zero, MKR, etc.)
@ -112,15 +113,18 @@
#define RADIOLIB_ARDUINOHAL_PIN_MODE_CAST (PinMode)
#define RADIOLIB_ARDUINOHAL_PIN_STATUS_CAST (PinStatus)
#define RADIOLIB_ARDUINOHAL_INTERRUPT_MODE_CAST (PinStatus)
#define RADIOLIB_EEPROM_UNSUPPORTED
#elif defined(__SAM3X8E__)
// Arduino Due
#define RADIOLIB_PLATFORM "Arduino Due"
#define RADIOLIB_TONE_UNSUPPORTED
#define RADIOLIB_EEPROM_UNSUPPORTED
#elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
// Adafruit nRF52 boards
#define RADIOLIB_PLATFORM "Adafruit nRF52"
#define RADIOLIB_EEPROM_UNSUPPORTED
#elif defined(ARDUINO_ARC32_TOOLS)
// Intel Curie
@ -143,6 +147,7 @@
#define RADIOLIB_ARDUINOHAL_PIN_MODE_CAST (PinMode)
#define RADIOLIB_ARDUINOHAL_PIN_STATUS_CAST (PinStatus)
#define RADIOLIB_ARDUINOHAL_INTERRUPT_MODE_CAST (PinStatus)
#define RADIOLIB_EEPROM_UNSUPPORTED
// Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
#define RADIOLIB_TONE_UNSUPPORTED
@ -154,6 +159,7 @@
#define RADIOLIB_ARDUINOHAL_PIN_MODE_CAST (PinMode)
#define RADIOLIB_ARDUINOHAL_PIN_STATUS_CAST (PinStatus)
#define RADIOLIB_ARDUINOHAL_INTERRUPT_MODE_CAST (PinStatus)
#define RADIOLIB_EEPROM_UNSUPPORTED
// Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
#define RADIOLIB_TONE_UNSUPPORTED
@ -175,6 +181,7 @@
#define RADIOLIB_ARDUINOHAL_PIN_MODE_CAST (PinMode)
#define RADIOLIB_ARDUINOHAL_PIN_STATUS_CAST (PinStatus)
#define RADIOLIB_ARDUINOHAL_INTERRUPT_MODE_CAST (PinStatus)
#define RADIOLIB_EEPROM_UNSUPPORTED
// Arduino mbed OS boards have a really bad tone implementation which will crash after a couple seconds
#define RADIOLIB_TONE_UNSUPPORTED
@ -499,7 +506,7 @@
// version definitions
#define RADIOLIB_VERSION_MAJOR (0x06)
#define RADIOLIB_VERSION_MINOR (0x01)
#define RADIOLIB_VERSION_MINOR (0x02)
#define RADIOLIB_VERSION_PATCH (0x00)
#define RADIOLIB_VERSION_EXTRA (0x00)

View file

@ -51,6 +51,20 @@
#warning "God mode active, I hope it was intentional. Buckle up, lads."
#endif
// print debug info
#if defined(RADIOLIB_DEBUG)
#define RADIOLIB_VALUE_TO_STRING(x) #x
#define RADIOLIB_VALUE(x) RADIOLIB_VALUE_TO_STRING(x)
#pragma message("\nRadioLib Debug Info\nVersion " \
RADIOLIB_VALUE(RADIOLIB_VERSION_MAJOR) "." \
RADIOLIB_VALUE(RADIOLIB_VERSION_MINOR) "." \
RADIOLIB_VALUE(RADIOLIB_VERSION_PATCH) "." \
RADIOLIB_VALUE(RADIOLIB_VERSION_EXTRA) "\n" \
"Platform: " RADIOLIB_VALUE(RADIOLIB_PLATFORM) "\n" \
"Compiled: " RADIOLIB_VALUE(__DATE__) " " RADIOLIB_VALUE(__TIME__) \
)
#endif
// check unknown/unsupported platform
#if defined(RADIOLIB_UNKNOWN_PLATFORM)
#warning "RadioLib might not be compatible with this Arduino board - check supported platforms at https://github.com/jgromes/RadioLib!"

View file

@ -7,6 +7,10 @@
// flag to indicate whether we have received a downlink
static volatile bool downlinkReceived = false;
#if defined(RADIOLIB_EEPROM_UNSUPPORTED)
#warning "Persistent storage not supported!"
#endif
// interrupt service routine to handle downlinks automatically
#if defined(ESP8266) || defined(ESP32)
IRAM_ATTR
@ -1171,6 +1175,8 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
uint8_t margin = cmd->payload[0];
uint8_t gwCnt = cmd->payload[1];
RADIOLIB_DEBUG_PRINTLN("Link check: margin = %d dB, gwCnt = %d", margin, gwCnt);
(void)margin;
(void)gwCnt;
return(2);
} break;
@ -1220,8 +1226,11 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
}
// TODO implement repeated uplinks with nbTrans
(void)nbTrans;
// TODO implement channel mask
uint8_t chMaskAck = 0;
(void)chMask;
(void)chMaskCntl;
// send the reply
cmd->len = 1;
@ -1236,7 +1245,7 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
RADIOLIB_DEBUG_PRINTLN("Max duty cycle: 1/2^%d", maxDutyCycle);
// TODO implement this
(void)maxDutyCycle;
return(1);
} break;
@ -1258,9 +1267,11 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
}
// TODO process the RX2 data rate
(void)rx2DataRate;
uint8_t rx2Ack = 0;
// TODO process the data rate offset
(void)rx1DrOffset;
uint8_t rx1OffsAck = 0;
// send the reply
@ -1293,7 +1304,10 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
RADIOLIB_DEBUG_PRINTLN("New channel: index = %d, freq = %f MHz, maxDr = %d, minDr = %d", chIndex, freq, maxDr, minDr);
// TODO implement this
(void)chIndex;
(void)freq;
(void)maxDr;
(void)minDr;
return(5);
} break;
@ -1329,6 +1343,9 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
RADIOLIB_DEBUG_PRINTLN("TX timing: dlDwell = %d, dlDwell = %d, maxEirp = %d dBm", dlDwell, ulDwell, maxEirp);
// TODO implement this
(void)dlDwell;
(void)ulDwell;
(void)maxEirp;
return(1);
} break;
@ -1340,6 +1357,8 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
RADIOLIB_DEBUG_PRINTLN("DL channel: index = %d, freq = %f MHz", chIndex, freq);
// TODO implement this
(void)chIndex;
(void)freq;
return(4);
} break;
@ -1359,14 +1378,18 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
uint8_t limitExp = (cmd->payload[0] & 0xF0) >> 4;
uint8_t delayExp = cmd->payload[0] & 0x0F;
RADIOLIB_DEBUG_PRINTLN("ADR param setup: limitExp = %d, delayExp = %d", limitExp, delayExp);
(void)limitExp;
(void)delayExp;
return(1);
} break;
case(RADIOLIB_LORAWAN_MAC_CMD_DEVICE_TIME): {
// TODO implement this - sent by gateway as reply to node request
uint32_t gpsEpoch = LoRaWANNode::ntoh<uint32_t>(&cmd->payload[0]);
uint8_t fraction = cmd->payload[5];
uint8_t fraction = cmd->payload[4];
RADIOLIB_DEBUG_PRINTLN("Network time: gpsEpoch = %d s, delayExp = %f", gpsEpoch, (float)fraction/256.0f);
(void)gpsEpoch;
(void)fraction;
return(5);
} break;
@ -1378,6 +1401,10 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
uint8_t rejoinType = (rejoinReq & 0x0070) >> 4;
uint8_t dr = rejoinReq & 0x000F;
RADIOLIB_DEBUG_PRINTLN("Force rejoin: period = %d, maxRetries = %d, rejoinType = %d, dr = %d", period, maxRetries, rejoinType, dr);
(void)period;
(void)maxRetries;
(void)rejoinType;
(void)dr;
return(2);
} break;
@ -1386,6 +1413,8 @@ size_t LoRaWANNode::execMacCommand(LoRaWANMacCommand_t* cmd) {
uint8_t maxTime = (cmd->payload[0] & 0xF0) >> 4;
uint8_t maxCount = cmd->payload[0] & 0x0F;
RADIOLIB_DEBUG_PRINTLN("Rejoin setup: maxTime = %d, maxCount = %d", maxTime, maxCount);
(void)maxTime;
(void)maxCount;
return(0);
} break;
}