81 virtual void Write(
bool value) = 0;
通用输入输出(GPIO)接口类。 General Purpose Input/Output (GPIO) interface class.
Callback callback_
GPIO 事件的回调函数 / Callback function for GPIO events.
virtual bool Read()=0
读取 GPIO 引脚状态 / Reads the GPIO pin state.
virtual ErrorCode SetConfig(Configuration config)=0
配置 GPIO 引脚参数 / Configures the GPIO pin settings.
virtual ErrorCode EnableInterrupt()=0
使能 GPIO 引脚中断 / Enables the GPIO pin interrupt.
virtual ErrorCode DisableInterrupt()=0
禁用 GPIO 引脚中断 / Disables the GPIO pin interrupt.
virtual ~GPIO()=default
虚析构函数 / Virtual destructor.
Direction
定义 GPIO 引脚的方向类型 / Defines the direction types for GPIO pins.
@ OUTPUT_PUSH_PULL
推挽输出模式 / Push-pull output mode.
@ RISING_INTERRUPT
上升沿中断模式 / Rising edge interrupt mode.
@ FALL_RISING_INTERRUPT
双沿触发中断模式 / Both edge interrupt mode.
@ OUTPUT_OPEN_DRAIN
开漏输出模式 / Open-drain output mode.
@ INPUT
输入模式 / Input mode.
@ FALL_INTERRUPT
下降沿中断模式 / Falling edge interrupt mode.
ErrorCode RegisterCallback(Callback callback)
注册 GPIO 事件回调函数 / Registers a callback function for GPIO events.
virtual void Write(bool value)=0
写入 GPIO 引脚状态 / Writes the GPIO pin state.
GPIO()
默认构造函数 / Default constructor.
Pull
定义 GPIO 引脚的上拉/下拉模式。 Defines the pull-up/pull-down configurations for GPIO pins.
@ NONE
无上拉或下拉 / No pull-up or pull-down.
@ DOWN
下拉模式 / Pull-down mode.
LibXR 命名空间 / LibXR namespace.
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes
@ OK
操作成功 / Operation successful
存储 GPIO 配置参数的结构体 / Structure storing GPIO configuration parameters.
Pull pull
GPIO 上拉/下拉配置 / GPIO pull-up/pull-down configuration.
Direction direction
GPIO 引脚方向 / GPIO pin direction.