ESP8266
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SPIClass Class Reference

Public Member Functions

 SPIClass ()
 
void begin ()
 
void end ()
 
void setHwCs (bool use)
 
void setBitOrder (uint8_t bitOrder)
 
void setDataMode (uint8_t dataMode)
 
void setFrequency (uint32_t freq)
 
void setClockDivider (uint32_t clockDiv)
 
void beginTransaction (SPISettings settings)
 
uint8_t transfer (uint8_t data)
 
uint16_t transfer16 (uint16_t data)
 
void write (uint8_t data)
 
void write16 (uint16_t data)
 
void write16 (uint16_t data, bool msb)
 
void write32 (uint32_t data)
 
void write32 (uint32_t data, bool msb)
 
void writeBytes (uint8_t *data, uint32_t size)
 
void writePattern (uint8_t *data, uint8_t size, uint32_t repeat)
 
void transferBytes (uint8_t *out, uint8_t *in, uint32_t size)
 
void endTransaction (void)
 

Private Member Functions

void writeBytes_ (uint8_t *data, uint8_t size)
 
void writePattern_ (uint8_t *data, uint8_t size, uint8_t repeat)
 
void transferBytes_ (uint8_t *out, uint8_t *in, uint8_t size)
 
void setDataBits (uint16_t bits)
 

Private Attributes

bool useHwCs
 

Constructor & Destructor Documentation

SPIClass::SPIClass ( )

Member Function Documentation

void SPIClass::begin ( )

< GPIO14

< GPIO12

< GPIO13

< 1MHz

void SPIClass::beginTransaction ( SPISettings  settings)
void SPIClass::end ( void  )
void SPIClass::endTransaction ( void  )
void SPIClass::setBitOrder ( uint8_t  bitOrder)
void SPIClass::setClockDivider ( uint32_t  clockDiv)
void SPIClass::setDataBits ( uint16_t  bits)
private
void SPIClass::setDataMode ( uint8_t  dataMode)

SPI_MODE0 0x00 - CPOL: 0 CPHA: 0 SPI_MODE1 0x01 - CPOL: 0 CPHA: 1 SPI_MODE2 0x10 - CPOL: 1 CPHA: 0 SPI_MODE3 0x11 - CPOL: 1 CPHA: 1

< CPOL (Clock Polarity)

< CPHA (Clock Phase)

void SPIClass::setFrequency ( uint32_t  freq)
void SPIClass::setHwCs ( bool  use)

< GPIO15

uint8_t SPIClass::transfer ( uint8_t  data)
uint16_t SPIClass::transfer16 ( uint16_t  data)
void SPIClass::transferBytes ( uint8_t *  out,
uint8_t *  in,
uint32_t  size 
)

Note: in and out need to be aligned to 32Bit or you get an Fatal exception (9)

Parameters
outuint8_t *
inuint8_t *
sizeuint32_t
void SPIClass::transferBytes_ ( uint8_t *  out,
uint8_t *  in,
uint8_t  size 
)
private
void SPIClass::write ( uint8_t  data)
void SPIClass::write16 ( uint16_t  data)
void SPIClass::write16 ( uint16_t  data,
bool  msb 
)
void SPIClass::write32 ( uint32_t  data)
void SPIClass::write32 ( uint32_t  data,
bool  msb 
)
void SPIClass::writeBytes ( uint8_t *  data,
uint32_t  size 
)

Note: data need to be aligned to 32Bit or you get an Fatal exception (9)

Parameters
datauint8_t *
sizeuint32_t
void SPIClass::writeBytes_ ( uint8_t *  data,
uint8_t  size 
)
private
void SPIClass::writePattern ( uint8_t *  data,
uint8_t  size,
uint32_t  repeat 
)

Note: data need to be aligned to 32Bit or you get an Fatal exception (9)

Parameters
datauint8_t *
sizeuint8_t max for size is 64Byte
repeatuint32_t
void SPIClass::writePattern_ ( uint8_t *  data,
uint8_t  size,
uint8_t  repeat 
)
private

Member Data Documentation

bool SPIClass::useHwCs
private