diff options
author | jaseg <git@jaseg.de> | 2023-09-30 18:25:10 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-09-30 18:25:10 +0200 |
commit | 67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625 (patch) | |
tree | 583a3e944cb266248a6011d33bebe58cc55ee23c /center_fw/src | |
parent | ee1d1bd0c2c944643596af85b935a128db847117 (diff) | |
download | 8seg-67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625.tar.gz 8seg-67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625.tar.bz2 8seg-67e30fa91e12b452c1a18f6c5eb8a33cdb9ec625.zip |
8b/10b tx/rx works
Diffstat (limited to 'center_fw/src')
-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; } |