ESP8266 Hardware SPI Driver Code UPDATE!

https://github.com/MetalPhreak/ESP8266_SPI_Driver

Code library has been updated with much more functionality.

Command Support:

You can now include a command component in the SPI transaction. Commands can be up to 16 bits long.

Address Support:

You can now include an address component in the SPI transaction. Addresses can be up to 32 bits long.

Dummy Bit Support:

The number of dummy bits can now be set if required.

 

Most importantly, it now implements reading data up to 32bits in length!

Example code snippets and function descriptors are in the README.md file and on the GitHub page.

 

ESP8266 Hardware SPI Driver Code / “Library”

https://github.com/MetalPhreak/ESP8266_SPI_Driver

Currently only supports sending data packets up to 32bits in size.

You can get started pretty quick with the following code snippet. The spi_init function sets up the hardware to a predefined clock of 4MHz.

spi_init(HSPI);

spi_tx8(HSPI, 0x7A); //send 8 bits of data

spi_tx16(HSPI, 0x7A43); //send 16 bits of data

spi_tx32(HSPI, 0xCAFEFEED); //send 32 bits of data

spi_txd(HSPI, 9, 0b101101110); //send 9 bits of data (useful for driving LCDs with 9bit commands).