Merge pull request #3481 from cesanta/spi

unify SPI helper APIs
This commit is contained in:
Sergey Lyubka authored and GitHub committed 2026-04-03 11:39:33 +01:00
commit 02e01f90b9
18 files changed
+75 -104

No files matched your search

@@ -8,7 +8,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