mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Added first implementations for Arduino
This commit is contained in:
44
include/sta/devices/arduino/gpio_pin.hpp
Normal file
44
include/sta/devices/arduino/gpio_pin.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Wrapper for Arduino GPIO pins.
|
||||
*/
|
||||
#ifndef STA_CORE_ARDUINO_GPIO_PIN_HPP
|
||||
#define STA_CORE_ARDUINO_GPIO_PIN_HPP
|
||||
|
||||
// Only enable module on Arduino platform w/ HAL GPIO module enabled
|
||||
#include <sta/config.hpp>
|
||||
|
||||
#if defined(STA_PLATFORM_ARDUINO) || defined(DOXYGEN)
|
||||
|
||||
#include <sta/gpio_pin.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
class ArduinoGpioPin : public GpioPin
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param port GPIO port
|
||||
* @param pin Pin index
|
||||
*/
|
||||
ArduinoGpioPin(uint16_t pin);
|
||||
|
||||
void setState(GpioPinState state) override;
|
||||
|
||||
GpioPinState getState() override;
|
||||
|
||||
/**
|
||||
* @brief Get pin index for pin.
|
||||
*
|
||||
* @return Pin index
|
||||
*/
|
||||
uint16_t getPin() const;
|
||||
private:
|
||||
uint16_t pin_; /**< GPIO pin */
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
#endif // STA_ARDUINO_GPIO_ENABLED
|
||||
|
||||
#endif // STA_CORE_ARDUINO_GPIO_PIN_HPP
|
Reference in New Issue
Block a user