예제 #1
0
euint8 if_spiSend(hwInterface *iface, euint8 outgoing)
{
	euint8 incoming;

#if ( HW_ENDPOINT_LPC2000_SPINUM == 0 )
	SELECT_CARD();
	S0SPDR = outgoing;
	while( !(S0SPSR & (1<<SPIF)) ) ;
	incoming = S0SPDR;
	UNSELECT_CARD();
#endif

#if ( HW_ENDPOINT_LPC2000_SPINUM == 1 )
	// SELECT_CARD();  // done by hardware
	while( !(SSPSR & (1<<TNF)) ) ;
	SSPDR = outgoing;
	while( !(SSPSR & (1<<RNE)) ) ;
	incoming = SSPDR;
	// UNSELECT_CARD();  // done by hardware
#endif



	return(incoming);
}
예제 #2
0
파일: spi.c 프로젝트: swen3027/APB_R2
uint8_t if_spiSend(hwInterface * iface,  uint8_t outgoing)
{
	euint8 incoming;

	SELECT_CARD();
	LPC_SPI->SPDR = outgoing;
	while (!(LPC_SPI->SPSR & (1 << SPIF)));
	incoming = LPC_SPI->SPDR;
	UNSELECT_CARD();
	return incoming;
}