Antonio Sterling
/
bufferCircular
Implementacion del Buffer Circular (V 1.0)
bufferCircular.h@0:7dcce74fbfcb, 2021-10-01 (annotated)
- Committer:
- antonsterling
- Date:
- Fri Oct 01 01:28:50 2021 +0000
- Revision:
- 0:7dcce74fbfcb
Implementacion del Buffer Circular (V 1.0)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
antonsterling | 0:7dcce74fbfcb | 1 | #include "mbed.h" |
antonsterling | 0:7dcce74fbfcb | 2 | |
antonsterling | 0:7dcce74fbfcb | 3 | #ifndef BUFFERCIRCULAR_H |
antonsterling | 0:7dcce74fbfcb | 4 | #define BUFFERCIRCULAR_H |
antonsterling | 0:7dcce74fbfcb | 5 | |
antonsterling | 0:7dcce74fbfcb | 6 | |
antonsterling | 0:7dcce74fbfcb | 7 | typedef struct { |
antonsterling | 0:7dcce74fbfcb | 8 | uint8_t* buffer; // Buffer de datos |
antonsterling | 0:7dcce74fbfcb | 9 | size_t head; // Posicion de la cabeza |
antonsterling | 0:7dcce74fbfcb | 10 | size_t tail; // Posicion de la cola |
antonsterling | 0:7dcce74fbfcb | 11 | size_t size; // Tamaño de del buffer |
antonsterling | 0:7dcce74fbfcb | 12 | } bufferCircular; |
antonsterling | 0:7dcce74fbfcb | 13 | |
antonsterling | 0:7dcce74fbfcb | 14 | int rstBuffer (bufferCircular* bufferC); |
antonsterling | 0:7dcce74fbfcb | 15 | int putBuffer (bufferCircular* bufferC, uint8_t dato); |
antonsterling | 0:7dcce74fbfcb | 16 | int getBuffer (bufferCircular* bufferC, uint8_t* dato); |
antonsterling | 0:7dcce74fbfcb | 17 | bool emptyBuffer (bufferCircular bufferC); |
antonsterling | 0:7dcce74fbfcb | 18 | bool fullBuffer (bufferCircular bufferC); |
antonsterling | 0:7dcce74fbfcb | 19 | |
antonsterling | 0:7dcce74fbfcb | 20 | #endif |