[SX126x] Added method to get currently configured OCP
This commit is contained in:
parent
f336922013
commit
ff97f3957b
3 changed files with 17 additions and 0 deletions
|
@ -125,6 +125,7 @@ startReceiveDutyCycle KEYWORD2
|
|||
startReceiveDutyCycleAuto KEYWORD2
|
||||
setRegulatorLDO KEYWORD2
|
||||
setRegulatorDCDC KEYWORD2
|
||||
getCurrentLimit KEYWORD2
|
||||
|
||||
# ESP8266
|
||||
join KEYWORD2
|
||||
|
|
|
@ -674,6 +674,15 @@ int16_t SX126x::setCurrentLimit(float currentLimit) {
|
|||
return(writeRegister(SX126X_REG_OCP_CONFIGURATION, &rawLimit, 1));
|
||||
}
|
||||
|
||||
float SX126x::getCurrentLimit() {
|
||||
// get the raw value
|
||||
uint8_t ocp = 0;
|
||||
readRegister(SX126X_REG_OCP_CONFIGURATION, &ocp, 1);
|
||||
|
||||
// return the actual value
|
||||
return((float)ocp * 2.5);
|
||||
}
|
||||
|
||||
int16_t SX126x::setPreambleLength(uint16_t preambleLength) {
|
||||
uint8_t modem = getPacketType();
|
||||
if(modem == SX126X_PACKET_TYPE_LORA) {
|
||||
|
|
|
@ -601,6 +601,13 @@ class SX126x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setCurrentLimit(float currentLimit);
|
||||
|
||||
/*!
|
||||
\brief Reads current protection limit.
|
||||
|
||||
\returns Currently configured overcurrent protection limit in mA.
|
||||
*/
|
||||
float getCurrentLimit();
|
||||
|
||||
/*!
|
||||
\brief Sets preamble length for LoRa or FSK modem. Allowed values range from 1 to 65535.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue