Esempio n. 1
0
//*****************************************************************************
//
//! SpiReadDataSynchronous
//!
//!  @param  data  buffer to read
//!  @param  size  buffer's size
//!
//!  @return none
//!
//!  @brief  Spi read operation
//
//*****************************************************************************
void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
{
#if 0
	unsigned char flag = 1;
    unsigned char *data_to_send = tSpiReadHeader;

	while (size--)
    {
		SpiDMATXReconfig(data_to_send,1);
		if(flag--)
		SpiDMARXReconfig(data,size+1);
		data++;
    }
#endif
#if 1
    long i = 0;
    unsigned char *data_to_send = tSpiReadHeader;

    for (i = 0; i < size; i++)
    {
        while (!(TXBufferIsEmpty()))
            ;
        //Dummy write to trigger the clock
        SPI_I2S_SendData(SPI_BASE, data_to_send[0]);
        while (!(RXBufferIsNotEmpty()))
            ;
        data[i] = SPI_I2S_ReceiveData(SPI_BASE);
    }
#endif


}
Esempio n. 2
0
//*****************************************************************************
//
//!  SpiWriteDataSynchronous
//!
//!  @param  data  buffer to write
//!  @param  size  buffer's size
//!
//!  @return none
//!
//!  @brief  Spi write operation
//
//*****************************************************************************
void SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
{
#if 0
	unsigned char flag =1;
	while (size--)
	{
		SpiDMATXReconfig(data,1);
		if(flag--)
		SpiDMARXReconfig(wlan_rx_buffer,size);
        data++;
	}
#endif
#if 1
    while (size)
    {
        while (!(TXBufferIsEmpty()))
            ;
        SPI_I2S_SendData(SPI_BASE, *data);
        while (!(RXBufferIsNotEmpty()))
            ;
        SPI_I2S_ReceiveData(SPI_BASE);
        size--;
        data++;
    }
#endif	

}
Esempio n. 3
0
//*****************************************************************************
//
//!  SpiWriteDataSynchronous
//!
//!  @param  data  buffer to write
//!  @param  size  buffer's size
//!
//!  @return none
//!
//!  @brief  Spi write operation
//
//*****************************************************************************
void
SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
{
	while (size)
	{   	
		while (!(TXBufferIsEmpty()));
		UCB1TXBUF = *data;
		while (!(RXBufferIsEmpty()));
		UCB1RXBUF;
		size --;
		data++;
	}
}
Esempio n. 4
0
//*****************************************************************************
//
//! SpiReadDataSynchronous
//!
//!  @param  data  buffer to read
//!  @param  size  buffer's size
//!
//!  @return none
//!
//!  @brief  Spi read operation
//
//*****************************************************************************
void
SpiReadDataSynchronous(unsigned char *data, unsigned short size)
{
	long i = 0;
	unsigned char *data_to_send = tSpiReadHeader;
	
	for (i = 0; i < size; i ++)
	{
		while (!(TXBufferIsEmpty()));
		//Dummy write to trigger the clock
		UCB1TXBUF = data_to_send[0];
		while (!(RXBufferIsEmpty()));
		data[i] = UCB1RXBUF;
	}
}