diff options
author | Uros Majstorovic <majstor@majstor.org> | 2025-05-28 00:00:25 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2025-05-28 00:00:25 +0200 |
commit | 040f2299065caf64dbe5228b91f8abf8add9862b (patch) | |
tree | fe8371912709f4a52c43ed8e7cc5f864a225b6bc /yocto/esp32d/spi.h | |
parent | 51181684435dc6cf1cbeaed592adb4340a33fb1e (diff) |
Diffstat (limited to 'yocto/esp32d/spi.h')
-rw-r--r-- | yocto/esp32d/spi.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/yocto/esp32d/spi.h b/yocto/esp32d/spi.h new file mode 100644 index 0000000..4d9ff86 --- /dev/null +++ b/yocto/esp32d/spi.h @@ -0,0 +1,31 @@ +#include <stdint.h> + +#define SPI_DEV "/dev/spidev0" +#define SPI_SPEED 10000000 + +#define SPI_TUN_NAME "tun0" + +#define SPI_GPIO_DEV "/dev/gpiochip3" +#define SPI_GPIO_CTS 28 +#define SPI_GPIO_RTS 25 + +#define SPI_MTU 1500 +#define SPI_SIZE_HDR 3 +#define SPI_SIZE_BUF (SPI_MTU + SPI_SIZE_HDR) +#define SPI_SIZE_RECEIVE 16 /* guestimate on number of bytes for transaction initiated by falling RTS */ + +#define SPI_SIZE_BUFQ 64 +#define SPI_SIZE_MSGQ_IN 32 +#define SPI_SIZE_MSGQ_OUT 32 + +#define SPI_MTYPE_TUN 1 + +#define SPI_OK 0 +#define SPI_ERR -1 +#define SPI_ERR_OPEN -10 +#define SPI_ERR_MSG -11 + +unsigned char *spi_alloc(void); +void spi_free(unsigned char *buffer); +int spi_xchg(unsigned char mtype, unsigned char *buffer, uint16_t len); +int spi_init(void);
\ No newline at end of file |