Sfoglia il codice sorgente

Add pinMode INPUT_DISABLE

main
PaulStoffregen 8 anni fa
parent
commit
56f36603ad
3 ha cambiato i file con 9 aggiunte e 10 eliminazioni
  1. +1
    -0
      keywords.txt
  2. +1
    -0
      teensy3/core_pins.h
  3. +7
    -10
      teensy3/pins_teensy.c

+ 1
- 0
keywords.txt Vedi File

@@ -81,6 +81,7 @@ digitalPinToInterrupt KEYWORD2
OUTPUT_OPENDRAIN LITERAL1
INPUT_PULLUP LITERAL1
INPUT_PULLDOWN LITERAL1
INPUT_DISABLE LITERAL1

# String functions
copy KEYWORD2

+ 1
- 0
teensy3/core_pins.h Vedi File

@@ -41,6 +41,7 @@
#define INPUT_PULLUP 2
#define INPUT_PULLDOWN 3
#define OUTPUT_OPENDRAIN 4
#define INPUT_DISABLE 5
#define LSBFIRST 0
#define MSBFIRST 1
#define _BV(n) (1<<(n))

+ 7
- 10
teensy3/pins_teensy.c Vedi File

@@ -1066,19 +1066,16 @@ void pinMode(uint8_t pin, uint8_t mode)
#else
*portModeRegister(pin) &= ~digitalPinToBitMask(pin);
#endif
if (mode == INPUT || mode == INPUT_PULLUP || mode == INPUT_PULLDOWN) {
if (mode == INPUT) {
*config = PORT_PCR_MUX(1);
if (mode == INPUT_PULLUP) {
*config |= (PORT_PCR_PE | PORT_PCR_PS); // pullup
} else if (mode == INPUT_PULLDOWN) {
*config |= (PORT_PCR_PE); // pulldown
*config &= ~(PORT_PCR_PS);
}
} else {
*config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS; // pullup
} else if (mode == INPUT_PULLUP) {
*config = PORT_PCR_MUX(1) | PORT_PCR_PE | PORT_PCR_PS;
} else if (mode == INPUT_PULLDOWN) {
*config = PORT_PCR_MUX(1) | PORT_PCR_PE;
} else { // INPUT_DISABLE
*config = 0;
}
}

}



Loading…
Annulla
Salva