esp32-TIC/test_cpu/test_tic.c

36 lines
925 B
C

#include <stdio.h>
#include <stdlib.h>
#include "tic.h"
#define BUF_SIZE 32
int main(void) {
DecodeState* state = create_decode_state(42);
FILE* tic_handle = fopen("../TIC.raw.sample", "rb");
//int initialized = 0;
char buffer[BUF_SIZE];
int buf_size = 0;
while(1) {
buf_size = fread(buffer, sizeof(char), BUF_SIZE, tic_handle);
fprintf(stderr, "Read %d bytes\n", buf_size);
if(buf_size == 0)
break;
/*
if(!initialized) {
char* init_begin = tic_discard_until_frame(buffer, buf_size);
if(init_begin != NULL) {
size_t discarded = (init_begin - buffer);
initialized = 1;
tic_decode(init_begin, buf_size - discarded, state);
}
} else {
*/
tic_decode(buffer, buf_size, state);
//}
}
free_decode_state(state);
return 0;
}