HAL_Linux: implement cork()/push() for Raspilot

This commit is contained in:
Andrew Tridgell 2016-10-12 09:27:56 +11:00
parent 1d6e4673da
commit 0640b6539c
2 changed files with 14 additions and 1 deletions

View File

@ -95,7 +95,7 @@ void RCOutput_Raspilot::_update(void)
{
int i;
if (AP_HAL::micros() - _last_update_timestamp < 10000) {
if (_corked || AP_HAL::micros() - _last_update_timestamp < 10000) {
return;
}
@ -141,4 +141,14 @@ void RCOutput_Raspilot::_update(void)
_dev->get_semaphore()->give();
}
void RCOutput_Raspilot::cork(void)
{
_corked = true;
}
void RCOutput_Raspilot::push(void)
{
_corked = false;
}
#endif // CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_RASPILOT

View File

@ -15,6 +15,8 @@ public:
void write(uint8_t ch, uint16_t period_us);
uint16_t read(uint8_t ch);
void read(uint16_t* period_us, uint8_t len);
void cork(void) override;
void push(void) override;
private:
void reset();
@ -25,6 +27,7 @@ private:
uint32_t _last_update_timestamp;
uint16_t _frequency;
uint16_t _period_us[8];
bool _corked;
};
}