10 constexpr uint8_t MAX_PORTS = 3;
11#elif defined(GPIOB_BASE)
12 constexpr uint8_t MAX_PORTS = 2;
14 constexpr uint8_t MAX_PORTS = 1;
20 explicit MSPM0GPIO(GPIO_Regs* port, uint32_t pin_mask, uint32_t pincm);
24 void Write(
bool value)
override;
32 static inline void OnInterrupt(GPIO_Regs* port)
34 const int idx = GetPortIndex(
reinterpret_cast<uint32_t
>(port));
35 OnInterruptDispatch(port, idx);
39 static void OnInterruptDispatch(GPIO_Regs* port,
int port_idx);
41 static constexpr int GetPortIndex(uint32_t base_addr)
43 if (base_addr == GPIOA_BASE)
48 if (base_addr == GPIOB_BASE)
54 if (base_addr == GPIOC_BASE)
69 static MSPM0GPIO* instance_map_[MAX_PORTS][32];
通用输入输出(GPIO)接口类。General Purpose Input/Output (GPIO) interface class.
Direction
定义 GPIO 引脚的方向类型。Defines the direction types for GPIO pins.
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.
存储 GPIO 配置参数的结构体。Structure storing GPIO configuration parameters.