-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function to set DIO2 of SX126x chips to be used as RF antenna switch #17
Conversation
…tch (based on example design of Semtech and used in many modules). This breaks the CAD function as DIO2 cannot be used as IRQ output. Signed-off-by: Bernd Giesecke <[email protected]>
Tested on two modules
TODO |
Also, I don't think it't a good idea to use DIO3 for CAD timeout. DIO3 must be used on some modules for TCXO control. If RF control on DIO2 is enabled, CAD should be disabled entirely. |
Testing the changes right now. Function moved to SX126x.cpp, memory leak removed, simplified, removed unnecessary functions. Question before I push the changes. Do you want a new error value for scanChannel() if DIO2 is used for RF antenna switch? |
Since that's quite a unique error, I think a new status code is a good idea. It should have the value -708. |
/*!
\brief SX126x scan channel not possible because DIO2 is used as RF antenna switch.
*/
#define ERR_DIO2_UNAVAIL_CAD_FAILED -708 and int16_t SX126x::scanChannel() {
// check active modem
if(getPacketType() != SX126X_PACKET_TYPE_LORA) {
return(ERR_WRONG_MODEM);
}
if (_dio2RfSwitch) {
// If DIO2 is used as RF switch this function does not work
return(ERR_DIO2_UNAVAIL_CAD_FAILED);
}
... |
Added new error code Removed memory leak Signed-off-by: Bernd Giesecke <[email protected]>
Signed-off-by: Bernd Giesecke <[email protected]>
…, size_t minBytes)``` Signed-off-by: Bernd Giesecke <[email protected]>
Should be ok now. Another thing, I get a compile error on ESP8266 module using PlatformIO. I am not compiling for ESP8266 or including ESP8266.h from the lib (but it is included in RadioLib.h)!
The cause is that in ESP8266.h the function is declared as size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10); but in ESP8266.cpp the function is set as uint16_t ESP8266::getNumBytes(uint32_t timeout, size_t minBytes) { Will include it in this commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're almost done here. Could you also add a new keyword to keywords.txt? Please use tab to separate the keyword and the type (i.e. actual tab, not spaces).
Signed-off-by: Bernd Giesecke <[email protected]>
Signed-off-by: Bernd Giesecke <[email protected]>
Signed-off-by: Bernd Giesecke <[email protected]>
All looks good now. Thanks! |
Add function to set DIO2 of SX126x chips to be used as RF antenna switch.
Based on example design of Semtech and used in many modules.
This breaks the CAD function as DIO2 cannot be used as IRQ output.
Signed-off-by: Bernd Giesecke [email protected]