DataFlash: use common RingBuffer.h

This commit is contained in:
Andrew Tridgell 2015-01-07 08:09:35 +11:00
parent 9d3a9c20a8
commit 2ddf3e728a
1 changed files with 1 additions and 10 deletions

View File

@ -24,6 +24,7 @@
#include <stdio.h>
#include <time.h>
#include <dirent.h>
#include "../AP_HAL/utility/RingBuffer.h"
extern const AP_HAL::HAL& hal;
@ -183,16 +184,6 @@ void DataFlash_File::EraseAll()
}
}
/*
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
/* Write a block of data at current offset */
void DataFlash_File::WriteBlock(const void *pBuffer, uint16_t size)
{