@@ -202,6 +202,7 @@ void tuh_max3421_spi_cs_api(uint8_t rhport, bool active) {
202
202
return ;
203
203
}
204
204
Adafruit_USBH_Host *host = Adafruit_USBH_Host::_instance;
205
+ SPIClass *spi = host->_spi ;
205
206
206
207
if (active) {
207
208
// MAX3421e max clock is 26MHz
@@ -213,10 +214,10 @@ void tuh_max3421_spi_cs_api(uint8_t rhport, bool active) {
213
214
uint32_t const max_clock = 26000000ul ;
214
215
#endif
215
216
216
- host-> _spi ->beginTransaction (SPISettings (max_clock, MSBFIRST, SPI_MODE0));
217
+ spi ->beginTransaction (SPISettings (max_clock, MSBFIRST, SPI_MODE0));
217
218
digitalWrite (Adafruit_USBH_Host::_instance->_cs , LOW);
218
219
} else {
219
- host-> _spi ->endTransaction ();
220
+ spi ->endTransaction ();
220
221
digitalWrite (Adafruit_USBH_Host::_instance->_cs , HIGH);
221
222
}
222
223
}
@@ -229,6 +230,7 @@ bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const *tx_buf,
229
230
return false ;
230
231
}
231
232
Adafruit_USBH_Host *host = Adafruit_USBH_Host::_instance;
233
+ SPIClass *spi = host->_spi ;
232
234
233
235
#ifdef ARDUINO_ARCH_SAMD
234
236
// SAMD cannot use transfer(tx_buf, rx_buf, len) API since it default to use
@@ -240,16 +242,16 @@ bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const *tx_buf,
240
242
if (tx_buf) {
241
243
data = tx_buf[count];
242
244
}
243
- data = host-> _spi ->transfer (data);
245
+ data = spi ->transfer (data);
244
246
245
247
if (rx_buf) {
246
248
rx_buf[count] = data;
247
249
}
248
250
}
249
251
#elif defined(ARDUINO_ARCH_ESP32)
250
- host-> _spi ->transferBytes (tx_buf, rx_buf, xfer_bytes);
252
+ spi ->transferBytes (tx_buf, rx_buf, xfer_bytes);
251
253
#else
252
- host-> _spi ->transfer (tx_buf, rx_buf, xfer_bytes);
254
+ spi ->transfer (tx_buf, rx_buf, xfer_bytes);
253
255
#endif
254
256
255
257
return true ;
0 commit comments