mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
ESP32 support and changes to SPI to support ESP32
This commit is contained in:
@@ -8,14 +8,42 @@
|
||||
#include <sta/bus/spi/spi.hpp>
|
||||
|
||||
#include <sta/devices/arduino/gpio_pin.hpp>
|
||||
#include <sta/devices/arduino/hal.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
#ifdef STA_PLATFORM_ARDUINO_DEVICE_ESP32
|
||||
enum SPIBus
|
||||
{
|
||||
BUS_HSPI = HSPI,
|
||||
BUS_FSPI = FSPI
|
||||
# ifndef STA_MCU_ESP32_S3
|
||||
, BUS_VSPI = VSPI
|
||||
# endif // !STA_MCU_ESP32_S3
|
||||
};
|
||||
#endif // STA_PLATFORM_ARDUINO_DEVICE_ESP32
|
||||
|
||||
class ArduinoSPI : public SPI
|
||||
{
|
||||
public:
|
||||
ArduinoSPI(const SPISettings & settings, Mutex * mutex = nullptr);
|
||||
|
||||
#ifndef STA_PLATFORM_ARDUINO_DEVICE_ESP32
|
||||
/**
|
||||
* @brief Construct an SPI bus interface using the Arduino framework.
|
||||
*
|
||||
* @param settings The settings for the spi bus.
|
||||
* @param mutex A mutex for managing bus access in multithreaded applications. Default is a dummy mutex that is always free.
|
||||
*/
|
||||
ArduinoSPI(const SPISettings & settings, Mutex * mutex = sta::Mutex::ALWAYS_FREE);
|
||||
#else
|
||||
/**
|
||||
* @brief Construct an SPI bus interface using the Arduino framework.
|
||||
*
|
||||
* @param bus The bus to use.
|
||||
* @param settings The settings for the spi bus.
|
||||
* @param mutex A mutex for managing bus access in multithreaded applications. Default is a dummy mutex that is always free.
|
||||
*/
|
||||
ArduinoSPI(SPIBus bus, const SPISettings & settings, Mutex * mutex = sta::Mutex::ALWAYS_FREE);
|
||||
#endif // !STA_PLATFORM_ARDUINO_DEVICE_ESP32
|
||||
void transfer(uint8_t value) override;
|
||||
void transfer16(uint16_t value) override;
|
||||
void transfer(const uint8_t * buffer, size_t size) override;
|
||||
@@ -27,7 +55,7 @@ namespace sta
|
||||
void acquire() override;
|
||||
void release() override;
|
||||
private:
|
||||
|
||||
SPIClass spi_;
|
||||
};
|
||||
|
||||
class ArduinoSPIDevice : public SPIDevice
|
||||
|
10
include/sta/devices/arduino/mcu/esp32_s3.hpp
Normal file
10
include/sta/devices/arduino/mcu/esp32_s3.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef STA_CORE_ARDUINO_MCU_ESP32_S3_HPP
|
||||
#define STA_CORE_ARDUINO_MCU_ESP32_S3_HPP
|
||||
|
||||
#include <sta/devices/arduino/mcu/common.hpp>
|
||||
|
||||
#define STA_PLATFORM_ARDUINO_DEVICE_ESP32
|
||||
|
||||
#define STA_MCU_ESP32_S3
|
||||
|
||||
#endif // STA_CORE_ARDUINO_MCU_ESP32_S3_HPP
|
@@ -3,4 +3,6 @@
|
||||
|
||||
#include <sta/devices/arduino/mcu/common.hpp>
|
||||
|
||||
#define STA_PLATFORM_ARDUINO_DEVICE_ARDUINO
|
||||
|
||||
#endif // STA_CORE_ARDUINO_MCU_UNO_R3_HPPs
|
Reference in New Issue
Block a user