29 lines
588 B
C
29 lines
588 B
C
|
#ifndef __NRF52_SPI_H__
|
||
|
#define __NRF52_SPI_H__
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#include "driver.h"
|
||
|
|
||
|
int spi_open(const struct driver *drv);
|
||
|
int spi_close(const struct driver *drv);
|
||
|
|
||
|
int spi_read(const struct driver *drv, char *buffer, unsigned int len);
|
||
|
int spi_write(const struct driver *drv, const char *buffer, unsigned int len);
|
||
|
|
||
|
struct spi {
|
||
|
uint8_t sck_pin;
|
||
|
uint8_t mosi_pin;
|
||
|
uint8_t miso_pin;
|
||
|
uint8_t ss_pin;
|
||
|
};
|
||
|
|
||
|
static const struct driver_fp spi_fp = {
|
||
|
.open = spi_open,
|
||
|
.close = spi_close,
|
||
|
.read = spi_read,
|
||
|
.write = spi_write,
|
||
|
.ioctl = NULL
|
||
|
};
|
||
|
|
||
|
#endif
|