2021-03-14 07:00:33 +00:00
|
|
|
#ifndef __USER_SPI_DRIVER_H
|
|
|
|
#define __USER_SPI_DRIVER_H
|
|
|
|
|
2021-03-14 08:24:55 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2021-03-14 07:00:33 +00:00
|
|
|
typedef struct {
|
|
|
|
int spidev_fd;
|
2021-03-17 15:37:29 +00:00
|
|
|
uint32_t speed_hz;
|
2021-03-14 08:24:55 +00:00
|
|
|
} user_spi_driver_t;
|
|
|
|
|
2021-03-17 16:40:39 +00:00
|
|
|
#define SPIDEV_MAX_TRANSFER_SIZE 4096
|
|
|
|
|
2021-03-21 16:01:12 +00:00
|
|
|
int user_spi_driver_init(user_spi_driver_t *spi, char *path, uint32_t speed_hz);
|
|
|
|
int user_spi_driver_deinit(user_spi_driver_t *spi);
|
|
|
|
int user_spi_driver_xfer(user_spi_driver_t *spi, uint8_t *tx_buf,
|
2021-03-18 15:50:37 +00:00
|
|
|
uint8_t *rx_buf, uint32_t len);
|
2021-03-14 15:47:28 +00:00
|
|
|
|
2021-03-14 15:59:30 +00:00
|
|
|
#endif
|