A simple WIP that logs data from a Grove sensor, and can send and receive information over USB and SMS.

Dependencies:   DHT DS_1337 SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

CircBuff Class Reference

CircBuff Class Reference

The CircBuff class writes in and reads out byte arrays into a circular buffer. More...

#include <circbuff.h>

Public Member Functions

void putc (unsigned char c)
 putc adds a single byte, c, into the array
void add (unsigned char *s)
 add adds s into the buffer, up until the NULL byte
uint16_t read (unsigned char *s, uint16_t len)
 read puts the current data from the buffer into s

Detailed Description

The CircBuff class writes in and reads out byte arrays into a circular buffer.

Definition at line 9 of file circbuff.h.


Member Function Documentation

void add ( unsigned char *  s )

add adds s into the buffer, up until the NULL byte

Parameters:
sis the byte array copied into the buffer

Definition at line 40 of file circbuff.cpp.

void putc ( unsigned char  c )

putc adds a single byte, c, into the array

Parameters:
cis the byte copied into the circular buffer.

Definition at line 22 of file circbuff.cpp.

uint16_t read ( unsigned char *  s,
uint16_t  len 
)

read puts the current data from the buffer into s

Parameters:
sis the reference buffer to copy current data into. Caller's responsibility to make it the correct size
lenis the number of bytes to copy into s
Returns:
the number of bytes copied into s. Will be less than len if there was less data in the buffer.

Definition at line 84 of file circbuff.cpp.