AP_CANManager: reimplement with BinarySemaphore

This commit is contained in:
Andrew Tridgell 2023-12-30 08:32:20 +11:00
parent 5d1eb145cd
commit e22e07fbbd
4 changed files with 5 additions and 5 deletions

View File

@ -127,7 +127,7 @@ bool CANSensor::add_interface(AP_HAL::CANIface* can_iface)
return false; return false;
} }
if (!_can_iface->set_event_handle(&_event_handle)) { if (!_can_iface->set_event_handle(&sem_handle)) {
debug_can(AP_CANManager::LOG_ERROR, "Cannot add event handle"); debug_can(AP_CANManager::LOG_ERROR, "Cannot add event handle");
return false; return false;
} }

View File

@ -77,7 +77,7 @@ private:
bool is_aux_11bit_driver; bool is_aux_11bit_driver;
AP_CANDriver *_can_driver; AP_CANDriver *_can_driver;
HAL_EventHandle _event_handle; HAL_BinarySemaphore sem_handle;
AP_HAL::CANIface* _can_iface; AP_HAL::CANIface* _can_iface;
#ifdef HAL_BUILD_AP_PERIPH #ifdef HAL_BUILD_AP_PERIPH

View File

@ -561,11 +561,11 @@ void SLCAN::CANIface::update_slcan_port()
} }
} }
bool SLCAN::CANIface::set_event_handle(AP_HAL::EventHandle* evt_handle) bool SLCAN::CANIface::set_event_handle(AP_HAL::BinarySemaphore *sem_handle)
{ {
// When in passthrough mode methods is handled through can iface // When in passthrough mode methods is handled through can iface
if (_can_iface) { if (_can_iface) {
return _can_iface->set_event_handle(evt_handle); return _can_iface->set_event_handle(sem_handle);
} }
return false; return false;
} }

View File

@ -111,7 +111,7 @@ public:
void reset_params(); void reset_params();
// Overriden methods // Overriden methods
bool set_event_handle(AP_HAL::EventHandle* evt_handle) override; bool set_event_handle(AP_HAL::BinarySemaphore *sem_handle) override;
uint16_t getNumFilters() const override; uint16_t getNumFilters() const override;
uint32_t getErrorCount() const override; uint32_t getErrorCount() const override;
void get_stats(ExpandingString &) override; void get_stats(ExpandingString &) override;