mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
22 lines
545 B
C
22 lines
545 B
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
|
|
#define MAX_BUFFER_SIZE 200
|
|
|
|
typedef struct Buffer {
|
|
uint8_t* data;
|
|
size_t size;
|
|
size_t capacity;
|
|
bool closed;
|
|
} Buffer;
|
|
|
|
Buffer* buffer_alloc(size_t inital_capacity);
|
|
bool buffer_append_single(Buffer* buf, uint8_t value);
|
|
bool buffer_append(Buffer* buf, uint8_t* data, size_t size);
|
|
uint8_t* buffer_get_data(Buffer* buf);
|
|
size_t buffer_get_size(Buffer* buf);
|
|
void buffer_close(Buffer* buf);
|
|
void buffer_reset(Buffer* buf);
|
|
void buffer_free(Buffer* buf); |