|
libxr
1.0
Want to be the best embedded framework
|
CH32 GPIO 驱动实现 / CH32 GPIO driver implementation. More...
#include <ch32_gpio.hpp>
Public Member Functions | |
| CH32GPIO (GPIO_TypeDef *port, uint16_t pin, GPIO::Direction direction=GPIO::Direction::OUTPUT_PUSH_PULL, GPIO::Pull pull=GPIO::Pull::NONE, IRQn_Type irq=NonMaskableInt_IRQn) | |
| 构造 GPIO 对象 / Construct GPIO object | |
| bool | Read () override |
| 读取 GPIO 引脚状态。Reads the GPIO pin state. | |
| void | Write (bool value) override |
| 写入 GPIO 引脚状态。Writes the GPIO pin state. | |
| ErrorCode | EnableInterrupt () override |
| 使能 GPIO 引脚中断。Enables the GPIO pin interrupt. | |
| ErrorCode | DisableInterrupt () override |
| 禁用 GPIO 引脚中断。Disables the GPIO pin interrupt. | |
| ErrorCode | SetConfig (Configuration config) override |
| 配置 GPIO 引脚参数。Configures the GPIO pin settings. | |
| void | OnInterrupt () |
Public Member Functions inherited from LibXR::GPIO | |
| GPIO () | |
| 默认构造函数。Default constructor. | |
| ErrorCode | RegisterCallback (Callback callback) |
| 注册 GPIO 事件回调函数。Registers a callback function for GPIO events. | |
Static Public Member Functions | |
| static void | CheckInterrupt (uint32_t line) |
Static Public Attributes | |
| static CH32GPIO * | map_ [16] = {nullptr} |
| EXTI 线路映射表 / EXTI line map. | |
Private Member Functions | |
| void | ConfigureEXTI (EXTITrigger_TypeDef trigger) |
Static Private Member Functions | |
| static uint8_t | GetEXTIID (uint16_t pin) |
Private Attributes | |
| GPIO_TypeDef * | port_ |
| uint16_t | pin_ |
| IRQn_Type | irq_ |
Additional Inherited Members | |
Public Types inherited from LibXR::GPIO | |
| 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... | |
| using | Callback = LibXR::Callback<> |
Data Fields inherited from LibXR::GPIO | |
| Callback | callback_ |
| GPIO 事件的回调函数。Callback function for GPIO events. | |
CH32 GPIO 驱动实现 / CH32 GPIO driver implementation.
Definition at line 48 of file ch32_gpio.hpp.
| CH32GPIO::CH32GPIO | ( | GPIO_TypeDef * | port, |
| uint16_t | pin, | ||
| GPIO::Direction | direction = GPIO::Direction::OUTPUT_PUSH_PULL, | ||
| GPIO::Pull | pull = GPIO::Pull::NONE, | ||
| IRQn_Type | irq = NonMaskableInt_IRQn ) |
构造 GPIO 对象 / Construct GPIO object
Definition at line 94 of file ch32_gpio.cpp.
|
static |
Definition at line 165 of file ch32_gpio.cpp.
|
private |
Definition at line 179 of file ch32_gpio.cpp.
|
overridevirtual |
禁用 GPIO 引脚中断。Disables the GPIO pin interrupt.
Implements LibXR::GPIO.
Definition at line 151 of file ch32_gpio.cpp.
|
overridevirtual |
使能 GPIO 引脚中断。Enables the GPIO pin interrupt.
Implements LibXR::GPIO.
Definition at line 145 of file ch32_gpio.cpp.
|
staticprivate |
Definition at line 254 of file ch32_gpio.cpp.
| void CH32GPIO::OnInterrupt | ( | ) |
Definition at line 157 of file ch32_gpio.cpp.
|
inlineoverridevirtual |
读取 GPIO 引脚状态。Reads the GPIO pin state.
Implements LibXR::GPIO.
Definition at line 58 of file ch32_gpio.hpp.
|
inlineoverridevirtual |
配置 GPIO 引脚参数。Configures the GPIO pin settings.
Implements LibXR::GPIO.
Definition at line 76 of file ch32_gpio.hpp.
|
inlineoverridevirtual |
写入 GPIO 引脚状态。Writes the GPIO pin state.
| value | 要写入的状态,true 表示高电平,false 表示低电平。The value to write, true for high, false for low. |
Implements LibXR::GPIO.
Definition at line 60 of file ch32_gpio.hpp.
|
private |
Definition at line 132 of file ch32_gpio.hpp.
|
inlinestatic |
|
private |
Definition at line 131 of file ch32_gpio.hpp.
|
private |
Definition at line 130 of file ch32_gpio.hpp.