GPIO Access class.
More...
#include <GPIO.hpp>
|
enum | PinFunction { PIN_INPUT = 0x00,
PIN_OUTPUT = 0x01,
PIN_ALTERNATE = 0x02,
PIN_ANALOG = 0x03
} |
|
enum | PinMode {
PullNone = 0,
PullUp = 1,
PullDown = 2,
OpenDrain = 3,
PullDefault = PullNone
} |
|
enum | PortName {
PortA = 0,
PortB = 1,
PortC = 2,
PortD = 3,
PortF = 5
} |
|
enum | PinSpeed { Slow = 0x00,
Medium = 0x01,
Fast = 0x03
} |
|
GPIO Access class.
usage:
Pin Function
Enumerator |
---|
PIN_INPUT |
|
PIN_OUTPUT |
|
PIN_ALTERNATE |
|
PIN_ANALOG |
|
Pin Mode
Enumerator |
---|
PullNone |
|
PullUp |
|
PullDown |
|
OpenDrain |
|
PullDefault |
|
Port Name
Enumerator |
---|
PortA |
|
PortB |
|
PortC |
|
PortD |
|
PortF |
|
Pin Speed
Enumerator |
---|
Slow |
|
Medium |
|
Fast |
|
GPIO initiation function.
Initiates a specific pin, enabling the peripheral clock and setting it's properties
- Parameters
-
pin_name | The chip pin name |
func | The function of the pin (one of the PinFunction) |
mode | The Pullup/Pulldown/OpenDrain of the pin |
speed | The pin speed (more speed = more energy) |
- Returns
Change the pin direction.
After the pin is initialized it allow to change the pin direction
- Parameters
-
func | The pin function as per PinFunction |
void STM32LIB::GPIO::change_speed |
( |
PinSpeed |
speed | ) |
|
|
inline |
Change the pin speed.
After the pin is initialized it allow to change the pin speed
- Parameters
-
func | The pin speed as per PinSpeed |
void STM32LIB::GPIO::change_mode |
( |
PinMode |
mode | ) |
|
|
inline |
Change the pin mode.
After the pin is initialized it allow to change the pin mode
- Parameters
-
func | The pin function as per PinMode |
Read the pin status.
- Returns
- True if pin voltage = vcc, false otherwise
void GPIO::write |
( |
bool |
value | ) |
|
|
inline |
Write to the pin.
Use atomic write
- Parameters
-
value | The value to write to the pin |
Toggle the pin status.
It uses a more slowly method than the read() function
void STM32LIB::GPIO::disableInterrupt |
( |
void |
| ) |
|
|
inline |
void STM32LIB::GPIO::bind |
( |
wink::slot< void(uint16_t)> |
handler | ) |
|
|
inline |
GPIO_TypeDef* STM32LIB::GPIO::gpioX |
|
private |
uint16_t STM32LIB::GPIO::pin_mask |
|
private |
The documentation for this class was generated from the following files: