mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 09:13:33 +08:00
STM32: Added basic OS abstraction (ChibiOS event), test app for this, minor changes in Makefile
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#include <uavcan_stm32/thread.hpp>
|
||||
|
||||
namespace uavcan_stm32
|
||||
{
|
||||
|
||||
#if UAVCAN_STM32_CHIBIOS
|
||||
|
||||
bool Event::wait(uavcan::MonotonicDuration duration)
|
||||
{
|
||||
msg_t ret = msg_t();
|
||||
if (duration.isZero())
|
||||
{
|
||||
sem_.waitTimeout(TIME_IMMEDIATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sem_.waitTimeout(US2ST(duration.toUSec()));
|
||||
}
|
||||
return ret == RDY_OK;
|
||||
}
|
||||
|
||||
void Event::signal()
|
||||
{
|
||||
sem_.signal();
|
||||
}
|
||||
|
||||
void Event::signalFromInterrupt()
|
||||
{
|
||||
sem_.signalI();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user