Browse Source

DataFlash: use common RingBuffer.h

master
Andrew Tridgell 10 years ago
parent
commit
2ddf3e728a
  1. 11
      libraries/DataFlash/DataFlash_File.cpp

11
libraries/DataFlash/DataFlash_File.cpp

@ -24,6 +24,7 @@ @@ -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() @@ -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)
{

Loading…
Cancel
Save