Browse Source

Teensy-LC doesn't support CTS, so disable its code

teensy4-core
PaulStoffregen 9 years ago
parent
commit
0254d93d95
3 changed files with 12 additions and 0 deletions
  1. +4
    -0
      teensy3/serial1.c
  2. +4
    -0
      teensy3/serial2.c
  3. +4
    -0
      teensy3/serial3.c

+ 4
- 0
teensy3/serial1.c View File



int serial_set_cts(uint8_t pin) int serial_set_cts(uint8_t pin)
{ {
#if defined(KINETISK)
if (!(SIM_SCGC4 & SIM_SCGC4_UART0)) return 0; if (!(SIM_SCGC4 & SIM_SCGC4_UART0)) return 0;
if (pin == 18) { if (pin == 18) {
CORE_PIN18_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown CORE_PIN18_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown
} }
UART0_MODEM |= UART_MODEM_TXCTSE; UART0_MODEM |= UART_MODEM_TXCTSE;
return 1; return 1;
#else
return 0;
#endif
} }


void serial_putchar(uint32_t c) void serial_putchar(uint32_t c)

+ 4
- 0
teensy3/serial2.c View File



int serial2_set_cts(uint8_t pin) int serial2_set_cts(uint8_t pin)
{ {
#if defined(KINETISK)
if (!(SIM_SCGC4 & SIM_SCGC4_UART1)) return 0; if (!(SIM_SCGC4 & SIM_SCGC4_UART1)) return 0;
if (pin == 23) { if (pin == 23) {
CORE_PIN23_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown CORE_PIN23_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown
} }
UART1_MODEM |= UART_MODEM_TXCTSE; UART1_MODEM |= UART_MODEM_TXCTSE;
return 1; return 1;
#else
return 0;
#endif
} }


void serial2_putchar(uint32_t c) void serial2_putchar(uint32_t c)

+ 4
- 0
teensy3/serial3.c View File



int serial3_set_cts(uint8_t pin) int serial3_set_cts(uint8_t pin)
{ {
#if defined(KINETISK)
if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return 0; if (!(SIM_SCGC4 & SIM_SCGC4_UART2)) return 0;
if (pin == 14) { if (pin == 14) {
CORE_PIN14_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown CORE_PIN14_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown
} }
UART2_MODEM |= UART_MODEM_TXCTSE; UART2_MODEM |= UART_MODEM_TXCTSE;
return 1; return 1;
#else
return 0;
#endif
} }


void serial3_putchar(uint32_t c) void serial3_putchar(uint32_t c)

Loading…
Cancel
Save