Files
mongoose/src/periph.h
T

19 lines
783 B
C

#pragma once
#include "arch.h"
// SPI bus abstraction for SPI-attached chips, e.g. W5500 or SPI flash, see
// mg_spi_flash_init(). Network drivers get it via the driver_data field.
// Callbacks get the spi field. txn() with NULL write sends filler bytes, with
// NULL read discards what it receives
struct mg_spi {
void *spi; // Opaque SPI bus handle passed to all callbacks
void (*begin)(void *); // Assert chip-select, start of transaction
void (*end)(void *); // Deassert chip-select, end of transaction
void (*txn)(void *, uint8_t *write, uint8_t *read, size_t); // Full duplex
};
// SPI bus for SPI-attached network chips, defined by the application.
// Used by the drivers' INIT macros, e.g. MG_TCPIP_DRIVER_W5500_INIT
extern struct mg_spi mg_spi;