#include <moduleBuf.h>
Public Member Functions | |
void | clear () |
Clear the buffer. Set used amount 0 but not head pointer. | |
void | display () |
uint16_t | getBufSize () |
Get the max size of buffer. | |
uint16_t | getBufUsedAmount () |
Get the used amount of buffer. | |
ModuleBuf (uint16_t bufSize) | |
bool | readBuf (uint8_t *dest, uint16_t len) |
Read data from the buffer. Multi-thread supported. | |
bool | writeBuf (const uint8_t *src, uint16_t len) |
Write data to the buffer. Multi-thread supported. | |
~ModuleBuf () | |
Private Attributes | |
uint8_t * | m_buf |
std::mutex | m_bufMutex |
uint16_t | m_bufSize |
uint16_t | m_bufUsedAmount |
uint16_t | m_head |
Definition at line 19 of file moduleBuf.h.
dji2mav::ModuleBuf::ModuleBuf | ( | uint16_t | bufSize | ) | [inline] |
Definition at line 21 of file moduleBuf.h.
dji2mav::ModuleBuf::~ModuleBuf | ( | ) | [inline] |
Definition at line 43 of file moduleBuf.h.
void dji2mav::ModuleBuf::clear | ( | ) | [inline] |
Clear the buffer. Set used amount 0 but not head pointer.
Definition at line 142 of file moduleBuf.h.
void dji2mav::ModuleBuf::display | ( | ) | [inline] |
Definition at line 128 of file moduleBuf.h.
uint16_t dji2mav::ModuleBuf::getBufSize | ( | ) | [inline] |
Get the max size of buffer.
Definition at line 55 of file moduleBuf.h.
uint16_t dji2mav::ModuleBuf::getBufUsedAmount | ( | ) | [inline] |
Get the used amount of buffer.
Definition at line 64 of file moduleBuf.h.
bool dji2mav::ModuleBuf::readBuf | ( | uint8_t * | dest, |
uint16_t | len | ||
) | [inline] |
Read data from the buffer. Multi-thread supported.
dest | : The pointer to the destination memory |
len | : The length that is going to read from the buffer |
Definition at line 103 of file moduleBuf.h.
bool dji2mav::ModuleBuf::writeBuf | ( | const uint8_t * | src, |
uint16_t | len | ||
) | [inline] |
Write data to the buffer. Multi-thread supported.
src | : The pointer to the source memory |
len | : The length that is going to write to the buffer |
Definition at line 75 of file moduleBuf.h.
uint8_t* dji2mav::ModuleBuf::m_buf [private] |
Definition at line 154 of file moduleBuf.h.
std::mutex dji2mav::ModuleBuf::m_bufMutex [private] |
Definition at line 158 of file moduleBuf.h.
uint16_t dji2mav::ModuleBuf::m_bufSize [private] |
Definition at line 155 of file moduleBuf.h.
uint16_t dji2mav::ModuleBuf::m_bufUsedAmount [private] |
Definition at line 157 of file moduleBuf.h.
uint16_t dji2mav::ModuleBuf::m_head [private] |
Definition at line 156 of file moduleBuf.h.