generic<C: GpioChip> struct GpioPin {
&volatile unsigned int base;
int pin;
unsigned int pin_mask;
int direction;
C chip;
}Fields
MMIO base address of the GPIO port
pin number within the port
1 << pin
GPIO_INPUT or GPIO_OUTPUT
Methods
§
static struct GpioPin<C> new(&volatile unsigned int base, int pin, int direction)source · definitionInitialize a GPIO pin: base = port base, pin = pin number (0-31; 0-15
on STM32). The chip type comes from the target:
struct GpioPin<GpioGeneric> p = std::GpioPin::new(base, 3, GPIO_INPUT);
Set pin direction (GPIO_INPUT or GPIO_OUTPUT).
Write 1 (high) or 0 (low) to an output pin.
Read pin state. Returns 0 or 1.
Toggle output pin.
GPIO_PULL_NONE, GPIO_PULL_UP or GPIO_PULL_DOWN.