Skip to content

Commit

Permalink
Line setting bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
newbrain committed Sep 23, 2022
1 parent a32a571 commit d0e70c6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions TeensyBridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const *line_options)
}
/* Set the other line parameters NO ERROR CHECKING! */
uart_parity_t p = line_options->parity;
if (p == 2) p = 1;
if (p > 2)
p = 0;
else if (p)
p = 2 - p;
uint32_t bits = line_options->data_bits == 16 ? 8 : line_options->data_bits;
uart_set_format(uart1,
line_options->data_bits,
line_options->stop_bits,
line_options->parity);
bits,
1 + (line_options->stop_bits >> 1),
p);
}

0 comments on commit d0e70c6

Please sign in to comment.