Browse Source

Fix pin numbers for transmit opendrain on Serial4 & Serial5

main
PaulStoffregen 8 years ago
parent
commit
5eab8dd0b8
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      teensy3/serial4.c
  2. +2
    -2
      teensy3/serial5.c

+ 2
- 2
teensy3/serial4.c View File

if (pin == tx_pin_num) return; if (pin == tx_pin_num) return;
if ((SIM_SCGC4 & SIM_SCGC4_UART2)) { if ((SIM_SCGC4 & SIM_SCGC4_UART2)) {
switch (tx_pin_num & 127) { switch (tx_pin_num & 127) {
case 32: CORE_PIN8_CONFIG = 0; break; // PTD3
case 32: CORE_PIN32_CONFIG = 0; break; // PTB11
} }
if (opendrain) { if (opendrain) {
cfg = PORT_PCR_DSE | PORT_PCR_ODE; cfg = PORT_PCR_DSE | PORT_PCR_ODE;
cfg = PORT_PCR_DSE | PORT_PCR_SRE; cfg = PORT_PCR_DSE | PORT_PCR_SRE;
} }
switch (pin & 127) { switch (pin & 127) {
case 32: CORE_PIN8_CONFIG = cfg | PORT_PCR_MUX(3); break;
case 32: CORE_PIN32_CONFIG = cfg | PORT_PCR_MUX(3); break;
} }
} }
tx_pin_num = pin; tx_pin_num = pin;

+ 2
- 2
teensy3/serial5.c View File

if (pin == tx_pin_num) return; if (pin == tx_pin_num) return;
if ((SIM_SCGC4 & SIM_SCGC4_UART2)) { if ((SIM_SCGC4 & SIM_SCGC4_UART2)) {
switch (tx_pin_num & 127) { switch (tx_pin_num & 127) {
case 34: CORE_PIN8_CONFIG = 0; break; // PTD3
case 33: CORE_PIN33_CONFIG = 0; break; // PTE24
} }
if (opendrain) { if (opendrain) {
cfg = PORT_PCR_DSE | PORT_PCR_ODE; cfg = PORT_PCR_DSE | PORT_PCR_ODE;
cfg = PORT_PCR_DSE | PORT_PCR_SRE; cfg = PORT_PCR_DSE | PORT_PCR_SRE;
} }
switch (pin & 127) { switch (pin & 127) {
case 34: CORE_PIN8_CONFIG = cfg | PORT_PCR_MUX(3); break;
case 33: CORE_PIN33_CONFIG = cfg | PORT_PCR_MUX(3); break;
} }
} }
tx_pin_num = pin; tx_pin_num = pin;

Loading…
Cancel
Save