diff options
Diffstat (limited to 'driver_fw/src')
-rw-r--r-- | driver_fw/src/main.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/driver_fw/src/main.c b/driver_fw/src/main.c index 52b4a4d..0b3c869 100644 --- a/driver_fw/src/main.c +++ b/driver_fw/src/main.c @@ -202,6 +202,9 @@ void dma_tx_constant(size_t table_size, uint16_t constant) { DMA1_Channel1->CCR |= DMA_CCR_EN; } +int8_t bit_arr[4096]; +size_t bit_pos = 0; + void DMA1_Channel1_IRQHandler() { static int transfer_errors = 0; static int current_symbol = 0x2aa; @@ -213,6 +216,10 @@ void DMA1_Channel1_IRQHandler() { DMA1->IFCR = DMA_IFCR_CGIF1; int bit = !!(current_symbol & (1<<tx_bitpos)); + bit_arr[bit_pos++] = bit; + if (bit_pos == COUNT_OF(bit_arr)) { + bit_pos = 0; + } if (tx_last_bit == bit) { dma_tx_constant(COUNT_OF(waveform_zero_one), bit ? WAVEFORM_CONST_ONE : WAVEFORM_CONST_ZERO); @@ -224,14 +231,15 @@ void DMA1_Channel1_IRQHandler() { tx_last_bit = bit; - tx_bitpos ++; - if (tx_bitpos >= 10) { - tx_bitpos = 0; - tx_sympos ++; + if (tx_bitpos == 0) { + tx_bitpos = 9; current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, tx_datagram[tx_sympos]); + tx_sympos ++; if (tx_sympos >= COUNT_OF(tx_datagram)) { tx_sympos = 0; } + } else { + tx_bitpos --; } } |