assign VOLATILE V2

This commit is contained in:
2025-12-10 02:26:47 +09:00
parent 2ca19bf287
commit 3d8b12c321
14 changed files with 348 additions and 888 deletions

33
ccs/history.h Executable file
View File

@@ -0,0 +1,33 @@
#ifndef _history_h_
#define _history_h_
#include <stdint.h>
#define HISTORY_SIZE 20000
typedef struct HistoryEntry {
uint8_t sensor;
int error;
} HistoryEntry;
typedef struct {
HistoryEntry data[HISTORY_SIZE];
int errors[HISTORY_SIZE];
int front;
int rear;
int size;
} HistoryBuffer;
void hisbuf_init(HistoryBuffer *sb);
int hisbuf_is_full(HistoryBuffer *sb);
int hisbuf_push(HistoryBuffer *sb, HistoryEntry entry);
int hisbuf_pop(HistoryBuffer *sb);
int hisbuf_pop_data(HistoryBuffer *sb, HistoryEntry *out);
void hisbuf_get(HistoryBuffer *sb, HistoryEntry *out, int lookahead);
#endif