Provides general purpose input and output (GPIO) functions. More...
Functions | |
| DigitalHooks * | setDigitalHooks (DigitalHooks *hooks) |
| Replace (or remove) existing hooks. More... | |
| void | pinMode (uint16_t pin, uint8_t mode) |
| Set the mode of a GPIO pin. More... | |
| void | digitalWrite (uint16_t pin, uint8_t val) |
| Set a digital output. More... | |
| uint8_t | digitalRead (uint16_t pin) |
| Get the value of a digital input. More... | |
| void | pullup (uint16_t pin) |
| Enable pull-up on digital input. More... | |
| void | noPullup (uint16_t pin) |
| Disable pull-up on digital input. More... | |
| bool | isInputPin (uint16_t pin) |
| Check if GPIO is an input. More... | |
| unsigned long | pulseIn (uint16_t pin, uint8_t state, unsigned long timeout=1000000L) |
| Measures duration of pulse on GPIO. More... | |
| uint16_t | analogRead (uint16_t pin) |
Variables | |
| const EspDigitalPin | EspDigitalPins [] |
| ESP GPIO pin configuration. More... | |
Detailed Description
Provides general purpose input and output (GPIO) functions.
- See also
- pwm
Function Documentation
◆ analogRead()
◆ digitalRead()
| uint8_t digitalRead | ( | uint16_t | pin | ) |
Get the value of a digital input.
- Parameters
-
pin GPIO pin to read
- Return values
-
uint8_t Value of GPIO
◆ digitalWrite()
| void digitalWrite | ( | uint16_t | pin, |
| uint8_t | val | ||
| ) |
Set a digital output.
- Parameters
-
pin GPIO pin to set val Value to set [0 | 1]
◆ isInputPin()
Check if GPIO is an input.
- Parameters
-
pin GPIO to check
- Return values
-
bool True if GPIO is an input
◆ noPullup()
| void noPullup | ( | uint16_t | pin | ) |
Disable pull-up on digital input.
- Parameters
-
pin GPIO to disable pull-up resistor
◆ pinMode()
| void pinMode | ( | uint16_t | pin, |
| uint8_t | mode | ||
| ) |
Set the mode of a GPIO pin.
- Parameters
-
pin GPIO pin to configure mode Mode of pin [INPUT | INPUT_PULLUP | OUTPUT]
- Todo:
- ESP8266 supports pull-down on GPIO 0-15
◆ pullup()
| void pullup | ( | uint16_t | pin | ) |
Enable pull-up on digital input.
- Parameters
-
pin GPIO to enable pull-up resistor
◆ pulseIn()
| unsigned long pulseIn | ( | uint16_t | pin, |
| uint8_t | state, | ||
| unsigned long | timeout = 1000000L |
||
| ) |
Measures duration of pulse on GPIO.
- Parameters
-
pin GPIO to measure state State of pulse to measure [HIGH | LOW] timeout Maximum duration of pulse
- Return values
-
unsigned long Pulse duration in microseconds
- Note
- Works on pulses from 2-3 microseconds to 3 minutes in length.
- Must be called at least a few dozen microseconds before the start of the pulse.
◆ setDigitalHooks()
| DigitalHooks* setDigitalHooks | ( | DigitalHooks * | hooks | ) |
Replace (or remove) existing hooks.
- Parameters
-
hooks The new hooks, or nullptr to remove
- Return values
-
DigitalHooks* The previous hooks
Variable Documentation
◆ EspDigitalPins
| const EspDigitalPin EspDigitalPins[] |
ESP GPIO pin configuration.
1.8.13