20#if defined(USE_RPI) && !defined(SKIP_HARDWARE_SETUP)
21#include "FileStream.h"
22#include "HardwareGPIO_RPI.h"
23#include "HardwareI2C_RPI.h"
24#include "HardwareSPI_RPI.h"
48 Logger.info(
"Using Raspberry Pi hardware interfaces");
54 Logger.warning(
"GPIO, I2C, SPI set up for Raspberry Pi");
60 return gpio && i2c && spi;
67 if (is_default_objects_active) {
75 HardwareI2C_RPI* getI2C() {
return &i2c; }
76 HardwareSPI_RPI* getSPI() {
return &spi; }
79 HardwareGPIO_RPI gpio;
82 bool is_default_objects_active =
false;
We use the FileStream class to be able to provide Serail, Serial1 and Serial2 outside of the Arduino ...
Definition FileStream.h:30
Abstract interface for providing GPIO hardware implementations.
Definition Sources.h:66
void setGPIO(HardwareGPIO *gpio)
Set the GPIO implementation directly.
Definition GPIOWrapper.h:153
GPIO hardware abstraction for Raspberry Pi in the Arduino emulator.
Definition HardwareGPIO_RPI.h:41
void begin()
Initialize the GPIO hardware interface for Raspberry Pi.
Definition HardwareGPIO_RPI.cpp:36
Sets up hardware interfaces for Raspberry Pi (GPIO, I2C, SPI).
Definition HardwareSetupRPI.h:32
~HardwareSetupRPI()
Destructor. Cleans up hardware interfaces.
Definition HardwareSetupRPI.h:42
bool begin(bool asDefault=true)
Initializes hardware pointers to Raspberry Pi interfaces.
Definition HardwareSetupRPI.h:47
HardwareSetupRPI()=default
Constructor. Initializes hardware interfaces.
void end()
Resets hardware pointers to nullptr.
Definition HardwareSetupRPI.h:66
Abstract interface for providing I2C hardware implementations.
Definition Sources.h:36
void setI2C(HardwareI2C *i2c)
defines the i2c implementation: use nullptr to reset.
Definition I2CWrapper.h:74
Abstract interface for providing SPI hardware implementations.
Definition Sources.h:51
void setSPI(HardwareSPI *spi)
defines the spi implementation: use nullptr to reset.
Definition SPIWrapper.h:72
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31
I2CWrapper Wire
Global Wire instance used by Arduino API functions and direct access.
Definition I2CWrapper.cpp:24
SPIWrapper SPI
Global SPI instance used by Arduino API and direct access.
Definition SPIWrapper.cpp:27
GPIOWrapper GPIO
Global GPIO instance used by Arduino API functions and direct access.
Definition GPIOWrapper.cpp:35
static FileStream Serial2("/dev/serial0")
Second hardware serial port for Raspberry Pi.
static HardwareSetupRPI RPI
Global instance for Raspberry Pi hardware setup.
Definition HardwareSetupRPI.h:91