Implemented TX PA Clamping, datasheet section 15.2
This commit is contained in:
parent
fc27b5a427
commit
078641d64d
2 changed files with 20 additions and 2 deletions
|
@ -22,6 +22,11 @@ int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint16_t syn
|
|||
return(state);
|
||||
}
|
||||
|
||||
state = fixPaClamping();
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
@ -110,3 +115,13 @@ int16_t SX1262::setOutputPower(int8_t power) {
|
|||
// restore OCP configuration
|
||||
return(writeRegister(SX126X_REG_OCP_CONFIGURATION, &ocp, 1));
|
||||
}
|
||||
|
||||
int16_t SX1262::fixPaClamping() {
|
||||
uint8_t clampConfig;
|
||||
uint16_t state = readRegister(SX126X_REG_TX_CLAMP_CONFIG, &clampConfig, 1);
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
clampConfig |= 0x1E;
|
||||
return writeRegister(SX126X_REG_TX_CLAMP_CONFIG, &clampConfig, 1);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//SX126X_CMD_SET_PA_CONFIG
|
||||
#define SX126X_PA_CONFIG_SX1261 0x01
|
||||
#define SX126X_PA_CONFIG_SX1262 0x00
|
||||
#define SX126X_REG_TX_CLAMP_CONFIG 0x08D8 //Datasheet 15.2
|
||||
|
||||
/*!
|
||||
\class SX1262
|
||||
|
@ -94,8 +95,10 @@ class SX1262: public SX126x {
|
|||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
/*!
|
||||
\brief Fixes overly eager PA clamping, as described in section 15.2 of the datasheet
|
||||
*/
|
||||
int16_t fixPaClamping();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue