libxr 1.0
Want to be the best embedded framework
|
通用输入输出(GPIO)接口类。General Purpose Input/Output (GPIO) interface class. More...
#include <gpio.hpp>
Data Structures | |
struct | Configuration |
存储 GPIO 配置参数的结构体。Structure storing GPIO configuration parameters. More... | |
Public Types | |
enum class | Direction : uint8_t { INPUT , OUTPUT_PUSH_PULL , OUTPUT_OPEN_DRAIN , FALL_INTERRUPT , RISING_INTERRUPT , FALL_RISING_INTERRUPT } |
定义 GPIO 引脚的方向类型。Defines the direction types for GPIO pins. More... | |
enum class | Pull : uint8_t { NONE , UP , DOWN } |
定义 GPIO 引脚的上拉/下拉模式。Defines the pull-up/pull-down configurations for GPIO pins. More... | |
Public Member Functions | |
GPIO () | |
默认构造函数。Default constructor. | |
virtual bool | Read ()=0 |
读取 GPIO 引脚状态。Reads the GPIO pin state. | |
virtual ErrorCode | Write (bool value)=0 |
写入 GPIO 引脚状态。Writes the GPIO pin state. | |
virtual ErrorCode | EnableInterrupt ()=0 |
使能 GPIO 引脚中断。Enables the GPIO pin interrupt. | |
virtual ErrorCode | DisableInterrupt ()=0 |
禁用 GPIO 引脚中断。Disables the GPIO pin interrupt. | |
virtual ErrorCode | SetConfig (Configuration config)=0 |
配置 GPIO 引脚参数。Configures the GPIO pin settings. | |
ErrorCode | RegisterCallback (Callback<> callback) |
注册 GPIO 事件回调函数。Registers a callback function for GPIO events. | |
Data Fields | |
Callback | callback_ |
GPIO 事件的回调函数。Callback function for GPIO events. | |
通用输入输出(GPIO)接口类。General Purpose Input/Output (GPIO) interface class.
|
strong |
定义 GPIO 引脚的方向类型。Defines the direction types for GPIO pins.
Definition at line 19 of file gpio.hpp.
|
strong |
|
inline |
|
pure virtual |
禁用 GPIO 引脚中断。Disables the GPIO pin interrupt.
Implemented in LibXR::STM32GPIO.
|
pure virtual |
使能 GPIO 引脚中断。Enables the GPIO pin interrupt.
Implemented in LibXR::STM32GPIO.
读取 GPIO 引脚状态。Reads the GPIO pin state.
Implemented in LibXR::STM32GPIO.
|
inline |
注册 GPIO 事件回调函数。Registers a callback function for GPIO events.
callback | 要注册的回调函数。The callback function to register. |
Definition at line 100 of file gpio.hpp.
|
pure virtual |
配置 GPIO 引脚参数。Configures the GPIO pin settings.
Implemented in LibXR::STM32GPIO.
写入 GPIO 引脚状态。Writes the GPIO pin state.
value | 要写入的状态,true 表示高电平,false 表示低电平。The value to write, true for high, false for low. |
Implemented in LibXR::STM32GPIO.
Callback LibXR::GPIO::callback_ |