AP_HAL: RCOutput: add methods to allow grouping writes

This commit is contained in:
Lucas De Marchi 2015-09-28 17:19:08 -03:00 committed by Andrew Tridgell
parent ddb8e67954
commit fb643fbb53

View File

@ -43,9 +43,31 @@ public:
virtual void enable_ch(uint8_t ch) = 0;
virtual void disable_ch(uint8_t ch) = 0;
/* Output a single channel */
/*
* Output a single channel, possibly grouped with previous writes if
* cork() has been called before.
*/
virtual void write(uint8_t ch, uint16_t period_us) = 0;
/*
* Delay subsequent calls to write() going to the underlying hardware in
* order to group related writes together. When all the needed writes are
* done, call push() to commit the changes.
*
* This method is optional: if the subclass doesn't implement it all calls
* to write() are synchronous.
*/
virtual void cork() { }
/*
* Push pending changes to the underlying hardware. All changes between a
* call to cork() and push() are pushed together in a single transaction.
*
* This method is optional: if the subclass doesn't implement it all calls
* to write() are synchronous.
*/
virtual void push() { }
/* Read back current output state, as either single channel or
* array of channels. */
virtual uint16_t read(uint8_t ch) = 0;