PreviousNext
startSPI
Help > OS functions > SPI > startSPI

Function

 

Indicate ready to Master.

Purpose

 

     Initiate SPI packet transmission from Slave (request to Master). Provide data from bufferCOM to Master according to Master's clock (on OS background).

     startSPI(0) indicates to the Master that the Slave is ready to receive data ( bufferCOM not full).

Syntax

 

void startSPI(uns8 length)

Parameters

 

length: number of bytes to be sent (0 to 64)

Return value

 

  –

Output values

 

SPI Status is switched to:

     SPI data ready  – after startSPI(1 to 64)

     SPI ready, Communication mode  – after startSPI(0).

Preconditions

 

     SPI must be enabled by the enableSPI function before.

Remarks

 

     SPI runs on OS background.

     startSPI(0) is also useful for recovering SPI from communication failures (e.g. the CRC mismatch).

     See IQRF SPI Technical guide and Example E07-SPI.

Side effects

 

  –

See also

 

enableSPI, disableSPI, stopSPI, getStatusSPI, restartSPI

Example 1

 

   // Slave  ->  Master

bufferCOM[0] = "I";
bufferCOM[1] = "Q";
enableSPI();
startSPI(2);        // Request to Master is active on backgroung from now

   ...              // and the program just continues here

Example 2

 

startSPI(0);        // Reset SPI communication

Example 3

 

See getStatusSPI