RF22
|
Base class for SPI interfaces. More...
#include <GenericSPI.h>
Public Member Functions | |
virtual uint8_t | transfer (uint8_t data)=0 |
virtual void | attachInterrupt () |
virtual void | detachInterrupt () |
virtual void | begin () |
virtual void | end () |
virtual void | setBitOrder (uint8_t bitOrder) |
virtual void | setDataMode (uint8_t mode) |
virtual void | setClockDivider (uint8_t rate) |
Base class for SPI interfaces.
This generic abstract class is used to encapsulate hardware or software SPI interfaces. The intention is so that the main RF22 class can be configured to use hardware or software SPI without changing the main code.
You must provide a subclass of this class to RF22 constructor. A concrete subclass theat encapsualtes the standard Arcuino hardware SPI is provided
|
inlinevirtual |
Enable SPI interrupts (if supported) This can be used in an SPI slave to indicate when an SPI message has been received
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
|
inlinevirtual |
Initialise the SPI library. Call this before configuring or using the SPI library
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
Referenced by RF22::init().
|
inlinevirtual |
Disable SPI interrupts (if supported) This can be used to diable the SPI interrupt in slaves where that is supported.
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
|
inlinevirtual |
Disables the SPI bus (leaving pin modes unchanged). Call this after you have finished using the SPI interface
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
|
inlinevirtual |
Sets the bit order the SPI interface will use Sets the order of the bits shifted out of and into the SPI bus, either LSBFIRST (least-significant bit first) or MSBFIRST (most-significant bit first).
[in] | bitOrder | Bit order to be used: LSBFIRST or MSBFIRST |
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
Referenced by RF22::init().
|
inlinevirtual |
Sets the SPI clock divider relative to the system clock. On AVR based boards, the dividers available are 2, 4, 8, 16, 32, 64 or 128. The default setting is SPI_CLOCK_DIV4, which sets the SPI clock to one-quarter the frequency of the system clock (4 Mhz for the boards at 16 MHz).
[in] | rate | The data rate to use: one of SPI_CLOCK_ |
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
Referenced by RF22::init().
|
inlinevirtual |
Sets the SPI data mode: that is, clock polarity and phase. See the Wikipedia article on SPI for details.
[in] | mode | The mode to use: SPI_MODE0 SPI_MODE1 SPI_MODE2 SPI_MODE3 |
Reimplemented in SoftwareSPIClass, and HardwareSPIClass.
Referenced by RF22::init().
|
pure virtual |
Transfer a single octet to and from the SPI interface
[in] | data | The octet to send |
Implemented in SoftwareSPIClass, and HardwareSPIClass.
Referenced by RF22::spiBurstRead(), RF22::spiBurstWrite(), RF22::spiRead(), and RF22::spiWrite().