[SX126x] Added public method to set PA ramp time (#1054)

pull/1057/head
jgromes 2024-04-05 17:30:05 +02:00
rodzic 263f7883cf
commit f61be0d273
6 zmienionych plików z 24 dodań i 11 usunięć

Wyświetl plik

@ -225,6 +225,7 @@ spectralScanStart KEYWORD2
spectralScanAbort KEYWORD2
spectralScanGetStatus KEYWORD2
spectralScanGetResult KEYWORD2
setPaRampTime KEYWORD2
# nRF24
setIrqAction KEYWORD2

Wyświetl plik

@ -17,9 +17,8 @@ int16_t SX1261::setOutputPower(int8_t power) {
state = SX126x::setPaConfig(0x04, RADIOLIB_SX126X_PA_CONFIG_SX1261, 0x00);
RADIOLIB_ASSERT(state);
// set output power
/// \todo power ramp time configuration
state = SX126x::setTxParams(power);
// set output power with default 200us ramp
state = SX126x::setTxParams(power, RADIOLIB_SX126X_PA_RAMP_200U);
RADIOLIB_ASSERT(state);
// restore OCP configuration

Wyświetl plik

@ -109,9 +109,8 @@ int16_t SX1262::setOutputPower(int8_t power) {
state = SX126x::setPaConfig(0x04, RADIOLIB_SX126X_PA_CONFIG_SX1262);
RADIOLIB_ASSERT(state);
// set output power
/// \todo power ramp time configuration
state = SX126x::setTxParams(power);
// set output power with default 200us ramp
state = SX126x::setTxParams(power, RADIOLIB_SX126X_PA_RAMP_200U);
RADIOLIB_ASSERT(state);
// restore OCP configuration

Wyświetl plik

@ -104,9 +104,8 @@ int16_t SX1268::setOutputPower(int8_t power) {
state = SX126x::setPaConfig(0x04, RADIOLIB_SX126X_PA_CONFIG_SX1268);
RADIOLIB_ASSERT(state);
// set output power
/// \todo power ramp time configuration
state = SX126x::setTxParams(power);
// set output power with default 200us ramp
state = SX126x::setTxParams(power, RADIOLIB_SX126X_PA_RAMP_200U);
RADIOLIB_ASSERT(state);
// restore OCP configuration

Wyświetl plik

@ -1847,6 +1847,10 @@ int16_t SX126x::calibrateImageRejection(float freqMin, float freqMax) {
return(this->calibrateImage(data));
}
int16_t SX126x::setPaRampTime(uint8_t rampTime) {
return(this->setTxParams(this->pwr, rampTime));
}
int16_t SX126x::calibrateImage(uint8_t* data) {
int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_CALIBRATE_IMAGE, data, 2);
@ -1870,7 +1874,11 @@ uint8_t SX126x::getPacketType() {
int16_t SX126x::setTxParams(uint8_t pwr, uint8_t rampTime) {
uint8_t data[] = { pwr, rampTime };
return(this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_TX_PARAMS, data, 2));
int16_t state = this->mod->SPIwriteStream(RADIOLIB_SX126X_CMD_SET_TX_PARAMS, data, 2);
if(state == RADIOLIB_ERR_NONE) {
this->pwr = pwr;
}
return(state);
}
int16_t SX126x::setPacketMode(uint8_t mode, uint8_t len) {

Wyświetl plik

@ -1123,6 +1123,12 @@ class SX126x: public PhysicalLayer {
*/
int16_t calibrateImageRejection(float freqMin, float freqMax);
/*!
\brief Set PA ramp-up time. Set to 200us by default.
\returns \ref status_codes
*/
int16_t setPaRampTime(uint8_t rampTime);
#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL
protected:
#endif
@ -1142,7 +1148,7 @@ class SX126x: public PhysicalLayer {
int16_t setRfFrequency(uint32_t frf);
int16_t calibrateImage(uint8_t* data);
uint8_t getPacketType();
int16_t setTxParams(uint8_t power, uint8_t rampTime = RADIOLIB_SX126X_PA_RAMP_200U);
int16_t setTxParams(uint8_t power, uint8_t rampTime);
int16_t setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro);
int16_t setModulationParamsFSK(uint32_t br, uint8_t sh, uint8_t rxBw, uint32_t freqDev);
int16_t setPacketParams(uint16_t preambleLen, uint8_t crcType, uint8_t payloadLen, uint8_t hdrType, uint8_t invertIQ);
@ -1187,6 +1193,7 @@ class SX126x: public PhysicalLayer {
float dataRateMeasured = 0;
uint32_t tcxoDelay = 0;
uint8_t pwr = 0;
size_t implicitLen = 0;
uint8_t invertIQEnabled = RADIOLIB_SX126X_LORA_IQ_STANDARD;