Added I2C support for raspi & first rework of debugging

This commit is contained in:
Dario
2023-06-23 15:50:54 +01:00
parent 3cf2173433
commit 6b4acfd27b
70 changed files with 985 additions and 772 deletions

View File

@@ -0,0 +1,46 @@
#ifndef STA_CORE_RASPI_GPIO_PIN_HPP
#define STA_CORE_RASPI_GPIO_PIN_HPP
// Only enable module on Raspi platform w/ HAL GPIO module enabled
#include <sta/config.hpp>
#ifdef STA_PLATFORM_RASPI
# include <sta/devices/raspi/hal.hpp>
# define STA_RASPI_GPIO_ENABLED
#endif // STA_PLATFORM_RASPI
#if defined(STA_RASPI_GPIO_ENABLED) || defined(DOXYGEN)
#include <sta/gpio_pin.hpp>
#include <cstdint>
namespace sta
{
enum class GpioMode {
GPIO_OUTPUT,
GPIO_INPUT
};
class RaspiGpioPin : public GpioPin
{
public:
/**
* @param pin Pin index
* @param mode The mode of the GPIO pin. Either INPUT or OUTPUT
*/
RaspiGpioPin(uint8_t pin, GpioMode mode);
void setState(GpioPinState state) override;
GpioPinState getState() override;
static RaspiGpioPin * DUMMY_GPIO;
private:
uint8_t pin_;
GpioMode mode_;
};
} // namespace sta
#endif // STA_RASPI_GPIO_ENABLED
#endif // STA_CORE_RASPI_GPIO_PIN_HPP