rbuf.h 475 B

123456789101112131415161718192021222324252627
  1. //rbuf.h
  2. #ifndef _RBUF_H
  3. #define _RBUF_H
  4. #include <inttypes.h>
  5. #define rbuf_l(ptr) (ptr[0])
  6. #define rbuf_w(ptr) (ptr[1])
  7. #define rbuf_r(ptr) (ptr[2])
  8. #define rbuf_empty(ptr) (ptr[1] == ptr[2])
  9. #if defined(__cplusplus)
  10. extern "C" {
  11. #endif //defined(__cplusplus)
  12. extern void rbuf_ini(uint8_t* ptr, uint8_t len);
  13. extern int rbuf_put(uint8_t* ptr, uint8_t val);
  14. extern int rbuf_get(uint8_t* ptr);
  15. #if defined(__cplusplus)
  16. }
  17. #endif //defined(__cplusplus)
  18. #endif //_RBUF_H