AEM
YSPI Class Referenceabstract

#include <yspi.h>

Inheritance diagram for YSPI:
HWSPI USARTSPI

Public Member Functions

virtual void setSS (uint8_t highLow) const =0
 
virtual void beginTransaction () const =0
 
virtual uint8_t transfer (uint8_t data) const =0
 
virtual void endTransaction () const =0
 

Detailed Description

YPSI abstract class. This serves as a defintion of the YSPI interface. Note: all the methods are const, thus once instatiated, the itnernal state of the YSPI instance never changes. Typical Usage of the concrete children classes:

  1. instanciation

    YSPI* yspiPtr = new ChildClass(...);

  2. Transaction: yspiPtr->beginTransaction();

    uint8_t result = yspiPtr->transfer(outgoingByte);

    yspiPtr->endTransaction();

  3. if needed, control the Slave Select pin value

    yspiPtr->setSS(HIGH); // set to HIGH

    yspiPtr->setSS(LOW); // set to LOW

Member Function Documentation

virtual void YSPI::beginTransaction ( ) const
pure virtual

A pure virtual method creates the conditions necessary prior to a transfer.

Implemented in USARTSPI, and HWSPI.

virtual void YSPI::endTransaction ( ) const
pure virtual

A pure virtual method creates the conditions necessary after a transfer.

Implemented in USARTSPI, and HWSPI.

virtual void YSPI::setSS ( uint8_t  highLow) const
pure virtual

A pure virtual method proividing means of setting SS value.

Parameters
highLowthe value to which SS will be set, either HIGH or LOW.

Implemented in USARTSPI, and HWSPI.

virtual uint8_t YSPI::transfer ( uint8_t  data) const
pure virtual

A pure virtual method transfers the data and returns the date read.

Parameters
dataa byte that will be transfered to the slave device.
Returns
the byte that is simultaneously received during the transfer.

Implemented in USARTSPI, and HWSPI.


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