HAL_PX4: use common RingBuffer.h

This commit is contained in:
Andrew Tridgell 2015-01-07 08:09:14 +11:00
parent 4da0a24887
commit 0c73dc2440

View File

@ -16,6 +16,7 @@
#include <termios.h> #include <termios.h>
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <assert.h> #include <assert.h>
#include "../AP_HAL/utility/RingBuffer.h"
using namespace PX4; using namespace PX4;
@ -236,15 +237,6 @@ void PX4UARTDriver::set_blocking_writes(bool blocking)
bool PX4UARTDriver::tx_pending() { return false; } bool PX4UARTDriver::tx_pending() { return false; }
/*
buffer handling macros
*/
#define BUF_AVAILABLE(buf) ((buf##_head > (_tail=buf##_tail))? (buf##_size - buf##_head) + _tail: _tail - buf##_head)
#define BUF_SPACE(buf) (((_head=buf##_head) > buf##_tail)?(_head - buf##_tail) - 1:((buf##_size - buf##_tail) + _head) - 1)
#define BUF_EMPTY(buf) (buf##_head == buf##_tail)
#define BUF_ADVANCETAIL(buf, n) buf##_tail = (buf##_tail + n) % buf##_size
#define BUF_ADVANCEHEAD(buf, n) buf##_head = (buf##_head + n) % buf##_size
/* /*
return number of bytes available to be read from the buffer return number of bytes available to be read from the buffer
*/ */