/*****************************************************************************
** Function name: SSPSend
**
** Descriptions: Send a block of data to the SSP port, the
** first parameter is the buffer pointer, the 2nd
** parameter is the block length.
**
** parameters: buffer pointer, and the block length
** Returned value: None
**
*****************************************************************************/
void SSPSend( uint8_t *buf, uint32_t Length )
{
uint32_t i;
uint8_t Dummy = Dummy;
------------------------------这步含义是什么?
for ( i = 0; i < Length; i++ )
{
/* Move on only if NOT busy and TX FIFO not full. */
while ( (LPC_SSP0->SR & (SSPSR_TNF|SSPSR_BSY)) != SSPSR_TNF );
LPC_SSP0->DR = *buf;
buf++;
#if !LOOPBACK_MODE
while ( (LPC_SSP0->SR & (SSPSR_BSY|SSPSR_RNE)) != SSPSR_RNE );
/* Whenever a byte is written, MISO FIFO counter increments, Clear FIFO
on MISO. Otherwise, when SSP0Receive() is called, previous data byte
is left in the FIFO. */
Dummy = LPC_SSP0->DR;
#else
/* Wait until the Busy bit is cleared. */
while ( LPC_SSP0->SR & SSPSR_BSY );
#endif
}
return;
}
此帖出自
小平头技术问答
一周热门 更多>