mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-21 16:18:29 -04:00
AP_CANSensor: add get_driver_type() accessor
This commit is contained in:
parent
9cf5759435
commit
84b7444047
@ -40,11 +40,22 @@ public:
|
||||
|
||||
#ifdef HAL_BUILD_AP_PERIPH
|
||||
static void set_periph(const uint8_t i, const AP_CANManager::Driver_Type protocol, AP_HAL::CANIface* iface) {
|
||||
if (i < HAL_NUM_CAN_IFACES) {
|
||||
if (i < ARRAY_SIZE(_periph)) {
|
||||
_periph[i].protocol = protocol;
|
||||
_periph[i].iface = iface;
|
||||
}
|
||||
}
|
||||
|
||||
// return driver type index i
|
||||
static AP_CANManager::Driver_Type get_driver_type(const uint8_t i)
|
||||
{
|
||||
if (i < ARRAY_SIZE(_periph)) {
|
||||
return _periph[i].protocol;
|
||||
}
|
||||
return AP_CANManager::Driver_Type_None;
|
||||
}
|
||||
#else
|
||||
static AP_CANManager::Driver_Type get_driver_type(const uint8_t i) { return AP::can().get_driver_type(i); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user