#ifndef __SPIRW_H__ #define __SPIRW_H__ #include "config.h" #if (SOFT_SPI1 != 0) #include "inout.h" #endif #define SPI_FUNC_DEF(spi) \ \ /* 初始化SPI */ \ void InitSpi##spi(void); \ \ /* 是否已经初始化 */\ u8 IsSpi##spi##Inited(void);\ /* 交换字节 */ \ u8 Spi##spi##SwapByte(u8 dat); \ /* 发送字节 */ \ void Spi##spi##WriteByte(u8 txData); \ /* 接收字节 */ \ u8 Spi##spi##ReadByte(void); \ \ /* 交换字 */ \ u16 Spi##spi##SwapWord(u16 dat); \ /* 发送字 */ \ void Spi##spi##WriteWord(u16 txData); \ /* 接收字*/ \ u16 Spi##spi##ReadWord(void); \ //------ #ifdef SRW_SPI1 SPI_FUNC_DEF(1); #endif #ifdef SRW_SPI2 SPI_FUNC_DEF(2); #endif #ifdef SRW_SPI3 SPI_FUNC_DEF(3); #endif #ifdef SRW_SPI4 SPI_FUNC_DEF(4); #endif #endif