2012-11-28 21:53:15 -04:00
|
|
|
|
2013-01-02 20:32:37 -04:00
|
|
|
#ifndef __AP_HAL_AVR_SEMAPHORES_H__
|
|
|
|
#define __AP_HAL_AVR_SEMAPHORES_H__
|
2012-11-28 21:53:15 -04:00
|
|
|
|
|
|
|
#include <AP_HAL.h>
|
|
|
|
#include <AP_HAL_AVR_Namespace.h>
|
|
|
|
|
|
|
|
class AP_HAL_AVR::AVRSemaphore : public AP_HAL::Semaphore {
|
|
|
|
public:
|
|
|
|
AVRSemaphore();
|
|
|
|
|
2013-01-02 20:32:37 -04:00
|
|
|
bool give();
|
|
|
|
bool take(uint32_t timeout_ms);
|
|
|
|
bool take_nonblocking();
|
2012-11-28 21:53:15 -04:00
|
|
|
|
|
|
|
protected:
|
2013-01-02 20:32:37 -04:00
|
|
|
bool _take_from_mainloop(uint32_t timeout_ms);
|
|
|
|
bool _take_nonblocking();
|
2012-11-28 21:53:15 -04:00
|
|
|
|
2013-01-09 05:33:37 -04:00
|
|
|
volatile bool _taken;
|
2012-11-28 21:53:15 -04:00
|
|
|
};
|
|
|
|
|
2013-01-02 20:32:37 -04:00
|
|
|
#endif // __AP_HAL_AVR_SEMAPHORES_H__
|