21#include "api/HardwareI2C.h"
22#include "FirmataTransport.h"
23#include <condition_variable>
60 void begin()
override;
61 void begin(
uint8_t address)
override;
66 void beginTransmission(
uint8_t address)
override;
67 size_t write(
uint8_t data)
override;
68 size_t write(
const uint8_t *data,
size_t len)
override;
70 uint8_t endTransmission(
void)
override;
72 size_t requestFrom(
uint8_t address,
size_t len,
bool stopBit)
override;
73 size_t requestFrom(
uint8_t address,
size_t len)
override;
75 int available()
override;
78 void flush()
override {}
80 void onReceive(
void (*)(
int))
override {}
81 void onRequest(
void (*)(
void))
override {}
84 void setTimeout(
unsigned long timeout_ms) { timeout_ms_ = timeout_ms; }
86 operator bool() {
return is_open; }
89 FirmataTransport *transport_ =
nullptr;
90 std::unique_ptr<FirmataTransport> owned_transport_;
92 unsigned long timeout_ms_ = 1000;
94 uint8_t current_address_ = 0;
95 std::vector<uint8_t> tx_buffer_;
98 std::condition_variable rx_cv_;
99 std::deque<uint8_t> rx_buffer_;
100 bool request_pending_ =
false;
102 void handleSysex(
const FirmataSysexMessage &msg);
Single reader thread + byte-stream parser shared by every Firmata-based hardware backend (GPIO,...
Definition FirmataTransport.h:66
I2C master implementation that speaks the Firmata protocol (I2C_REQUEST/I2C_REPLY/I2C_CONFIG SysEx me...
Definition HardwareI2C_FIR.h:49
void setTimeout(unsigned long timeout_ms)
Maximum time requestFrom() waits for the I2C_REPLY, in milliseconds.
Definition HardwareI2C_FIR.h:84
bool begin(Stream &stream)
Start talking Firmata over the given stream (owns a private transport).
Definition HardwareI2C_FIR.cpp:35
Definition HardwareI2C.h:28
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31