mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-30 20:48:33 -04:00
AP_BoardConfig: add ToshibaCAN
This commit is contained in:
parent
b3b3385143
commit
a37c86af6e
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <AP_HAL/AP_HAL.h>
|
#include <AP_HAL/AP_HAL.h>
|
||||||
#include <AP_Common/AP_Common.h>
|
#include <AP_Common/AP_Common.h>
|
||||||
|
#include "AP_BoardConfig.h"
|
||||||
#include "AP_BoardConfig_CAN.h"
|
#include "AP_BoardConfig_CAN.h"
|
||||||
|
|
||||||
#if HAL_WITH_UAVCAN
|
#if HAL_WITH_UAVCAN
|
||||||
@ -39,6 +40,7 @@
|
|||||||
|
|
||||||
#include <AP_UAVCAN/AP_UAVCAN.h>
|
#include <AP_UAVCAN/AP_UAVCAN.h>
|
||||||
#include <AP_KDECAN/AP_KDECAN.h>
|
#include <AP_KDECAN/AP_KDECAN.h>
|
||||||
|
#include <AP_ToshibaCAN/AP_ToshibaCAN.h>
|
||||||
|
|
||||||
extern const AP_HAL::HAL& hal;
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
@ -160,6 +162,13 @@ void AP_BoardConfig_CAN::init()
|
|||||||
|
|
||||||
AP_Param::load_object_from_eeprom(_drivers[i]._kdecan, AP_KDECAN::var_info);
|
AP_Param::load_object_from_eeprom(_drivers[i]._kdecan, AP_KDECAN::var_info);
|
||||||
#endif
|
#endif
|
||||||
|
} else if (prot_type == Protocol_Type_ToshibaCAN) {
|
||||||
|
_drivers[i]._driver = _drivers[i]._tcan = new AP_ToshibaCAN;
|
||||||
|
|
||||||
|
if (_drivers[i]._driver == nullptr) {
|
||||||
|
AP_BoardConfig::sensor_config_error("ToshibaCAN init failed");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
Protocol_Type_None = 0,
|
Protocol_Type_None = 0,
|
||||||
Protocol_Type_UAVCAN = 1,
|
Protocol_Type_UAVCAN = 1,
|
||||||
Protocol_Type_KDECAN = 2,
|
Protocol_Type_KDECAN = 2,
|
||||||
|
Protocol_Type_ToshibaCAN = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
@ -123,6 +124,7 @@ private:
|
|||||||
AP_HAL::CANProtocol* _driver;
|
AP_HAL::CANProtocol* _driver;
|
||||||
AP_HAL::CANProtocol* _uavcan;
|
AP_HAL::CANProtocol* _uavcan;
|
||||||
AP_HAL::CANProtocol* _kdecan;
|
AP_HAL::CANProtocol* _kdecan;
|
||||||
|
AP_HAL::CANProtocol* _tcan;
|
||||||
};
|
};
|
||||||
|
|
||||||
Interface _interfaces[MAX_NUMBER_OF_CAN_INTERFACES];
|
Interface _interfaces[MAX_NUMBER_OF_CAN_INTERFACES];
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <AP_Vehicle/AP_Vehicle.h>
|
#include <AP_Vehicle/AP_Vehicle.h>
|
||||||
|
|
||||||
#include <AP_UAVCAN/AP_UAVCAN.h>
|
#include <AP_UAVCAN/AP_UAVCAN.h>
|
||||||
|
#include <AP_ToshibaCAN/AP_ToshibaCAN.h>
|
||||||
|
|
||||||
// To be replaced with macro saying if KDECAN library is included
|
// 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)
|
#if APM_BUILD_TYPE(APM_BUILD_ArduCopter) || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub)
|
||||||
@ -31,8 +32,8 @@ const AP_Param::GroupInfo AP_BoardConfig_CAN::Driver::var_info[] = {
|
|||||||
// @Param: PROTOCOL
|
// @Param: PROTOCOL
|
||||||
// @DisplayName: Enable use of specific protocol over virtual driver
|
// @DisplayName: Enable use of specific protocol over virtual driver
|
||||||
// @Description: Enabling this option starts selected protocol that will use this 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
|
// @Values{Copter,Plane,Sub}: 0:Disabled,1:UAVCAN,2:KDECAN,3:ToshibaCAN
|
||||||
// @Values: 0:Disabled,1:UAVCAN
|
// @Values: 0:Disabled,1:UAVCAN,3:ToshibaCAN
|
||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
// @RebootRequired: True
|
// @RebootRequired: True
|
||||||
AP_GROUPINFO("PROTOCOL", 1, AP_BoardConfig_CAN::Driver, _protocol_type, AP_BoardConfig_CAN::Protocol_Type_UAVCAN),
|
AP_GROUPINFO("PROTOCOL", 1, AP_BoardConfig_CAN::Driver, _protocol_type, AP_BoardConfig_CAN::Protocol_Type_UAVCAN),
|
||||||
|
Loading…
Reference in New Issue
Block a user