Add HAL GPIO pin implementation

This commit is contained in:
Henrik Stickann
2022-04-09 21:47:55 +02:00
parent a068681b31
commit bf037b03ec
2 changed files with 64 additions and 0 deletions

19
src/hal/gpio_pin.cpp Normal file
View File

@@ -0,0 +1,19 @@
#include <sta/hal/gpio_pin.hpp>
#ifdef STA_HAL_GPIO_ENABLE
namespace sta
{
HalGpioPin::HalGpioPin(GPIO_TypeDef * port, uint16_t pin)
: port_{port}, pin_{pin}
{}
void HalGpioPin::setState(GpioPinState state)
{
HAL_GPIO_WritePin(port_, pin_, (state == GpioPinState::LOW) ? GPIO_PIN_RESET : GPIO_PIN_SET);
}
} // namespace sta
#endif // STA_HAL_GPIO_ENABLE