spi.h
void spiFlush(void) {
	
	struct spi_message m;
	struct spi_transfer t = {
		.tx_buf	= spi.buffer.tx,
		.len	= spi.buffer.txPos,
	};
	
	// nothing to send? -> abort
	if (spi.buffer.txPos == 0) {return;}
	
	// send (blocking!)
	spi_message_init(&m);
	spi_message_add_tail(&t, &m);
	spi_sync(spi.dev, &m);
	
	// buffer is empty again
	spi.buffer.txPos = 0;
	
}
/** flush the currently buffered bytes onto the SPI-bus */
flush the currently buffered bytes onto the SPI-bus
flush the currently buffered bytes onto the SPI - bus
void spiFlush(void) {
	struct spi_message m;
	struct spi_transfer t = {
		.tx_buf	= spi.buffer.tx,
		.len	= spi.buffer.txPos,
	};
	if (spi.buffer.txPos == 0) {return;}
	spi_message_init(&m);
	spi_message_add_tail(&t, &m);
	spi_sync(spi.dev, &m);
	spi.buffer.txPos = 0;
}
void spiFlush ( void ) { struct spi_message m ; struct spi_transfer t = { . tx_buf = spi . buffer . tx , . len = spi . buffer . txPos , } ; if ( spi . buffer . txPos == 0 ) { return ; } spi_message_init ( & m ) ; spi_message_add_tail ( & t , & m ) ; spi_sync ( spi . dev , & m ) ; spi . buffer . txPos = 0 ; }
flush the currently buffered bytes onto the SPI-bus
flush the currently buffered bytes onto the SPI - bus
// nothing to send? -> abort // send (blocking!) // buffer is empty again