https://github.com/espressif/esp-idf/bl ... ple_main.c
This is a fairly naive implementation though, and since the ESP32 is also the master, it's capable of requesting and sending data right inline with functions it calls for the slave side of things.
https://docs.espressif.com/projects/esp ... ure-driver
The documentation provided focuses almost entirely on using the ESP32 as a master, and only gives two sentences for the slave functions. I think I have the slave reading properly (or at least well enough) implemented, but I'm having a difficult time getting the ESP32 to write back to the master. Can anyone please help me out here?
In my situation, the master writes a single byte to the ESP32, which determines what set of data the ESP32 will send when the master makes a request. IE, if the master were to request an identifier for itself (I'm using a multi-master system), my code currently looks like the following:
Code: Select all
I2CdataBuffer[0] = lineNumberIndex++;
i2c_slave_write_buffer(I2C_NUM_0, I2CdataBuffer, 1, 1000 / portTICK_RATE_MS);