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).

 

 

Posted in Electronics, ESP8266 and tagged , , , .

Leave a Reply

Your email address will not be published. Required fields are marked *