Class daisy::GPIO¶
General Purpose I/O control. More...
#include <gpio.h>
Classes¶
Type | Name |
---|---|
struct | Config Configuration for a given GPIO . |
Public Types¶
Type | Name |
---|---|
enum | Mode Mode of operation for the specified GPIO . |
enum | Pull Configures whether an internal Pull up or Pull down resistor is used. |
enum | Speed Output speed controls the drive strength, and slew rate of the pin. |
Public Functions¶
Type | Name |
---|---|
void | DeInit () Deinitializes the GPIO pin. |
GPIO () |
|
Config & | GetConfig () |
void | Init () Initialize the GPIO using the internalConfig struct. |
void | Init (const Config & cfg) Initialize the GPIO from aConfig struct. |
void | Init (Pin p, const Config & cfg) Initialize the GPIO with a Configuration struct, and explicit pin. |
void | Init (Pin p, Mode m=Mode::INPUT, Pull pu=Pull::NOPULL, Speed sp=Speed::LOW) Explicity initialize all configuration for the GPIO . |
bool | Read () Reads the state of the GPIO . |
void | Toggle () flips the current state of the GPIO . If it was HIGH, it will go LOW, and vice versa. |
void | Write (bool state) Changes the state of the GPIO hardware when configured as an OUTPUT. |
Detailed Description¶
peripheral control over a single GPIO
Button Input (with internal Pullup resistor)
Output Example (perfect for blinking an LED)
Public Types Documentation¶
enum Mode¶
Mode of operation for the specified GPIO .
enum Pull¶
Configures whether an internal Pull up or Pull down resistor is used.
Internal Pull up/down resistors are typically 40k ohms, and will be between 30k and 50k
When the Pin is configured in Analog mode, the pull up/down resistors are disabled by hardware.
enum Speed¶
Output speed controls the drive strength, and slew rate of the pin.
Public Functions Documentation¶
function DeInit¶
Deinitializes the GPIO pin.
function GPIO¶
function GetConfig¶
Return a reference to the internal Config struct
function Init [¼]¶
Initialize the GPIO using the internalConfig struct.
function Init [2/4]¶
Initialize the GPIO from aConfig struct.
Parameters:
cfg
reference to a Config struct populated with the desired settings
function Init [¾]¶
Initialize the GPIO with a Configuration struct, and explicit pin.
Parameters:
p
Pin specifying the physical connection on the hardwarecfg
reference to a Config struct populated with the desired settings. Config::pin will be overwritten
function Init [4/4]¶
Explicity initialize all configuration for the GPIO .
Parameters:
p
Pin specifying the physical connection on the hardwarem
Mode specifying the behavior of the GPIO (input, output, etc.). Defaults to Mode::INPUTpu
Pull up/down state for the GPIO. Defaults to Pull::NOPULLsp
Speed setting for drive strength/slew rate. Defaults to Speed::Slow
function Read¶
Reads the state of the GPIO .
Returns:
State of the GPIO unless Mode is set to Mode::Analog, then always false
function Toggle¶
flips the current state of the GPIO . If it was HIGH, it will go LOW, and vice versa.
function Write¶
Changes the state of the GPIO hardware when configured as an OUTPUT.
Parameters:
state
setting true writes an output HIGH, while setting false writes an output LOW.
The documentation for this class was generated from the following file external-docs/libDaisy/src/per/gpio.h