20#if defined(USE_FIRMATA) && !defined(SKIP_HARDWARE_SETUP)
21#include "FirmataTransport.h"
22#include "HardwareGPIO_FIR.h"
23#include "HardwareI2C_FIR.h"
24#include "HardwareSPI_FIR.h"
43 HardwareSetupFIRMATA() =
default;
52 : spi(spiDeviceId, spiCsPin) {}
63 Logger.info(
"Using Firmata hardware interfaces");
64 is_default_objects_active = asDefault;
66 transport.begin(stream);
67 bool gpio_ok = gpio.begin(transport);
68 bool i2c_ok = i2c.begin(transport);
69 bool spi_ok = spi.begin(transport);
73 Logger.warning(
"GPIO, I2C, SPI set up for Firmata");
79 return gpio_ok && i2c_ok && spi_ok;
86 if (is_default_objects_active) {
87 GPIO.setGPIO(
nullptr);
98 HardwareI2C_FIRMATA *getI2C() {
return &i2c; }
99 HardwareSPI_FIRMATA *getSPI() {
return &spi; }
102 FirmataTransport transport;
103 HardwareGPIO_FIRMATA gpio;
104 HardwareI2C_FIRMATA i2c;
105 HardwareSPI_FIRMATA spi;
106 bool is_default_objects_active =
false;
Abstract interface for providing GPIO hardware implementations.
Definition Sources.h:66
GPIO hardware abstraction that speaks the Firmata protocol over an arbitrary Stream (e....
Definition HardwareGPIO_FIR.h:49
Sets up hardware interfaces (GPIO, I2C, SPI) that talk to a remote board running Firmata,...
Definition HardwareSetupFIR.h:41
HardwareSetupFIRMATA(uint8_t spiDeviceId, int8_t spiCsPin=-1)
Definition HardwareSetupFIR.h:51
void end()
Resets hardware pointers to nullptr and stops the transport.
Definition HardwareSetupFIR.h:85
bool begin(Stream &stream, bool asDefault=true)
Start the shared Firmata transport and all three backends.
Definition HardwareSetupFIR.h:62
Abstract interface for providing I2C hardware implementations.
Definition Sources.h:36
Abstract interface for providing SPI hardware implementations.
Definition Sources.h:51
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 HardwareSetupFIRMATA FIRMATA
Global instance for Firmata hardware setup.
Definition HardwareSetupFIR.h:118