mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-06 10:27:34 +00:00
Added gpio pin implementation for raspi
This commit is contained in:
21
src/raspi/gpio_pin.cpp
Normal file
21
src/raspi/gpio_pin.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <sta/raspi/gpio_pin.hpp>
|
||||
#ifdef STA_RASPI_GPIO_ENABLED
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
#include <sta/lang.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
RaspiGpioPin::RaspiGpioPin(uint8_t pin, GpioMode mode) : pin_{pin}, mode_{mode}
|
||||
{
|
||||
pinMode(pin, mode == GpioMode::GPIO_INPUT ? INPUT : OUTPUT);
|
||||
}
|
||||
|
||||
void RaspiGpioPin::setState(GpioPinState state)
|
||||
{
|
||||
digitalWrite(pin_, state == GpioPinState::GPIO_LOW ? LOW : HIGH);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_ARDUINO_GPIO_ENABLED
|
Reference in New Issue
Block a user