spi_bitbang.h
Go to the documentation of this file.00001
00047 #ifndef DRV_SPI_BITBANG_H
00048 #define DRV_SPI_BITBANG_H
00049
00050 #include "cfg/cfg_spi_bitbang.h"
00051
00052 #include <cfg/compiler.h>
00053
00059 #define SPI_LSB_FIRST 1
00060 #define SPI_MSB_FIRST 2
00061
00062 #if CONFIG_SPI_DATAORDER == SPI_LSB_FIRST
00063 #define SPI_DATAORDER_START 1
00064 #define SPI_DATAORDER_SHIFT(i) ((i) <<= 1)
00065 #elif CONFIG_SPI_DATAORDER == SPI_MSB_FIRST
00066 #define SPI_DATAORDER_START 0x80
00067 #define SPI_DATAORDER_SHIFT(i) ((i) >>= 1)
00068 #endif
00069
00070 void spi_write(const void *buf, size_t len);
00071 void spi_read(void *buf, size_t len);
00072 uint8_t spi_sendRecv(uint8_t c);
00073 void spi_init(void);
00074 void spi_assertSS(void);
00075 void spi_deassertSS(void);
00076
00077 #endif