mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Add getter for HAL GPIO pin data
This commit is contained in:
parent
3041499ce0
commit
9ea2513e5a
@ -26,6 +26,10 @@ namespace sta
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
|
||||
GPIO_TypeDef * getPort() const;
|
||||
uint16_t getPin() const;
|
||||
uint8_t getIndex() const;
|
||||
|
||||
private:
|
||||
GPIO_TypeDef * port_; /**< GPIO port */
|
||||
uint16_t pin_; /**< GPIO pin */
|
||||
|
@ -17,6 +17,21 @@ namespace sta
|
||||
{
|
||||
HAL_GPIO_WritePin(port_, pin_, (state == GpioPinState::LOW) ? GPIO_PIN_RESET : GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
GPIO_TypeDef * HalGpioPin::getPort() const
|
||||
{
|
||||
return port_;
|
||||
}
|
||||
|
||||
uint16_t HalGpioPin::getPin() const
|
||||
{
|
||||
return pin_;
|
||||
}
|
||||
|
||||
uint8_t HalGpioPin::getIndex() const
|
||||
{
|
||||
return GPIO_GET_INDEX(port_);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user