[LR1121] Added dedicated power setting function
This commit is contained in:
parent
aa56f62cdb
commit
b9cf1956e4
2 changed files with 49 additions and 0 deletions
|
@ -5,4 +5,44 @@ LR1121::LR1121(Module* mod) : LR1120(mod) {
|
|||
chipType = RADIOLIB_LR11X0_DEVICE_LR1121;
|
||||
}
|
||||
|
||||
int16_t LR1121::setOutputPower(int8_t power, bool useHighFreqPa)
|
||||
{
|
||||
|
||||
int16_t state = RADIOLIB_ERR_INVALID_OUTPUT_POWER;
|
||||
|
||||
if (useHighFreqPa) {
|
||||
if ((-18 <= power ) && ( power <= 13 )) {
|
||||
state = setPaConfig(0x02, // High-frequency Power Amplifier
|
||||
0x00, // Power amplifier supplied by the main regulator
|
||||
0x04, // Power Amplifier duty cycle (Default 0x04)
|
||||
0x07 // Number of slices for HPA (Default 0x07)
|
||||
);
|
||||
} else {
|
||||
return RADIOLIB_ERR_INVALID_OUTPUT_POWER;
|
||||
}
|
||||
} else {
|
||||
if (( -17 <= power ) && (power <= 22 )) {
|
||||
if (power == 22) {
|
||||
state = setPaConfig(0x01, // High-power Power Amplifier
|
||||
0x01, // Power amplifier supplied by the battery
|
||||
0x04, // Power Amplifier duty cycle (Default 0x04)
|
||||
0x07 // Number of slices for HPA (Default 0x07)
|
||||
);
|
||||
} else {
|
||||
state = setPaConfig(0x00, // Low-power Power Amplifier
|
||||
0x00, // Power amplifier supplied by the main regulator
|
||||
0x04, // Power Amplifier duty cycle (Default 0x04)
|
||||
0x07 // Number of slices for HPA (Default 0x07)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return RADIOLIB_ERR_INVALID_OUTPUT_POWER;
|
||||
}
|
||||
}
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set output power
|
||||
state = setTxParams(power, RADIOLIB_LR11X0_PA_RAMP_48U);
|
||||
return (state);
|
||||
}
|
||||
#endif
|
|
@ -21,6 +21,15 @@ class LR1121: public LR1120 {
|
|||
*/
|
||||
LR1121(Module* mod); // cppcheck-suppress noExplicitConstructor
|
||||
|
||||
/*!
|
||||
\brief Sets output power. Allowed values are in range from -17 to 22 dBm (high-power PA) or -18 to 13 dBm (High-frequency PA).
|
||||
\param power Output power to be set in dBm.
|
||||
\param useHighFreqPa When using 2.4G frequency, need to switch to High-frequency PA
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setOutputPower(int8_t power,bool useHighFreqPa = false);
|
||||
|
||||
|
||||
// TODO this is where overrides to disable GNSS+WiFi scanning methods on LR1121
|
||||
// will be put once those are implemented
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue