mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 08:38:36 -04:00
AP_BoardConfig: added support for Piccolo CAN ESCs
This commit is contained in:
parent
2e0d2e2db0
commit
7c3391d0d8
@ -36,6 +36,8 @@
|
||||
#include <AP_KDECAN/AP_KDECAN.h>
|
||||
#include <AP_ToshibaCAN/AP_ToshibaCAN.h>
|
||||
#include <AP_SerialManager/AP_SerialManager.h>
|
||||
#include <AP_PiccoloCAN/AP_PiccoloCAN.h>
|
||||
|
||||
extern const AP_HAL::HAL& hal;
|
||||
|
||||
// table of user settable parameters
|
||||
@ -174,6 +176,15 @@ void AP_BoardConfig_CAN::init()
|
||||
AP_BoardConfig::config_error("ToshibaCAN init failed");
|
||||
continue;
|
||||
}
|
||||
#if HAL_PICCOLO_CAN_ENABLE
|
||||
} else if (prot_type == Protocol_Type_PiccoloCAN) {
|
||||
_drivers[i]._driver = _drivers[i]._pcan = new AP_PiccoloCAN;
|
||||
|
||||
if (_drivers[i]._driver == nullptr) {
|
||||
AP_BoardConfig::config_error("PiccoloCAN init failed");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ public:
|
||||
Protocol_Type_None = 0,
|
||||
Protocol_Type_UAVCAN = 1,
|
||||
Protocol_Type_KDECAN = 2,
|
||||
Protocol_Type_ToshibaCAN = 3
|
||||
Protocol_Type_ToshibaCAN = 3,
|
||||
Protocol_Type_PiccoloCAN = 4,
|
||||
};
|
||||
|
||||
void init(void);
|
||||
@ -126,9 +127,10 @@ private:
|
||||
AP_Int8 _protocol_type;
|
||||
Protocol_Type _protocol_type_cache;
|
||||
AP_HAL::CANProtocol* _driver;
|
||||
AP_HAL::CANProtocol* _uavcan;
|
||||
AP_HAL::CANProtocol* _kdecan;
|
||||
AP_HAL::CANProtocol* _tcan;
|
||||
AP_HAL::CANProtocol* _uavcan; // UAVCAN
|
||||
AP_HAL::CANProtocol* _kdecan; // KDECAN
|
||||
AP_HAL::CANProtocol* _tcan; // ToshibaCAN
|
||||
AP_HAL::CANProtocol* _pcan; // PiccoloCAN
|
||||
};
|
||||
|
||||
#if AP_UAVCAN_SLCAN_ENABLED
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <AP_UAVCAN/AP_UAVCAN.h>
|
||||
#include <AP_ToshibaCAN/AP_ToshibaCAN.h>
|
||||
#include <AP_PiccoloCAN/AP_PiccoloCAN.h>
|
||||
|
||||
// To be replaced with macro saying if KDECAN library is included
|
||||
#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub)
|
||||
@ -32,8 +33,8 @@ const AP_Param::GroupInfo AP_BoardConfig_CAN::Driver::var_info[] = {
|
||||
// @Param: PROTOCOL
|
||||
// @DisplayName: Enable use of specific protocol over virtual driver
|
||||
// @Description: Enabling this option starts selected protocol that will use this virtual driver
|
||||
// @Values{Copter,Plane,Sub}: 0:Disabled,1:UAVCAN,2:KDECAN,3:ToshibaCAN
|
||||
// @Values: 0:Disabled,1:UAVCAN,3:ToshibaCAN
|
||||
// @Values{Copter,Plane,Sub}: 0:Disabled,1:UAVCAN,2:KDECAN,3:ToshibaCAN,4:PiccoloCAN
|
||||
// @Values: 0:Disabled,1:UAVCAN,3:ToshibaCAN,4:PiccoloCAN
|
||||
// @User: Advanced
|
||||
// @RebootRequired: True
|
||||
AP_GROUPINFO("PROTOCOL", 1, AP_BoardConfig_CAN::Driver, _protocol_type, AP_BoardConfig_CAN::Protocol_Type_UAVCAN),
|
||||
|
Loading…
Reference in New Issue
Block a user