[PHY] Implemented more common methods

pull/792/head
jgromes 2023-07-06 11:10:20 +02:00
rodzic 47f9ab8463
commit 91787eb269
2 zmienionych plików z 80 dodań i 0 usunięć

Wyświetl plik

@ -246,6 +246,32 @@ int16_t PhysicalLayer::setEncoding(uint8_t encoding) {
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::invertIQ(bool enable) {
(void)enable;
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::setOutputPower(int8_t power) {
(void)power;
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::setSyncWord(uint8_t* sync, size_t len) {
(void)sync;
(void)len;
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::setPreambleLength(size_t len) {
(void)len;
return(RADIOLIB_ERR_UNSUPPORTED);
}
int16_t PhysicalLayer::setDataRate(DataRate_t dr) {
(void)dr;
return(RADIOLIB_ERR_UNSUPPORTED);
}
float PhysicalLayer::getFreqStep() const {
return(this->freqStep);
}

Wyświetl plik

@ -4,6 +4,24 @@
#include "../../TypeDef.h"
#include "../../Module.h"
// data rate structure interpretation in case LoRa is used
struct LoRaRate_t {
uint8_t spreadingFactor;
float bandwidth;
};
// data rate structure interpretation in case FSK is used
struct FSKRate_t {
float bitRate;
float freqDev;
};
// common data rate
union DataRate_t {
LoRaRate_t lora;
FSKRate_t fsk;
};
/*!
\class PhysicalLayer
@ -223,6 +241,42 @@ class PhysicalLayer {
*/
virtual int16_t setEncoding(uint8_t encoding);
/*!
\brief Set IQ inversion. Must be implemented in module class if the module supports it.
\param enable True to use inverted IQ, false for non-inverted.
\returns \ref status_codes
*/
virtual int16_t invertIQ(bool enable);
/*!
\brief Set output power. Must be implemented in module class if the module supports it.
\param power Output power in dBm. The allowed range depends on the module used.
\returns \ref status_codes
*/
virtual int16_t setOutputPower(int8_t power);
/*!
\brief Set sync word. Must be implemented in module class if the module supports it.
\param sync Pointer to the sync word.
\param len Sync word length in bytes. Maximum length depends on the module used.
\returns \ref status_codes
*/
virtual int16_t setSyncWord(uint8_t* sync, size_t len);
/*!
\brief Set preamble length. Must be implemented in module class if the module supports it.
\param len Preamble length in bytes. Maximum length depends on the module used.
\returns \ref status_codes
*/
virtual int16_t setPreambleLength(size_t len);
/*!
\brief Set data. Must be implemented in module class if the module supports it.
\param dr Data rate struct. Interpretation depends on currently active modem (FSK or LoRa).
\returns \ref status_codes
*/
virtual int16_t setDataRate(DataRate_t dr);
/*!
\brief Gets the module frequency step size that was set in constructor.
\returns Synthesizer frequency step size in Hz.