Browse Source

pinMode configure pins for output drive in all modes, needed for direct I/O libs

main
PaulStoffregen 5 years ago
parent
commit
576c748f2f
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      teensy4/digital.c

+ 4
- 4
teensy4/digital.c View File

@@ -107,13 +107,13 @@ void pinMode(uint8_t pin, uint8_t mode)
} else {
*(p->reg + 1) &= ~(p->mask); // TODO: atomic
if (mode == INPUT) {
*(p->pad) = 0;
*(p->pad) = IOMUXC_PAD_DSE(7);
} else if (mode == INPUT_PULLUP) {
*(p->pad) = IOMUXC_PAD_PKE | IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(3) | IOMUXC_PAD_HYS;
*(p->pad) = IOMUXC_PAD_DSE(7) | IOMUXC_PAD_PKE | IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(3) | IOMUXC_PAD_HYS;
} else if (mode == INPUT_PULLDOWN) {
*(p->pad) = IOMUXC_PAD_PKE | IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(0) | IOMUXC_PAD_HYS;
*(p->pad) = IOMUXC_PAD_DSE(7) | IOMUXC_PAD_PKE | IOMUXC_PAD_PUE | IOMUXC_PAD_PUS(0) | IOMUXC_PAD_HYS;
} else { // INPUT_DISABLE
*(p->pad) = IOMUXC_PAD_HYS;
*(p->pad) = IOMUXC_PAD_DSE(7) | IOMUXC_PAD_HYS;
}
}
*(p->mux) = 5 | 0x10;

Loading…
Cancel
Save