MCPcopy Create free account
hub / github.com/kiibohd/controller / SPI_write

Function SPI_write

Scan/Devices/STLcd/lcd_scan.c:158–184  ·  view source on GitHub ↗

Write buffer to SPI FIFO

Source from the content-addressed store, hash-verified

156
157// Write buffer to SPI FIFO
158void SPI_write( uint8_t *buffer, uint8_t len )
159{
160
161 for ( uint8_t byte = 0; byte < len; byte++ )
162 {
163#if defined(_kinetis_)
164 // Wait for SPI TxFIFO to have 4 or fewer entries
165 while ( !( SPI0_SR & SPI_SR_TFFF ) )
166 delay_us(10);
167
168 // Write byte to TxFIFO
169 // CS0, CTAR0
170 SPI0_PUSHR = ( buffer[ byte ] & 0xff ) | SPI_PUSHR_PCS(1);
171
172 // Indicate transfer has completed
173 while ( !( SPI0_SR & SPI_SR_TCF ) );
174 SPI0_SR |= SPI_SR_TCF;
175#elif defined(_sam_)
176 /*
177 // Wait for transmit register to be empty
178 while (!(SPI0->SPI_SR & SPI_SR_TDRE));
179 // Send data to transmit register
180 SPI0->SPI_TDR = data;
181 */
182#endif
183 }
184}
185
186// Write to a control register
187void LCD_writeControlReg( uint8_t byte )

Callers 6

LCD_writeControlRegFunction · 0.85
LCD_writeDataRegFunction · 0.85
LCD_writeDisplayRegFunction · 0.85
LCD_clearPageFunction · 0.85
cliFunc_lcdDispFunction · 0.85

Calls 1

delay_usFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…