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/cfg_spi_bitbang.h"
00047
00048 #include <cfg/compiler.h>
00049
00054 #define SPI_LSB_FIRST 1
00055 #define SPI_MSB_FIRST 2
00056
00057
00058 #if CONFIG_SPI_DATAORDER == SPI_LSB_FIRST
00059 #define SPI_DATAORDER_START 1
00060 #define SPI_DATAORDER_SHIFT(i) ((i) <<= 1)
00061 #elif CONFIG_SPI_DATAORDER == SPI_MSB_FIRST
00062 #define SPI_DATAORDER_START 0x80
00063 #define SPI_DATAORDER_SHIFT(i) ((i) >>= 1)
00064 #endif
00065
00066 void spi_write(const void *buf, size_t len);
00067 void spi_read(void *buf, size_t len);
00068 uint8_t spi_sendRecv(uint8_t c);
00069 void spi_init(void);
00070 void spi_assertSS(void);
00071 void spi_deassertSS(void);
00072
00073 #endif