!
1. void spi_slave_init(uint8 spi_no)
Function:
Initialise the SPI slave mode, set the IO interface to SPI mode, start the SPI transmission
interrupt, and register spi_slave_isr_handler. The communication format is set to be 8 bits
command + 8 bits address + 256 bits (32 Bytes) read/write data.
Parameters:
spi_no: number of the SPI module. The ESP8266 processor has two SPI modules (SPI
and HSPI) with the same functions.
Value to be selected: SPI or HSPI.
2. spi_slave_isr_sta(void *para)
Function and trigger condition:
It's the SPI interrupt handler function. When the master successfully reads data from or
writes data into the slave, the interrupt will be triggered. Users can revise the interrupt
service routine in order to attain the communication functions they need. The code is
shown as below:
struct spi_slave_status_element
{
};
union spi_slave_status
{
};
void spi_slave_isr_sta(void *para)
{
Espressif
uint8 wr_busy:1;
uint8 rd_empty :1;
uint8 comm_cnt :3;
uint8 res :3;
struct spi_slave_status_element elm_value;
uint8 byte_value;
uint32 regvalue,calvalue;
uint32 recv_data,send_data;
union spi_slave_status spi_sta;
if(READ_PERI_REG(0x3ff00020)&BIT4){
//following 3 lines is to clear isr signal
6. SPI Wi-Fi Passthrough 1-Interrupt Mode
35 86
!
/!
2016.05
Need help?
Do you have a question about the ESP8266 and is the answer not in the manual?
Questions and answers