spi_bitbang.h
Go to the documentation of this file.00001
00043 #ifndef DRV_SPI_BITBANG_H
00044 #define DRV_SPI_BITBANG_H
00045
00046 #include <cfg/compiler.h>
00047 #include <appconfig.h>
00048
00053 #define SPI_LSB_FIRST 1
00054 #define SPI_MSB_FIRST 2
00055
00056
00057 #if CONFIG_SPI_DATAORDER == SPI_LSB_FIRST
00058 #define SPI_DATAORDER_START 1
00059 #define SPI_DATAORDER_SHIFT(i) ((i) <<= 1)
00060 #elif CONFIG_SPI_DATAORDER == SPI_MSB_FIRST
00061 #define SPI_DATAORDER_START 0x80
00062 #define SPI_DATAORDER_SHIFT(i) ((i) >>= 1)
00063 #endif
00064
00065 void spi_write(const void *buf, size_t len);
00066 void spi_read(void *buf, size_t len);
00067 uint8_t spi_sendRecv(uint8_t c);
00068 void spi_init(void);
00069 void spi_assertSS(void);
00070 void spi_deassertSS(void);
00071
00072 #endif