Beispiel #1
0
/*
 * Send using hardware SPI to our device
 */
void ws2803_shift_out(uint8_t * bufor)
{
	for (uint8_t var = 0; var < WS2803_LED_CNT; var++)
	{
		SPI_send_byte( bufor[var] );

	}
	_delay_us(500);						// default time to shift out the data - TODO:potential to be replaced with interrupt
}
Beispiel #2
0
u08 SPI_transfer_byte(u08 data)
{
	// send the given data
	SPI_send_byte(data);
	// wait for transfer to complete
	#ifdef SPI_USEINT
		while(!SPI_transfer_complete);
	#else
		while(!(SPSR) & (1<<SPIF));
		// *** reading of the SPSR and SPDR are crucial
		// *** to the clearing of the SPIF flag
		// *** in non-interrupt mode
		//inp(SPDR);
		// set flag
		SPI_transfer_complete = 1;
	#endif
	// return the received data
	return SPDR;
}