Esp8266 Spi Slave Api Functions - Espressif ESP8266 Technical Reference

Hide thumbs Also See for ESP8266:
Table of Contents

Advertisement

!
}
GPIO2_Raising_Edge_ISR() // rising edge interrupt program connected
to the ESP8266 GPIO2
{

7.4. ESP8266 SPI Slave API Functions

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_handler(void *para)
Function and trigger condition:
It is 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 complete the communication. The code is shown below.
Code:
Espressif
rd_rdy=1; // the slave updates the send buffer, the master is
ready to read
uint32 regvalue;
static uint32 t1 =0;
static uint32 t2 =0;
t1=system_get_time();
if(READ_PERI_REG(0x3ff00020)&BIT4){
CLEAR_PERI_REG_MASK(SPI_SLAVE(SPI), 0x3ff);
}else if(READ_PERI_REG(0x3ff00020)&BIT7){ //bit7: HSPI
interrupt,
regvalue=READ_PERI_REG(SPI_SLAVE(HSPI));
interrupt type
// turn off the SPI interrupt enable
7. SPI Wi-Fi Passthrough 2-Interrupt Mode
43 86
!
/!
//bit4: SPI interrupt
// record the
2016.05

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP8266 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF