AP_RCProtocol: add and use AP_RCPROTOCOL_CRSF_ENABLED

This commit is contained in:
Peter Barker 2023-04-26 23:46:08 +10:00 committed by Peter Barker
parent dd549ee625
commit 6535bfa546
5 changed files with 24 additions and 1 deletions

View File

@ -51,7 +51,9 @@ void AP_RCProtocol::init()
#if AP_RCPROTOCOL_SRXL2_ENABLED #if AP_RCPROTOCOL_SRXL2_ENABLED
backend[AP_RCProtocol::SRXL2] = new AP_RCProtocol_SRXL2(*this); backend[AP_RCProtocol::SRXL2] = new AP_RCProtocol_SRXL2(*this);
#endif #endif
#if AP_RCPROTOCOL_CRSF_ENABLED
backend[AP_RCProtocol::CRSF] = new AP_RCProtocol_CRSF(*this); backend[AP_RCProtocol::CRSF] = new AP_RCProtocol_CRSF(*this);
#endif
#if AP_RCPROTOCOL_FPORT2_ENABLED #if AP_RCPROTOCOL_FPORT2_ENABLED
backend[AP_RCProtocol::FPORT2] = new AP_RCProtocol_FPort2(*this, true); backend[AP_RCProtocol::FPORT2] = new AP_RCProtocol_FPort2(*this, true);
#endif #endif
@ -430,8 +432,10 @@ const char *AP_RCProtocol::protocol_name_from_protocol(rcprotocol_t protocol)
case SRXL2: case SRXL2:
return "SRXL2"; return "SRXL2";
#endif #endif
#if AP_RCPROTOCOL_CRSF_ENABLED
case CRSF: case CRSF:
return "CRSF"; return "CRSF";
#endif
case ST24: case ST24:
return "ST24"; return "ST24";
#if AP_RCPROTOCOL_FPORT_ENABLED #if AP_RCPROTOCOL_FPORT_ENABLED

View File

@ -45,7 +45,9 @@ public:
#if AP_RCPROTOCOL_SRXL2_ENABLED #if AP_RCPROTOCOL_SRXL2_ENABLED
SRXL2 = 7, SRXL2 = 7,
#endif #endif
#if AP_RCPROTOCOL_CRSF_ENABLED
CRSF = 8, CRSF = 8,
#endif
ST24 = 9, ST24 = 9,
#if AP_RCPROTOCOL_FPORT_ENABLED #if AP_RCPROTOCOL_FPORT_ENABLED
FPORT = 10, FPORT = 10,
@ -97,7 +99,9 @@ public:
#if AP_RCPROTOCOL_FPORT2_ENABLED #if AP_RCPROTOCOL_FPORT2_ENABLED
case FPORT2: case FPORT2:
#endif #endif
#if AP_RCPROTOCOL_CRSF_ENABLED
case CRSF: case CRSF:
#endif
return true; return true;
case IBUS: case IBUS:
case SUMD: case SUMD:

View File

@ -17,8 +17,11 @@
Code by Andy Piper Code by Andy Piper
*/ */
#include "AP_RCProtocol_config.h"
#if AP_RCPROTOCOL_CRSF_ENABLED
#include "AP_RCProtocol.h" #include "AP_RCProtocol.h"
#include "AP_RCProtocol_SRXL.h"
#include "AP_RCProtocol_CRSF.h" #include "AP_RCProtocol_CRSF.h"
#include <AP_HAL/AP_HAL.h> #include <AP_HAL/AP_HAL.h>
#include <AP_Math/AP_Math.h> #include <AP_Math/AP_Math.h>
@ -629,3 +632,5 @@ namespace AP {
return AP_RCProtocol_CRSF::get_singleton(); return AP_RCProtocol_CRSF::get_singleton();
} }
}; };
#endif // AP_RCPROTOCOL_CRSF_ENABLED

View File

@ -18,6 +18,10 @@
*/ */
#pragma once #pragma once
#include "AP_RCProtocol_config.h"
#if AP_RCPROTOCOL_CRSF_ENABLED
#include "AP_RCProtocol.h" #include "AP_RCProtocol.h"
#include <AP_Math/AP_Math.h> #include <AP_Math/AP_Math.h>
#include <RC_Channel/RC_Channel.h> #include <RC_Channel/RC_Channel.h>
@ -332,3 +336,5 @@ private:
namespace AP { namespace AP {
AP_RCProtocol_CRSF* crsf(); AP_RCProtocol_CRSF* crsf();
}; };
#endif // AP_RCPROTOCOL_CRSF_ENABLED

View File

@ -7,6 +7,10 @@
#define AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED 1 #define AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED 1
#endif #endif
#ifndef AP_RCPROTOCOL_CRSF_ENABLED
#define AP_RCPROTOCOL_CRSF_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif
#ifndef AP_RCPROTOCOL_FASTSBUS_ENABLED #ifndef AP_RCPROTOCOL_FASTSBUS_ENABLED
#define AP_RCPROTOCOL_FASTSBUS_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED #define AP_RCPROTOCOL_FASTSBUS_ENABLED AP_RCPROTOCOL_BACKEND_DEFAULT_ENABLED
#endif #endif