//spi in out
unsigned char HW_MasterIO(unsigned char HW_SPI_out)
{
uint8 BitCounter; /* bit counter */
uint8 TempWriteData; /* temporarily store the data */
uint8 TempReadData; /* temporarily store the data */
TempWriteData=HW_SPI_out;
for (BitCounter=0; BitCounter<8; BitCounter++)
{
/* give the correspond bit to mosi */
if ((TempWriteData&0x80) == 0x80)
{
WM_MOSI = 1;
}
else
{
WM_MOSI = 0;
}
/* modify the data */
TempWriteData = TempWriteData<<1;