mirror of https://github.com/ArduPilot/ardupilot
AP_GPS: use WITH_SEMAPHORE()
and removed usage of hal.util->new_semaphore()
This commit is contained in:
parent
a260792e9e
commit
249291eac0
|
@ -36,7 +36,7 @@ UC_REGISTRY_BINDER(FixCb, uavcan::equipment::gnss::Fix);
|
|||
UC_REGISTRY_BINDER(AuxCb, uavcan::equipment::gnss::Auxiliary);
|
||||
|
||||
AP_GPS_UAVCAN::DetectedModules AP_GPS_UAVCAN::_detected_modules[] = {0};
|
||||
AP_HAL::Semaphore* AP_GPS_UAVCAN::_sem_registry = nullptr;
|
||||
HAL_Semaphore AP_GPS_UAVCAN::_sem_registry;
|
||||
|
||||
// Member Methods
|
||||
AP_GPS_UAVCAN::AP_GPS_UAVCAN(AP_GPS &_gps, AP_GPS::GPS_State &_state) :
|
||||
|
@ -78,15 +78,12 @@ void AP_GPS_UAVCAN::subscribe_msgs(AP_UAVCAN* ap_uavcan)
|
|||
|
||||
bool AP_GPS_UAVCAN::take_registry()
|
||||
{
|
||||
if (_sem_registry == nullptr) {
|
||||
_sem_registry = hal.util->new_semaphore();
|
||||
}
|
||||
return _sem_registry->take(HAL_SEMAPHORE_BLOCK_FOREVER);
|
||||
return _sem_registry.take(HAL_SEMAPHORE_BLOCK_FOREVER);
|
||||
}
|
||||
|
||||
void AP_GPS_UAVCAN::give_registry()
|
||||
{
|
||||
_sem_registry->give();
|
||||
_sem_registry.give();
|
||||
}
|
||||
|
||||
AP_GPS_Backend* AP_GPS_UAVCAN::probe(AP_GPS &_gps, AP_GPS::GPS_State &_state)
|
||||
|
|
|
@ -65,5 +65,5 @@ private:
|
|||
AP_GPS_UAVCAN* driver;
|
||||
} _detected_modules[GPS_MAX_RECEIVERS];
|
||||
|
||||
static AP_HAL::Semaphore *_sem_registry;
|
||||
static HAL_Semaphore _sem_registry;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue