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); }
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; }