aboutsummaryrefslogtreecommitdiff
path: root/tools/ootx_decode/ootx_decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ootx_decode/ootx_decode.c')
-rw-r--r--tools/ootx_decode/ootx_decode.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/ootx_decode/ootx_decode.c b/tools/ootx_decode/ootx_decode.c
index 0c4a81a..0abde2d 100644
--- a/tools/ootx_decode/ootx_decode.c
+++ b/tools/ootx_decode/ootx_decode.c
@@ -30,11 +30,38 @@ void my_test2(ootx_packet* packet) {
// printf("%d %s 0x%X\n", packet->length, packet->data, packet->crc32);
}
+
+void print_crc32(uint32_t crc) {
+// uint8_t* p = (uint32_t*)&crc;
+// uint8_t i = 0;
+
+ printf("%X\n", crc);
+}
+
+void write_to_file(uint8_t *d, uint16_t length){
+ FILE *fp = fopen("binary.data","w");
+ fwrite(d, length, 1, fp);
+ fclose(fp);
+}
+
+void bad_crc(ootx_packet* packet) {
+ printf("CRC mismatch\n");
+/*
+ printf("r:");
+ print_crc32(op.crc32);
+
+ printf("c:");
+ print_crc32(crc);
+// write_to_file(op.data,op.length);
+*/
+}
+
ootx_decoder_context ctx[2];
void hello_world_test() {
// ootx_init_buffer();
ootx_packet_clbk = my_test;
+ ootx_bad_crc_clbk = bad_crc;
char* line = NULL;
size_t line_len = 0;