20 #ifndef RTLIB_CORE_STM32F4_GPIO_H_
21 #define RTLIB_CORE_STM32F4_GPIO_H_
28 #include <libopencm3/stm32/gpio.h>
57 enum struct Mode : uint8_t {
248 GPIO(
GPIO&& other) noexcept = default;
255 GPIO& operator=(
GPIO&& other) noexcept = default;
270 GPIO& operator=(const
GPIO&) = delete;
283 void Set(
bool state) const;
311 void InitRcc(
Port port) const;
320 void SetAltFn(uint8_t altfn);
329 const
Pinout& GetPinout()
const {
return pin_; }
340 #endif // defined(STM32F4)
342 #endif // RTLIB_CORE_STM32F4_GPIO_H_
unsigned Port
Type definition for MCU Port.
Definition: util.h:41
Drive GPIO output using open-drain (i.e. only pull to GND).
Speed
Enumeration for different GPIO output speeds.
Definition: gpio.h:91
AltFn altfn
GPIO Alternate Function Selection.
Definition: gpio.h:208
Pullup
Enumeration for different internal pull-up states.
Definition: gpio.h:125
uint8_t AltFn
Type definition for GPIO alternate function selection.
Definition: gpio.h:48
Drive GPIO output using push-pull (i.e. actively pushed to VCC/pulled to GND).
Use this GPIO as digital input.
std::pair< Port, Pin > Pinout
Type definition for MCU Pinout.
Definition: util.h:49
Use this GPIO as analog I/O.
GPIO(const Config &config)
Conversion constructor.
Definition: gpio.cpp:32
Pullup pullup
Whether to use MCU's internal pull-up/down resistor.
Definition: gpio.h:194
Use the internal pull-up resistor.
DriverType driver
GPIO Output Driver Type.
Definition: gpio.h:201
Use this GPIO as an alternate function.
bool Read() const
Reads the current logic state of the managed GPIO.
Definition: gpio.cpp:96
void Toggle() const
Toggles GPIO state. Logic High -> Logic Low and vice versa.
Definition: gpio.cpp:108
Configuration for GPIO.
Definition: gpio.h:167
Mode
Enumeration for different GPIO modes.
Definition: gpio.h:57
Speed speed
GPIO Output Speed.
Definition: gpio.h:187
Utility helpers for core library.
Mode mode
GPIO Mode.
Definition: gpio.h:180
void Set(bool state) const
Sets new GPIO state.
Definition: gpio.cpp:100
STM32F4xx-specific HAL implementation for GPIO pins.
Definition: gpio.h:41
Do not use the internal pull-up/pull-down resistor (i.e. floating mode).
Use this GPIO as digital output.
Pinout pin
GPIO Pin to enable and initialize.
Definition: gpio.h:173
Use the internal pull-down resistor.
void Reset() const
Resets the GPIO to its original configuration, i.e. when the RESET button is first pushed...
Definition: gpio.cpp:112
DriverType
Enumeration for GPIO output driver modes.
Definition: gpio.h:153