STM32F10x library
Functions
circbuf8.c File Reference

Circular byte buffer routines. Interrupt safe. More...

#include "stm32f10x.h"
#include "circbuf8.h"

Functions

void cbuf8_clear (volatile struct cbuf8_t *cb, uint8_t *const p, const uint16_t s)
 Initializes (clears) circbuf. More...
 
uint8_t cbuf8_put (volatile struct cbuf8_t *cb, const uint8_t d)
 Insert an element. More...
 
uint8_t cbuf8_get (volatile struct cbuf8_t *cb, uint8_t *const d)
 Get next element. More...
 

Detailed Description

Circular byte buffer routines. Interrupt safe.

Author
Matej Kogovsek (matej.nosp@m.@ham.nosp@m.radio.nosp@m..si)
Note
This file is part of mat-stm32f1-lib

Function Documentation

void cbuf8_clear ( volatile struct cbuf8_t cb,
uint8_t *const  p,
const uint16_t  s 
)

Initializes (clears) circbuf.

Parameters
[in]cbPointer to cbuf_t struct where circbuf state will be kept
[in]pPointer to byte array for data
[in]ssizeof(p)
uint8_t cbuf8_get ( volatile struct cbuf8_t cb,
uint8_t *const  d 
)

Get next element.

Parameters
[in]cbPointer to cbuf_t
[out]dPointer to uint8_t where next element is put.
Returns
True on success (data copied to d), false otherwise (buffer empty).
uint8_t cbuf8_put ( volatile struct cbuf8_t cb,
const uint8_t  d 
)

Insert an element.

Parameters
[in]cbPointer to cbuf_t
[in]dData to insert
Returns
True on success, false otherwise (buffer full).