mirror of https://github.com/jeelabs/esp-link.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
482 B
18 lines
482 B
9 years ago
|
#ifndef _RING_BUF_H_
|
||
|
#define _RING_BUF_H_
|
||
|
|
||
|
#include <esp8266.h>
|
||
|
|
||
|
typedef struct {
|
||
|
uint8_t* p_o; /**< Original pointer */
|
||
|
uint8_t* volatile p_r; /**< Read pointer */
|
||
|
uint8_t* volatile p_w; /**< Write pointer */
|
||
|
volatile int32_t fill_cnt; /**< Number of filled slots */
|
||
|
int32_t size; /**< Buffer size */
|
||
|
} RINGBUF;
|
||
|
|
||
|
int16_t RINGBUF_Init(RINGBUF* r, uint8_t* buf, int32_t size);
|
||
|
int16_t RINGBUF_Put(RINGBUF* r, uint8_t c);
|
||
|
int16_t RINGBUF_Get(RINGBUF* r, uint8_t* c);
|
||
|
#endif
|