34 lines
625 B
C
Executable File
34 lines
625 B
C
Executable File
#ifndef _history_h_
|
|
#define _history_h_
|
|
|
|
#include <stdint.h>
|
|
|
|
#define HISTORY_SIZE 4800
|
|
|
|
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
|