52 RemoteSPI() =
default;
53 RemoteSPI(
Stream* stream) { service.setStream(stream); }
54 void setStream(
Stream* stream) { service.setStream(stream); }
56 uint8_t transfer(uint8_t data) {
57 service.send(SpiTransfer8);
60 return service.receive8();
63 uint16_t transfer16(uint16_t data) {
64 service.send(SpiTransfer16);
67 return service.receive16();
70 void transfer(
void* buf,
size_t count) {
71 service.send(SpiTransfer);
72 service.send((uint32_t)count);
73 service.send(buf, count);
75 for (
size_t j=0; j<count; j++) {
76 ((uint8_t*)buf)[j] = service.receive8();
80 void usingInterrupt(
int interruptNumber) {
81 service.send(SpiUsingInterrupt);
82 service.send(interruptNumber);
86 void notUsingInterrupt(
int interruptNumber) {
87 service.send(SpiNotUsingInterrupt);
88 service.send(interruptNumber);
93 service.send(SpiBeginTransaction);
95 service.send((uint32_t)settings.getClockFreq());
96 service.send((uint8_t)settings.getBitOrder());
97 service.send((uint8_t)settings.getDataMode());
101 void endTransaction(
void) {
102 service.send(SpiEndTransaction);
106 void attachInterrupt() {
107 service.send(SpiAttachInterrupt);
111 void detachInterrupt() {
112 service.send(SpiDetachInterrupt);
117 service.send(SpiBegin);
122 service.send(SpiEnd);
126 operator bool() {
return service; }
Provides a virtualized hardware communication service for SPI, I2C, I2S, and GPIO over a stream.
Definition HardwareService.h:115