60 lines
1.1 KiB
C++

/**
* @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 <stdint.h>
namespace sta
{
/**
* @brief Describes the pin mode of the GPIO pin.
*
*/
enum class PinMode
{
GPIO_INPUT,
GPIO_OUTPUT
};
/**
* @brief A wrapper class for Arduino GPIO pins.
*
* @ingroup sta_core_arduino
*/
class ArduinoGpioPin : public GpioPin
{
public:
/**
* @param pin Pin index
* @param pinMode The pin mode
*/
ArduinoGpioPin(uint16_t pin, PinMode mode);
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