
* [LoRaWAN] rework bands, add ADR, partial MAC support Known problem: terribly bad at receiving downlinks Mask-list bands (e.g. US915) untested, likely a few bugs * [LoRaWAN] Change Rx windows from CAD to RxSingle * [LoRaWAN] improve persistence, better Rx windows, wear leveling, confirmed frames * [LoRaWAN] Module-independent (OTAA) Rx windows, fix confirming downlinks * [LoRaWAN] Implement SX127x support, fix MAC uplinking, support clock drift * [ArduinoHal] fix clock drift calculation * [LoRaWAN] Improve band & ADR logic, allow setting ADR, DR, subband, update examples * [LoRaWAN] Fix EU868 coding rate, improve example * [LoRaWAN] fix unused channel index * [LoRaWAN] fix merge issue (deleted line) * [LoRaWAN] fix CSMA calling now incorrect function * [LoRaWAN] fix include logic * [LoRaWAN] fix warnings, remove duplicate function * [LoRaWAN] improve examples, add unified sendReceive, bugfixes, add FSK * [LoRaWAN] improve examples * [LoRaWAN] add new keywords, add debug guard * [SX127x] Updated startReceive interface to be more in line with SX126x * [SX127x] Added public method to convert from bytes to symbols * [LoRaWAN] Update start receive for SX127x * Added note about LoRaWAN beta * [SX127x] Fixed potential float overflow --------- Co-authored-by: jgromes <jan.gromes@gmail.com>
82 lines
2.5 KiB
C++
82 lines
2.5 KiB
C++
#include "Hal.h"
|
|
|
|
RadioLibHal::RadioLibHal(const uint32_t input, const uint32_t output, const uint32_t low, const uint32_t high, const uint32_t rising, const uint32_t falling)
|
|
: GpioModeInput(input),
|
|
GpioModeOutput(output),
|
|
GpioLevelLow(low),
|
|
GpioLevelHigh(high),
|
|
GpioInterruptRising(rising),
|
|
GpioInterruptFalling(falling) {}
|
|
|
|
void RadioLibHal::init() {
|
|
|
|
}
|
|
|
|
void RadioLibHal::term() {
|
|
|
|
}
|
|
|
|
void RadioLibHal::tone(uint32_t pin, unsigned int frequency, unsigned long duration) {
|
|
(void)pin;
|
|
(void)frequency;
|
|
(void)duration;
|
|
}
|
|
|
|
void RadioLibHal::noTone(uint32_t pin) {
|
|
(void)pin;
|
|
}
|
|
|
|
void RadioLibHal::yield() {
|
|
|
|
}
|
|
|
|
uint32_t RadioLibHal::pinToInterrupt(uint32_t pin) {
|
|
return(pin);
|
|
}
|
|
|
|
void RadioLibHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
|
|
// these are only needed for some protocols, so it's not needed to have them by default
|
|
(void)addr;
|
|
(void)buff;
|
|
(void)len;
|
|
}
|
|
|
|
void RadioLibHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
|
|
// these are only needed for some protocols, so it's not needed to have them by default
|
|
(void)addr;
|
|
(void)buff;
|
|
(void)len;
|
|
}
|
|
|
|
void RadioLibHal::wipePersistentStorage() {
|
|
uint8_t dummy = 0;
|
|
for(size_t i = 0; i < RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE; i++) {
|
|
this->writePersistentStorage(RADIOLIB_HAL_PERSISTENT_STORAGE_BASE + i, &dummy, sizeof(uint8_t));
|
|
}
|
|
}
|
|
|
|
uint32_t RadioLibHal::getPersistentAddr(uint32_t id) {
|
|
return(RadioLibPersistentParamTable[id]);
|
|
}
|
|
|
|
template<typename T>
|
|
void RadioLibHal::setPersistentParameter(uint32_t id, T val, uint32_t offset) {
|
|
uint8_t *ptr = (uint8_t*)&val;
|
|
this->writePersistentStorage(RADIOLIB_HAL_PERSISTENT_STORAGE_BASE + RadioLibPersistentParamTable[id] + offset, ptr, sizeof(T));
|
|
}
|
|
|
|
template void RadioLibHal::setPersistentParameter(uint32_t id, uint8_t val, uint32_t offset);
|
|
template void RadioLibHal::setPersistentParameter(uint32_t id, uint16_t val, uint32_t offset);
|
|
template void RadioLibHal::setPersistentParameter(uint32_t id, uint32_t val, uint32_t offset);
|
|
|
|
template<typename T>
|
|
T RadioLibHal::getPersistentParameter(uint32_t id) {
|
|
T val = 0;
|
|
uint8_t *ptr = (uint8_t*)&val;
|
|
this->readPersistentStorage(RADIOLIB_HAL_PERSISTENT_STORAGE_BASE + RadioLibPersistentParamTable[id], ptr, sizeof(T));
|
|
return(val);
|
|
}
|
|
|
|
template uint8_t RadioLibHal::getPersistentParameter(uint32_t id);
|
|
template uint16_t RadioLibHal::getPersistentParameter(uint32_t id);
|
|
template uint32_t RadioLibHal::getPersistentParameter(uint32_t id);
|