AceSPI  0.3
Unified interface for selecting hardware or software SPI implementations on Arduino platforms
Public Member Functions | List of all members
ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED > Class Template Reference

This class is functionally identical to HardSpiInterface except that the GPIO pins are controlled by digitalWriteFast() and pinModeFast() methods. More...

#include <HardSpiFastInterface.h>

Public Member Functions

 HardSpiFastInterface (T_SPI &spi)
 Constructor. More...
 
void begin () const
 Initialize the HardSpiFastInterface. More...
 
void end () const
 Clean up the object.
 
void beginTransaction () const
 Begin SPI transaction. More...
 
void endTransaction () const
 End SPI transaction. More...
 
void transfer (uint8_t value) const
 Transfer 8 bits.
 
void transfer16 (uint16_t value) const
 Transfer 16 bits.
 
void send8 (uint8_t value) const
 Convenience method to send 8 bits a single transaction.
 
void send16 (uint16_t value) const
 Convenience method to send 16 bits a single transaction.
 
void send16 (uint8_t msb, uint8_t lsb) const
 Convenience method to send 16 bits a single transaction.
 
 HardSpiFastInterface (const HardSpiFastInterface &)=default
 
HardSpiFastInterfaceoperator= (const HardSpiFastInterface &)=default
 

Detailed Description

template<typename T_SPI, uint8_t T_LATCH_PIN, uint32_t T_CLOCK_SPEED = 8000000>
class ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED >

This class is functionally identical to HardSpiInterface except that the GPIO pins are controlled by digitalWriteFast() and pinModeFast() methods.

This decreases flash memory consumption by 70 bytes (AceSegment/HybridModule) to 250 (AceSegment/Max7219Module, AceSegment/Hc595Module) bytes.

If more than 2-3 or LED modules are used, each using different LatchPins, the HardSpiInterface class might consume less flash memory than this one because HardSpiInterface avoids generating different template instantiations of the HybridModule, Max7219Module, or Hc595Module classes. If flash memory size is a problem, users should experiment with both and compare the difference.

Template Parameters
T_SPIthe class of the hardware SPI instance, usually SPIClass
T_LATCH_PINthe CS/SS pin that controls the SPI peripheral
T_CLOCK_SPEEDthe SPI clock speed, default 8000000 (8 MHz)

Definition at line 55 of file HardSpiFastInterface.h.

Constructor & Destructor Documentation

◆ HardSpiFastInterface()

template<typename T_SPI , uint8_t T_LATCH_PIN, uint32_t T_CLOCK_SPEED = 8000000>
ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED >::HardSpiFastInterface ( T_SPI &  spi)
inlineexplicit

Constructor.

Parameters
spiinstance of the T_SPI class. If the pre-installed <SPI.h> is used, T_SPI is SPIClass and spi will be the pre-defined SPI object.

Definition at line 78 of file HardSpiFastInterface.h.

Member Function Documentation

◆ begin()

template<typename T_SPI , uint8_t T_LATCH_PIN, uint32_t T_CLOCK_SPEED = 8000000>
void ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED >::begin ( ) const
inline

Initialize the HardSpiFastInterface.

The hardware SPI object must be initialized using SPI.begin() as well.

Definition at line 84 of file HardSpiFastInterface.h.

◆ beginTransaction()

template<typename T_SPI , uint8_t T_LATCH_PIN, uint32_t T_CLOCK_SPEED = 8000000>
void ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED >::beginTransaction ( ) const
inline

Begin SPI transaction.

Pull latch LOW.

Definition at line 105 of file HardSpiFastInterface.h.

◆ endTransaction()

template<typename T_SPI , uint8_t T_LATCH_PIN, uint32_t T_CLOCK_SPEED = 8000000>
void ace_spi::HardSpiFastInterface< T_SPI, T_LATCH_PIN, T_CLOCK_SPEED >::endTransaction ( ) const
inline

End SPI transaction.

Pull latch HIGH.

Definition at line 111 of file HardSpiFastInterface.h.


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