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