3#include <ti/driverlib/dl_gpio.h>
11constexpr uint8_t MAX_PORTS = 3;
12#elif defined(GPIOB_BASE)
13constexpr uint8_t MAX_PORTS = 2;
15constexpr uint8_t MAX_PORTS = 1;
28 explicit MSPM0GPIO(GPIO_Regs* port, uint32_t pin_mask, uint32_t pincm);
32 void Write(
bool value)
override;
40 static inline void OnInterrupt(GPIO_Regs* port)
42 const int idx = GetPortIndex(
reinterpret_cast<uint32_t
>(port));
43 OnInterruptDispatch(port, idx);
47 static void OnInterruptDispatch(GPIO_Regs* port,
int port_idx);
49 static constexpr int GetPortIndex(uint32_t base_addr)
52 if (base_addr == GPIOA_BASE)
58 if (base_addr == GPIOB_BASE)
64 if (base_addr == GPIOC_BASE)
79 static MSPM0GPIO* instance_map_[MAX_PORTS][32];
通用输入输出(GPIO)接口类。 General Purpose Input/Output (GPIO) interface class.
Direction
定义 GPIO 引脚的方向类型 / Defines the direction types for GPIO pins.
@ INPUT
输入模式 / Input mode.
ErrorCode DisableInterrupt() override
禁用 GPIO 引脚中断 / Disables the GPIO pin interrupt.
bool Read() override
读取 GPIO 引脚状态 / Reads the GPIO pin state.
ErrorCode EnableInterrupt() override
使能 GPIO 引脚中断 / Enables the GPIO pin interrupt.
void Write(bool value) override
写入 GPIO 引脚状态 / Writes the GPIO pin state.
ErrorCode SetConfig(Configuration config) override
配置 GPIO 引脚参数 / Configures the GPIO pin settings.
LibXR 命名空间 / LibXR namespace.
ErrorCode
定义错误码枚举 / Defines an enumeration for error codes
存储 GPIO 配置参数的结构体 / Structure storing GPIO configuration parameters.