MSP430™CapTIvateSoftwareLibraryAPIGuide 1_70_00_03

Data Structures | Functions
CAPT_PingPongBuffer

Serial communication ping-pong buffer management. More...

## Data Structures
struct | tPingPongBuffer

## Functions
bool | CAPT_initPingPongBuffer (tPingPongBuffer *PPBuffer, uint8_t *pBuffer1, uint8_t *pBuffer2)
bool | CAPT_togglePingPongBuffer (tPingPongBuffer *PPBuffer)
| This functions swaps the edit buffer with the transmit buffer. More...

## Detailed Description

Serial communication ping-pong buffer management.

An edit buffer and a transmit buffer of equal size are used to allow a new packet to be built while a previous packet is being transmitted. Two contiguous byte arrays of equal size in memory need to be established. Pointers to these two arrays need to be passed to to the CAPT_initPingPongBuffer() API. From that point, either buffer can be read to or written to by accessing the structure. a toggle API switches the roles of the two buffers (edit and transmit).

Version
  VERSION Released on RELEASE_DATE

## Function Documentation

## § CAPT_initPingPongBuffer()

bool CAPT_initPingPongBuffer | ( | tPingPongBuffer * | PPBuffer,
|  | uint8_t * | pBuffer1,
|  | uint8_t * | pBuffer2
| ) |  |

This is the basic "constructor" function for a ping pong buffer. Call this once before the buffer is used.

Parameters

  *PPBuffer | is a pointer to the Ping Pong buffer structure to initialize.
  *pBuffer1 | is a pointer to an array of bytes to use for buffering.
  *pBuffer2 | is a pointer to an array of bytes to use for buffering. pBuffer1 should point to a buffer that is the same length as pBuffer2.

Returns
  true if pointers are !=0, else false.

## § CAPT_togglePingPongBuffer()

bool CAPT_togglePingPongBuffer | ( | tPingPongBuffer * | PPBuffer | ) |

This functions swaps the edit buffer with the transmit buffer.

Parameters

  *PPBuffer | is a pointer to the Ping Pong buffer to toggle.

Returns
  if the buffer pointer is !=0, else false.

© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale