From 4e3e7ac4b2b86b71e701203c9cc8fce2964622f1 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Fri, 31 Jul 2026 13:48:15 -0300 Subject: [PATCH] update stale example --- .../mqtt-client/arduino/nano-w5500-mqtt/w5500-mqtt.ino | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tutorials/mqtt/mqtt-client/arduino/nano-w5500-mqtt/w5500-mqtt.ino b/tutorials/mqtt/mqtt-client/arduino/nano-w5500-mqtt/w5500-mqtt.ino index 48307651..200ec5aa 100644 --- a/tutorials/mqtt/mqtt-client/arduino/nano-w5500-mqtt/w5500-mqtt.ino +++ b/tutorials/mqtt/mqtt-client/arduino/nano-w5500-mqtt/w5500-mqtt.ino @@ -12,7 +12,13 @@ struct mg_tcpip_spi spi = { NULL, // SPI metadata [](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); }, [](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); }, - [](void *, uint8_t c) { return SPI.transfer(c); }, // Execute transaction + [](void *, uint8_t *w, uint8_t *r, size_t n) { // Execute transaction + while (n--) { + uint8_t c = (w != NULL) ? *w++ : 0xFF; + uint8_t d = SPI.transfer(c); + if (r != NULL) *r++ = d; + } + }, }; struct mg_mgr mgr; // Mongoose event manager struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // Network interface