Last change
on this file since 175 was 175, checked in by ertl-honda, 8 years ago |
ライブラリを Arduino IDE 1.7.9 にupdate
|
File size:
570 bytes
|
Rev | Line | |
---|
[175] | 1 | #ifndef _RING_BUF_H_
|
---|
| 2 | #define _RING_BUF_H_
|
---|
| 3 |
|
---|
| 4 | #include <stdint.h>
|
---|
| 5 | #include <stdlib.h>
|
---|
| 6 | #ifdef __cplusplus
|
---|
| 7 | extern "C" {
|
---|
| 8 | #endif
|
---|
| 9 |
|
---|
| 10 | typedef struct{
|
---|
| 11 | uint8_t* p_o; /**< Original pointer */
|
---|
| 12 | uint8_t* volatile p_r; /**< Read pointer */
|
---|
| 13 | uint8_t* volatile p_w; /**< Write pointer */
|
---|
| 14 | volatile int32_t fill_cnt; /**< Number of filled slots */
|
---|
| 15 | int32_t size; /**< Buffer size */
|
---|
| 16 | }RINGBUF;
|
---|
| 17 |
|
---|
| 18 | int16_t RINGBUF_Init(RINGBUF *r, uint8_t* buf, int32_t size);
|
---|
| 19 | int16_t RINGBUF_Put(RINGBUF *r, uint8_t c);
|
---|
| 20 | int16_t RINGBUF_Get(RINGBUF *r, uint8_t* c);
|
---|
| 21 |
|
---|
| 22 | #ifdef __cplusplus
|
---|
| 23 | }
|
---|
| 24 | #endif
|
---|
| 25 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.