Miosix  2.01
miosix::SoftwareSPI< SI, SO, SCK, CE, numNops > Class Template Reference

#include <software_spi.h>

Static Public Member Functions

static void init ()
 
static unsigned char sendRecvChar (unsigned char data)
 
static unsigned short sendRecvShort (unsigned short data)
 
static unsigned int sendRecvLong (unsigned int data)
 
static void ceLow ()
 
static void ceHigh ()
 

Detailed Description

template<typename SI, typename SO, typename SCK, typename CE, unsigned numNops>
class miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >

Software implementation of the SPI protocol mode 0 (CPOL=0, CPHA=0 mode)

Parameters
SIan instance of the Gpio class indicating the SPI input pin
SOan instance of the Gpio class indicating the SPI output pin
SCKan instance of the Gpio class indicating the SPI clock pin
CEan instance of the Gpio class indicating the SPI chip enable pin
numNopsnumber of nops to add to the send loop to slow down SPI clock

Member Function Documentation

template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
static void miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::ceHigh ( )
inlinestatic

Pull CE high, indicating transmission end.

template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
static void miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::ceLow ( )
inlinestatic

Pull CE low, indicating transmission start.

template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
static void miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::init ( )
inlinestatic

Initialize the SPI interface

template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
unsigned char miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::sendRecvChar ( unsigned char  data)
static

Send a byte and, since SPI is full duplex, simultaneously receive a byte

Parameters
datato send
Returns
data received
template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
unsigned int miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::sendRecvLong ( unsigned int  data)
static

Send an int and, since SPI is full duplex, simultaneously receive an int

Parameters
datato send
Returns
data received
template<typename SI , typename SO , typename SCK , typename CE , unsigned numNops>
unsigned short miosix::SoftwareSPI< SI, SO, SCK, CE, numNops >::sendRecvShort ( unsigned short  data)
static

Send an unsigned short and, since SPI is full duplex, simultaneously receive an unsigned short

Parameters
datato send
Returns
data received

The documentation for this class was generated from the following file: