mirror of
https://github.com/espressif/esp-mqtt.git
synced 2025-11-11 12:32:46 +01:00
-add queue
- add ping timer - add subscribe function
This commit is contained in:
23
include/ringbuf.h
Normal file
23
include/ringbuf.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _RING_BUF_H_
|
||||
#define _RING_BUF_H_
|
||||
|
||||
#include <stdint.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 */
|
||||
int32_t block_size;
|
||||
}RINGBUF;
|
||||
|
||||
int32_t rb_init(RINGBUF *r, uint8_t* buf, int32_t size, int32_t block_size);
|
||||
int32_t rb_put(RINGBUF *r, uint8_t* c);
|
||||
int32_t rb_get(RINGBUF *r, uint8_t* c);
|
||||
int32_t rb_available(RINGBUF *r);
|
||||
uint32_t rb_read(RINGBUF *r, uint8_t *buf, int len);
|
||||
uint32_t rb_write(RINGBUF *r, uint8_t *buf, int len);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user