Browse Source

Fix 9 bit transmit mode on Serial3

main
PaulStoffregen 9 years ago
parent
commit
5c9ccd8412
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      teensy3/serial3.c

+ 4
- 2
teensy3/serial3.c View File



void serial3_putchar(uint32_t c) void serial3_putchar(uint32_t c)
{ {
uint32_t head;
uint32_t head, n;


if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return; if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return;
if (transmit_pin) *transmit_pin = 1; if (transmit_pin) *transmit_pin = 1;
if ((UART2_S1 & UART_S1_TDRE)) { if ((UART2_S1 & UART_S1_TDRE)) {
uint32_t tail = tx_buffer_tail; uint32_t tail = tx_buffer_tail;
if (++tail >= TX_BUFFER_SIZE) tail = 0; if (++tail >= TX_BUFFER_SIZE) tail = 0;
UART2_D = tx_buffer[tail];
n = tx_buffer[tail];
if (use9Bits) UART2_C3 = (UART2_C3 & ~0x40) | ((n & 0x100) >> 2);
UART2_D = n;
tx_buffer_tail = tail; tx_buffer_tail = tail;
} }
} else if (priority >= 256) { } else if (priority >= 256) {

Loading…
Cancel
Save