Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Tridgell 2120913ac2 AP_HAL: added ObjectArray template
this is a ring buffer that supports indexing for efficient handling of
queue peeking and manipulation
2016-02-24 09:18:06 +11:00
Tom Pittenger 9718ee23d1 AP_HAL: fix peekbytes casting 2016-02-24 09:18:06 +11:00
Andrew Tridgell 1df2512935 AP_HAL: added update() method for object ringbuffer
to support updating objects for GCS work Tom is doing
2016-02-23 16:34:06 +11:00
Tom Pittenger 1d528d552f AP_HAL: rename RingBuffer.force() to RingBuffer.push_force() 2016-02-21 22:13:27 -08:00
Andrew Tridgell 4ff396dfa8 AP_HAL: added force() and peek() method for object ringbuffers 2016-02-22 12:34:32 +11:00
Lucas De Marchi 97022a4161 AP_HAL: RingBuffer: fix macro expansion
Fix warning that reveals a real bug:

In file included from libraries/AP_HAL_Linux/UARTDriver.cpp:25:0:
libraries/AP_HAL_Linux/UARTDriver.cpp: In member function 'virtual bool Linux::UARTDriver::tx_pending()':
libraries/AP_HAL/utility/RingBuffer.h:21:35: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
 #define BUF_EMPTY(buf) buf##_head == buf##_tail
                                   ^
libraries/AP_HAL_Linux/UARTDriver.cpp:355:13: note: in expansion of macro 'BUF_EMPTY'
     return !BUF_EMPTY(_writebuf);

The problem is when there's a ! operator: without the parenthesis we would actually be doing

    return !_write_buf_head == _write_buf_tail

which is not what we want.
2015-12-28 21:50:27 -02:00
Andrew Tridgell 7c431b40f2 AP_HAL: enable HAL_QURT 2015-12-27 16:21:25 +11:00
Andrew Tridgell ec6a679482 AP_HAL: added ByteBuffer and ObjectBuffer in RingBuffer
much better API than old macros
2015-12-20 07:33:54 +11:00
Andrew Tridgell 6fb00f4fc3 AP_HAL: create a common utility/RingBuffer.h header 2015-01-07 08:41:14 +11:00