diff options
Diffstat (limited to 'center_fw/src/main.c')
-rw-r--r-- | center_fw/src/main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/center_fw/src/main.c b/center_fw/src/main.c index 53b6aae..274abad 100644 --- a/center_fw/src/main.c +++ b/center_fw/src/main.c @@ -124,7 +124,7 @@ void TIM1_CC_IRQHandler(void) { } */ static size_t received_symbols = 0; -static int symbol_buf[32]; +static int symbol_buf[64]; static size_t received_bits = 0; static int16_t bit_buf[256]; size_t adc_reduced_pos = 0; @@ -145,16 +145,13 @@ void DMA1_Channel1_IRQHandler(void) { int sample = buf[i]; adc_reduced[adc_reduced_pos] = (sample & 0xffff)>>9; - if (adc_reduced_pos == 0) { - asm volatile ("bkpt"); - } if ((last_sample <= threshold_adc_counts && sample >= threshold_adc_counts) || (last_sample >= threshold_adc_counts && sample <= threshold_adc_counts)){ sampling_phase = sample_per_baud / 4; /* /2 for half baud sampling point, /2 for sinusoidal edge shape */ } else if (sampling_phase == 0) { - int bit = sample < threshold_adc_counts; + int bit = sample > threshold_adc_counts; adc_reduced[adc_reduced_pos] |= 0x80; bit_buf[received_bits] = bit; @@ -171,7 +168,10 @@ void DMA1_Channel1_IRQHandler(void) { sampling_phase--; } - adc_reduced_pos = (adc_reduced_pos+1) % COUNT_OF(adc_reduced); + adc_reduced_pos++; + if (adc_reduced_pos == COUNT_OF(adc_reduced)) { + adc_reduced_pos =0; + } last_sample = sample; } |