Wirepas SDK
doublebuffer.h File Reference

Go to the source code of this file.

Data Structures

struct  double_buffer_t
 

Macros

#define DoubleBuffer_init(buffers)
 
#define DoubleBuffer_getActive(buffers)   ((buffers).active_buffer_p)
 
#define DoubleBuffer_swipe(buffers)
 
#define DoubleBuffer_getIndex(buffers)   ((buffers).current_writing_index)
 
#define DoubleBuffer_incrIndex(buffers, inc)   ((buffers).current_writing_index += inc)
 

Data Structure Documentation

◆ double_buffer_t

struct double_buffer_t

Definition at line 18 of file doublebuffer.h.

Data Fields
uint8_t * active_buffer_p
uint8_t buffer_1[BUFFER_SIZE]
uint8_t buffer_2[BUFFER_SIZE]
uint8_t current_writing_index

Macro Definition Documentation

◆ DoubleBuffer_getActive

#define DoubleBuffer_getActive (   buffers)    ((buffers).active_buffer_p)

Get active buffer

Definition at line 33 of file doublebuffer.h.

◆ DoubleBuffer_getIndex

#define DoubleBuffer_getIndex (   buffers)    ((buffers).current_writing_index)

Get current writing index

Definition at line 49 of file doublebuffer.h.

◆ DoubleBuffer_incrIndex

#define DoubleBuffer_incrIndex (   buffers,
  inc 
)    ((buffers).current_writing_index += inc)

Increment writing index

Definition at line 52 of file doublebuffer.h.

◆ DoubleBuffer_init

#define DoubleBuffer_init (   buffers)
Value:
do { \
(buffers).active_buffer_p = (buffers).buffer_1; \
(buffers).current_writing_index = 0; \
} while(0)

Initialize double buffer struct

Definition at line 27 of file doublebuffer.h.

◆ DoubleBuffer_swipe

#define DoubleBuffer_swipe (   buffers)
Value:
do { \
if ((buffers).active_buffer_p == (buffers).buffer_1) \
{ \
(buffers).active_buffer_p = (buffers).buffer_2; \
} \
else \
{ \
(buffers).active_buffer_p = (buffers).buffer_1; \
} \
(buffers).current_writing_index = 0; \
} while(0)

Swipe buffers and reset writing index

Definition at line 36 of file doublebuffer.h.