IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


SPI API


Detailed Description

SPI is a serial bus standard established by Motorola. The Serial Peripheral Interface (SPI) is a synchronous serial interface useful for communicating with other peripheral or microcontroller devices. These peripheral devices may be: Serial EEPROMs, Shift registers, Display drivers, A/D converters, etc.

Functions

void spiInit (BYTE idx, unsigned int mode, unsigned int div)
 Initialize the SPI bus (Master mode).
void spiSetSS (BYTE idx, BOOL value)
 Set the level of SS output pin (Master mode).
void spiSetMISO (BYTE idx, BOOL value)
 Set the level of MISO output pin (Master mode / bidirectional).
unsigned int spiGetMISO (BYTE idx)
 Get the level of MISO input pin (Master mode / bidirectional).
void spiSetMOSI (BYTE idx, BOOL value)
 Set the level of MOSI output pin (Slave mode / bidirectional).
unsigned int spiGetMOSI (BYTE idx)
 Get the level of MOSI input pin (Slave mode / bidirectional).
unsigned int spiReserveBus (BYTE idx, unsigned int mode, unsigned int div, long time_ms, unsigned int wait_priority)
 Wait on the SPI bus resource semaphore and set mode and divider (Master mode).
unsigned int spiReleaseBus (BYTE idx)
 Release the SPI bus resource semaphore (Master mode).
unsigned int spiWrite (BYTE idx, const BYTE *bufferPtr, unsigned int nbytes)
 Write bytes to the SPI bus (Master mode).
unsigned int spiRead (BYTE idx, BYTE *bufferPtr, unsigned int nbytes)
 Read bytes from the SPI bus (Master mode).
unsigned int spiReadWrite (BYTE idx, BYTE *rbufferPtr, const BYTE *wbufferPtr, unsigned int nbytes)
 Read/write bytes from/to the SPI bus (Master mode).
void spiSlaveInit (BYTE idx, unsigned int mode)
 Init the SPI interface (Slave Mode).
void spiSlaveWrite (BYTE idx, unsigned char data)
 Write a byte to the SPI bus (Slave mode).
unsigned char spiSlaveRead (BYTE idx)
 Read a byte from the SPI bus (Slave mode).
unsigned char spiSlaveReadWrite (BYTE idx, unsigned char data)
 Read/Write a byte from/to the SPI bus (Slave mode).
unsigned int spiSlaveState (BYTE idx)
 Read the SPI slave state register (Slave mode).
unsigned int spiSlavePortData (BYTE idx)
 Read the SPI port data register (Slave mode).





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:37 2017 by Doxygen 1.6.1