aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJosh Allen <axlecrusher@gmail.com>2017-02-12 08:34:01 -0500
committerJosh Allen <axlecrusher@gmail.com>2017-02-12 08:34:01 -0500
commitcc79e01f62be87f7dcc6de3be7ddb981d6899dff (patch)
tree5068480c52a35ca3f3a2baa1f4e9a21a6f046067 /tools
parentc04c9fb7dcf80123edec53a2e6709bb128548a73 (diff)
downloadlibsurvive-cc79e01f62be87f7dcc6de3be7ddb981d6899dff.tar.gz
libsurvive-cc79e01f62be87f7dcc6de3be7ddb981d6899dff.tar.bz2
ootx_log_bit to ootx_accumulate_bit
Diffstat (limited to 'tools')
-rw-r--r--tools/ootx_decode/ootx_decoder.c12
-rw-r--r--tools/ootx_decode/ootx_decoder.h2
2 files changed, 10 insertions, 4 deletions
diff --git a/tools/ootx_decode/ootx_decoder.c b/tools/ootx_decode/ootx_decoder.c
index 6a06744..c244b80 100644
--- a/tools/ootx_decode/ootx_decoder.c
+++ b/tools/ootx_decode/ootx_decoder.c
@@ -84,19 +84,24 @@ uint8_t ootx_decode_bit(uint32_t ticks) {
return bits&0x02;
}
*/
-
-void ootx_log_bit(ootx_decoder_context *ctx, uint32_t ticks) {
- int8_t dbit = ootx_decode_bit(ticks);
+/*
+void ootx_accumulate_bit(ootx_decoder_context *ctx, uint32_t ticks) {
+ uint8_t dbit = ootx_decode_bit(ticks);
// printf("%d\n\n", dbit);
ctx->bit_count[(dbit&0x01)]++;
// printf("%d %d %d\n", dbit, ctx->bit_count[0], ctx->bit_count[1]);
}
+*/
+void ootx_accumulate_bit(ootx_decoder_context *ctx, uint8_t bit) {
+ ctx->bit_count[bit&0x01]++;
+}
uint8_t ootx_pump_greatest_bit(ootx_decoder_context *ctx) {
//pump the bit
uint8_t bit = 0x00;
if (ctx->bit_count[0] < ctx->bit_count[1]) bit = 0xFF;
+// printf("pump %d\n", bit);
ootx_pump_bit( ctx, bit );
ctx->bit_count[0] = 0;
@@ -150,6 +155,7 @@ void ootx_write_to_buffer(ootx_decoder_context *ctx, uint8_t dbit) {
void ootx_process_bit(ootx_decoder_context *ctx, uint32_t length) {
int8_t dbit = ootx_decode_bit(length);
+
ootx_pump_bit( ctx, dbit );
}
diff --git a/tools/ootx_decode/ootx_decoder.h b/tools/ootx_decode/ootx_decoder.h
index c7cf55c..7e6af82 100644
--- a/tools/ootx_decode/ootx_decoder.h
+++ b/tools/ootx_decode/ootx_decoder.h
@@ -60,7 +60,7 @@ void ootx_process_bit(ootx_decoder_context *ctx, uint32_t length);
void ootx_init_decoder_context(ootx_decoder_context *ctx);
int8_t ootx_decode_lighthouse_number(uint8_t last_num, uint32_t ticks, int32_t delta);
-void ootx_log_bit(ootx_decoder_context *ctx, uint32_t length);
+void ootx_accumulate_bit(ootx_decoder_context *ctx, uint8_t bit);
uint8_t ootx_pump_greatest_bit(ootx_decoder_context *ctx);
extern void (*ootx_packet_clbk)(ootx_packet* packet);