diff options
author | jaseg <git@jaseg.de> | 2023-12-23 16:51:26 +0100 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2023-12-23 16:51:26 +0100 |
commit | 7b7b18cb148adf6a254a1f73b7fd32d68d88681c (patch) | |
tree | aeccc0bad1a54d4211b43e8a0a46d69af0b6e19b /driver_fw | |
parent | 621d39437ae66951ebfcc13ecc66704efe356c00 (diff) | |
download | 8seg-7b7b18cb148adf6a254a1f73b7fd32d68d88681c.tar.gz 8seg-7b7b18cb148adf6a254a1f73b7fd32d68d88681c.tar.bz2 8seg-7b7b18cb148adf6a254a1f73b7fd32d68d88681c.zip |
Try to de-flicker transmission scheduling
Diffstat (limited to 'driver_fw')
-rw-r--r-- | driver_fw/src/main.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/driver_fw/src/main.c b/driver_fw/src/main.c index 866cde5..4502784 100644 --- a/driver_fw/src/main.c +++ b/driver_fw/src/main.c @@ -17,7 +17,6 @@ static void dma_tx_waveform(size_t table_size, const uint16_t *table); #define SYNC_INTERVAL 13 -static size_t time_to_sync = 0; static size_t tx_bitpos = 0; static size_t tx_sympos = 0; static int tx_last_bit = 0; @@ -315,7 +314,6 @@ size_t cnd_pos = 0; void DMA1_Channel1_IRQHandler() { static int transfer_errors = 0; static int current_symbol = 0; - static int idle_symbol = 0; if (DMA1->ISR & DMA_ISR_TEIF1) { transfer_errors ++; @@ -344,32 +342,23 @@ void DMA1_Channel1_IRQHandler() { sym_arr[sym_pos] = -255; - idle_symbol++; - if (idle_symbol == 3) { - current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K23_7); - idle_symbol = 0; - - } else if (tx_sympos == sizeof(struct data_packet)) { - if (time_to_sync > 0) { - current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K27_7); - sym_arr[sym_pos] = current_symbol; - time_to_sync--; - - } else { - current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K28_1); - sym_arr[sym_pos] = current_symbol; - packet_rng_state = xorshift32(1); - time_to_sync = SYNC_INTERVAL; - } - + if (tx_sympos == sizeof(struct data_packet)) { if (idle_buf_ready) { union tx_buf_union *tmp = tx_buf_idle; tx_buf_idle = tx_buf_read; tx_buf_read = tmp; idle_buf_ready = false; - } - tx_sympos = 0; + current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K28_1); + sym_arr[sym_pos] = current_symbol; + packet_rng_state = xorshift32(1); + + tx_sympos = 0; + + } else { + current_symbol = xfr_8b10b_encode(&encoder_state_8b10b, -K23_7); + sym_arr[sym_pos] = current_symbol; + } } else { uint8_t b = tx_buf_read->bytes[tx_sympos]; |