Files
2025-02-MPX/ccs/state.h
2025-12-01 19:51:51 +09:00

23 lines
420 B
C

#pragma once
#include <stdint.h>
#define STATE_SENSOR_BUFFER_SIZE 8
typedef struct {
uint8_t buffer[STATE_SENSOR_BUFFER_SIZE];
int front;
int rear;
int size;
} SensorBuffer;
void senbuf_init(SensorBuffer *sb);
int senbuf_is_full(SensorBuffer *sb);
int senbuf_push(SensorBuffer *sb, uint8_t value);
int senbuf_pop(SensorBuffer *sb);
void senbuf_get(SensorBuffer *sb, uint8_t *out, int lookahead);