diff --git a/libraries/AP_Radio/AP_Radio_cc2500.cpp b/libraries/AP_Radio/AP_Radio_cc2500.cpp index 943ed107c0..999ed188f7 100644 --- a/libraries/AP_Radio/AP_Radio_cc2500.cpp +++ b/libraries/AP_Radio/AP_Radio_cc2500.cpp @@ -320,9 +320,7 @@ const uint16_t CRCTable[] = { bool AP_Radio_cc2500::probe(void) { auto dev = hal.spi->get_device("cc2500"); - if (!dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { - return false; - } + dev->get_semaphore()->take_blocking(); uint8_t r1=0, r2=0; if (!dev->read_registers(CC2500_30_PARTNUM | CC2500_READ_BURST | CC2500_READ_SINGLE, &r1, 1) || r1 != 0x80 || !dev->read_registers(CC2500_31_VERSION | CC2500_READ_BURST | CC2500_READ_SINGLE, &r2, 1) || r2 != 0x03) { diff --git a/libraries/AP_Radio/AP_Radio_cypress.cpp b/libraries/AP_Radio/AP_Radio_cypress.cpp index 8fc9c7e93c..a9f08f7375 100644 --- a/libraries/AP_Radio/AP_Radio_cypress.cpp +++ b/libraries/AP_Radio/AP_Radio_cypress.cpp @@ -282,9 +282,7 @@ bool AP_Radio_cypress::init(void) */ bool AP_Radio_cypress::reset(void) { - if (!dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { - return false; - } + dev->get_semaphore()->take_blocking(); /* to reset radio hold reset high for 0.5s, then low for 0.5s @@ -1439,10 +1437,7 @@ void AP_Radio_cypress::dsm_choose_channel(void) */ void AP_Radio_cypress::start_recv_bind(void) { - if (!dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { - // shouldn't be possible - return; - } + dev->get_semaphore()->take_blocking(); Debug(1, "Cypress: start_recv_bind\n"); diff --git a/libraries/AP_Radio/driver_bk2425.h b/libraries/AP_Radio/driver_bk2425.h index 9b43a10b41..a3a8eb3dfb 100644 --- a/libraries/AP_Radio/driver_bk2425.h +++ b/libraries/AP_Radio/driver_bk2425.h @@ -373,7 +373,7 @@ public: Radio_Beken(AP_HAL::OwnPtr _dev); bool lock_bus(void) { - return dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER); + return dev->get_semaphore()->take_blocking(); } void unlock_bus(void) { diff --git a/libraries/AP_Radio/driver_cc2500.h b/libraries/AP_Radio/driver_cc2500.h index ebd38b5832..aab834d917 100644 --- a/libraries/AP_Radio/driver_cc2500.h +++ b/libraries/AP_Radio/driver_cc2500.h @@ -157,7 +157,11 @@ public: bool lock_bus(void) { - return dev && dev->get_semaphore()->take(HAL_SEMAPHORE_BLOCK_FOREVER); + if (!dev) { + return false; + } + dev->get_semaphore()->take_blocking(); + return true; } void unlock_bus(void) {