Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
SPI Hardware support

Provides hardware SPI support. More...

Functions

virtual void SPIClass::begin ()
 begin(): Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high. More...
 
virtual void SPIClass::end ()
 end() More...
 
virtual void SPIClass::beginTransaction (SPISettings mySettings)
 beginTransaction() More...
 
virtual void SPIClass::endTransaction ()
 endTransaction() More...
 
virtual unsigned char SPIClass::transfer (unsigned char val)
 transfer() More...
 
uint8 SPIClass::read8 ()
 read8() read a byte from SPI without setting up registers More...
 
virtual unsigned short SPIClass::transfer16 (unsigned short val)
 transfer16() More...
 
virtual void SPIClass::transfer (uint8 *buffer, size_t numberBytes)
 transfer(uint8 *buffer, size_t numberBytes) More...
 

Variables

SPISettings SPIClass::SPIDefaultSettings = SPISettings(4000000, MSBFIRST, SPI_MODE0)
 Default settings used by the SPI bus until reset by beginTransaction(SPISettings) More...
 

Detailed Description

Provides hardware SPI support.

Instantiate hardware SPI object.

Function Documentation

virtual void SPIClass::begin ( )
virtual

begin(): Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high.

Implements SPIBase.

virtual void SPIClass::beginTransaction ( SPISettings  mySettings)
virtual

beginTransaction()

Initializes the SPI bus using the defined SPISettings

this methode does not initiate a transaction. So it can be used to setup the SPI after SPI.begin()

Implements SPIBase.

virtual void SPIClass::end ( )
virtual

end()

Method for compatibility with Arduino API. Provides NOP

Implements SPIBase.

virtual void SPIClass::endTransaction ( )
virtual

endTransaction()

Method for compatibility with Arduino API. Provides NOP

endTransaction(): Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus.

Implements SPIBase.

uint8 SPIClass::read8 ( )

read8() read a byte from SPI without setting up registers

Parameters
none
Return values
bytereceived
 used for performance tuning when doing continuous reads
 this method does not reset the registers , so make sure
 that a regular transfer(data) call was performed

 Note: this method is not found on the Arduino API

 USE WITH CARE !!
virtual unsigned char SPIClass::transfer ( unsigned char  val)
inlinevirtual

transfer()

Parameters
byteto send
Return values
bytereceived

calls private method transfer32(byte) to send/recv one uint32_t input/output casted to rightdta type

SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16).

    receivedVal = SPI.transfer(val)         : single byte
    receivedVal16 = SPI.transfer16(val16)   : single short

Implements SPIBase.

virtual void SPIClass::transfer ( uint8 *  buffer,
size_t  numberBytes 
)
virtual

transfer(uint8 *buffer, size_t numberBytes)

Parameters
bufferin/out
numberByteslenght of buffer

SPI transfer is based on a simultaneous send and receive: The buffered transfers does split up the conversation internaly into 64 byte blocks. The received data is stored in the buffer passed by reference. (the data past in is replaced with the data received).

    SPI.transfer(buffer, size)              : memory buffer of length size

Implements SPIBase.

virtual unsigned short SPIClass::transfer16 ( unsigned short  val)
inlinevirtual

transfer16()

Parameters
shortto send
Return values
shortreceived

calls private method transfer32(byte) to send/recv one uint32_t input/output casted to rightdta type

SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16).

    receivedVal = SPI.transfer(val)         : single byte
    receivedVal16 = SPI.transfer16(val16)   : single short

Implements SPIBase.

Variable Documentation

SPISettings SPIClass::SPIDefaultSettings = SPISettings(4000000, MSBFIRST, SPI_MODE0)

Default settings used by the SPI bus until reset by beginTransaction(SPISettings)

Note: not included in std Arduino lib