kopia lustrzana https://github.com/jgromes/RadioLib
Merge pull request #61 from BarryPSmith/sx1262_paclamping
Implemented TX PA Clamping, datasheet section 15.2pull/71/head
commit
3dc3c92b19
|
@ -22,6 +22,11 @@ int16_t SX1262::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint16_t syn
|
|||
return(state);
|
||||
}
|
||||
|
||||
state = SX126x::fixPaClamping();
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
@ -43,6 +48,11 @@ int16_t SX1262::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t
|
|||
return(state);
|
||||
}
|
||||
|
||||
state = SX126x::fixPaClamping();
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,6 @@ class SX1262: public SX126x {
|
|||
int16_t setOutputPower(int8_t power);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,11 @@ int16_t SX1268::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint16_t syn
|
|||
return(state);
|
||||
}
|
||||
|
||||
state = SX126x::fixPaClamping();
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
int16_t SX1268::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t power, float currentLimit, uint16_t preambleLength, float dataShaping) {
|
||||
|
@ -42,6 +47,11 @@ int16_t SX1268::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t
|
|||
return(state);
|
||||
}
|
||||
|
||||
state = SX126x::fixPaClamping();
|
||||
if (state != ERR_NONE) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -1199,6 +1199,16 @@ int16_t SX126x::setFrequencyRaw(float freq) {
|
|||
return(ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t SX126x::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);
|
||||
}
|
||||
|
||||
int16_t SX126x::config(uint8_t modem) {
|
||||
// set regulator mode
|
||||
uint8_t data[7];
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
#define SX126X_REG_OCP_CONFIGURATION 0x08E7
|
||||
#define SX126X_REG_XTA_TRIM 0x0911
|
||||
#define SX126X_REG_XTB_TRIM 0x0912
|
||||
#define SX126X_REG_TX_CLAMP_CONFIG 0x08D8 //Datasheet 15.2
|
||||
|
||||
|
||||
// SX126X SPI command variables
|
||||
|
@ -753,6 +754,10 @@ class SX126x: public PhysicalLayer {
|
|||
|
||||
int16_t setFrequencyRaw(float freq);
|
||||
|
||||
/*!
|
||||
\brief Fixes overly eager PA clamping on SX1262 / SX1268, as described in section 15.2 of the datasheet
|
||||
*/
|
||||
int16_t fixPaClamping();
|
||||
private:
|
||||
Module* _mod;
|
||||
|
||||
|
@ -769,6 +774,8 @@ class SX126x: public PhysicalLayer {
|
|||
|
||||
int16_t config(uint8_t modem);
|
||||
|
||||
|
||||
|
||||
// common low-level SPI interface
|
||||
int16_t SPIwriteCommand(uint8_t cmd, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
int16_t SPIwriteCommand(uint8_t* cmd, uint8_t cmdLen, uint8_t* data, uint8_t numBytes, bool waitForBusy = true);
|
||||
|
|
Ładowanie…
Reference in New Issue