#include "msp_SSPIx.h" void L0_SSPIx_WriteOneByte(TS_sspi *p,unsigned char command) { unsigned char i; for(i = 0; i < 8;i++) { if(command&0x80) { p->pf_MOSI_set(1); } else { p->pf_MOSI_set(0);; } command <<= 1; p->pf_SCLK_set(1); /// L0_spi2_delay(80); p->pf_SCLK_set(0); } } u8 L0_SSPIx_ReadOneByte(TS_sspi *p) { unsigned char result,i; p->pf_SCLK_set(0); for(i = 0;i<8; i++) { p->pf_SCLK_set(1);; result <<= 0x01; if( p->pf_MISO_get() ) { result |= 0X01; } // L0_spi2_delay(80); p->pf_SCLK_set(0); // L0_spi2_delay(80); } // L0_uart0_uchex(result); // L0_uart0_uc('.'); return result; } /******************************END*********************************/