You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
746 B
54 lines
746 B
|
|
#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*********************************/
|
|
|
|
|
|
|
|
|