HAL implementation for GPIO pins.
More...
#include <gpio.h>
|
void | Init (GPIOMode_TypeDef mode, GPIOSpeed_TypeDef speed, uint32_t rcc=0) |
| Performs initialization of this GPIO. More...
|
|
void | Rcc (FunctionalState state, uint32_t rcc=0) |
| Enables/Disables RCC. More...
|
|
HAL implementation for GPIO pins.
GPIO::GPIO |
( |
const Config & |
config | ) |
|
|
explicit |
Constructor for Gpio class.
- Parameters
-
config | GPIO configuration settings |
uint16_t GPIO::GetPin |
( |
| ) |
|
- Returns
- Pin mask representation of currently configured pin.
Under the hood this returns the value of GPIO_Pin_X where X is the pin number. This differs from GPIO_PinSourceX in that it returns the register mask value ( 1 << X )
of the pin eg. Pin 15 -> 0x8000 whereas GPIO_PinSourceX returns the actual pin number eg. 0x000F
uint16_t GPIO::GetPinSource |
( |
| ) |
|
- Returns
- Pin number representation of currently configured pin.
Under the hood this returns the value of GPIO_PinSourceX where X is the pin number. This differs from GPIO_Pin_X in that it returns the actual number of the pin eg. Pin 15 -> 0x000F, whereas GPIO_Pin_X returns a register mask value, eg. ( 1 << X )
GPIO_TypeDef * GPIO::GetPort |
( |
| ) |
|
- Returns
- Port for the current GPIO
void GPIO::Init |
( |
GPIOMode_TypeDef |
mode, |
|
|
GPIOSpeed_TypeDef |
speed, |
|
|
uint32_t |
rcc = 0 |
|
) |
| |
|
protected |
Performs initialization of this GPIO.
- Parameters
-
mode | GPIO mode |
speed | GPIO maximum output speed |
rcc | Extra configuration values for Reset and Clock Control |
void GPIO::Rcc |
( |
FunctionalState |
state, |
|
|
uint32_t |
rcc = 0 |
|
) |
| |
|
protected |
Enables/Disables RCC.
- Parameters
-
state | ENABLE or DISABLE |
rcc | Extra configuration values for Reset and Clock Control |
Read the current logic state of GPIO.
- Returns
- Current state of GPIO, where
true
represents a high value, and false
represents a low value.
void GPIO::Set |
( |
bool |
state | ) |
|
Sets this GPIO state based on passed in boolean.
- Parameters
-
state | New state of GPIO
Value | Effect |
true | Drives the GPIO pin to logic high |
false | Drives the GPIO pin to logic low |
|
Toggles GPIO state, Logic High -> Logic Low and vice versa.
The documentation for this class was generated from the following files: