ESPectro32 Library
Library for using ESPectro32 board
|
Interface to GPIO functions. More...
#include <GPIO.h>
Static Public Member Functions | |
static void | addISRHandler (gpio_num_t pin, gpio_isr_t handler, void *pArgs) |
Add an ISR handler to the pin. More... | |
static void | high (gpio_num_t pin) |
Set the pin high. More... | |
static void | interruptDisable (gpio_num_t pin) |
Disable interrupts on the named pin. More... | |
static void | interruptEnable (gpio_num_t pin) |
Enable interrupts on the named pin. More... | |
static bool | inRange (gpio_num_t pin) |
Determine if the pin is a valid pin for an ESP32 (i.e. is it in range). More... | |
static void | low (gpio_num_t pin) |
Set the pin low. More... | |
static bool | read (gpio_num_t pin) |
Read a value from the given pin. More... | |
static void | setInput (gpio_num_t pin) |
Set the pin as input. More... | |
static void | setInterruptType (gpio_num_t pin, gpio_int_type_t intrType) |
Set the interrupt type. The type of interrupt can be one of: More... | |
static void | setOutput (gpio_num_t pin) |
Set the pin as output. More... | |
static void | write (gpio_num_t pin, bool value) |
Write a value to the given pin. More... | |
static void | writeByte (gpio_num_t pins[], uint8_t value, int bits) |
Write up to 8 bits of data to a set of pins. More... | |
Interface to GPIO functions.
The GPIO functions encapsulate the GPIO access. The GPIOs available to us are 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,23,25,26,27,32,33,34,35,36,37,38,39.
The GPIOs of 34,35,36,37,38 and 39 are input only.
Note that we must not use int
values for the pin numbers but instead use the gpio_num_t
. There are constants defined for these of the form GPIO_NUM_xx
.
To toggle a pin we might code:
|
static |
Add an ISR handler to the pin.
[in] | pin | The pin to have the ISR associated with it. |
[in] | handler | The function to be invoked when the interrupt is detected. |
[in] | pArgs | Optional arguments to pass to the handler. |
|
static |
Set the pin high.
Ensure that the pin is set to be output prior to calling this method.
[in] | pin | The pin to be set high. |
|
static |
Determine if the pin is a valid pin for an ESP32 (i.e. is it in range).
[in] | pin | The pin number to validate. |
|
static |
Disable interrupts on the named pin.
[in] | pin | The pin to disable interrupts upon. |
|
static |
Enable interrupts on the named pin.
[in] | pin | The pin to enable interrupts upon. |
|
static |
Set the pin low.
Ensure that the pin is set to be output prior to calling this method.
[in] | pin | The pin to be set low. |
|
static |
Read a value from the given pin.
Ensure the pin is set as input before calling this method.
[in] | pin | The pin to read from. |
|
static |
Set the pin as input.
Set the direction of the pin as input.
[in] | pin | The pin to set as input. |
|
static |
Set the interrupt type. The type of interrupt can be one of:
[in] | pin | The pin to set the interrupt upon. |
[in] | intrType | The type of interrupt. |
|
static |
Set the pin as output.
Set the direction of the pin as output. Note that pins 34 through 39 are input only and can not be set as output.
[in] | pin | The pin to set as output. |
|
static |
Write a value to the given pin.
Ensure that the pin is set as output before calling this method.
[in] | pin | The gpio pin to change. |
[out] | value | The value to be written to the pin. |
|
static |
Write up to 8 bits of data to a set of pins.
[in] | pins | An array of pins to set their values. |
[in] | value | The data value to write. |
[in] | bits | The number of bits to write. |