EasyManua.ls Logo

Espressif ESP32-S2 - Page 294

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Fig. 5: I2C command link - master write example
a) Start bit - i2c_master_start()
b) Slave address - i2c_master_write_byte(). The single byte address is provided as an argument
of this function call.
c) Data - One or more bytes as an argument of i2c_master_write()
d) Stop bit - i2c_master_stop()
Both functions i2c_master_write_byte() and i2c_master_write() have an addi-
tional argument specifying whether the master should ensure that it has received the ACK bit.
2. Trigger the execution of the command link by I2C controller by calling i2c_master_cmd_begin().
Once the execution is triggered, the command link cannot be modified.
3. After the commands are transmitted, release the resources used by the command link by calling
i2c_cmd_link_delete().
Master Read The example below shows how to build a command link for an I2C master to read n bytes from a
slave.
Fig. 6: I2C command link - master read example
Compared to writing data, the command link is populated in Step 4 not with i2c_master_write... func-
tions but with i2c_master_read_byte() and / or i2c_master_read(). Also, the last read in Step 5 is
configured so that the master does not provide the ACK bit.
Espressif Systems 283
Submit Document Feedback
Release v4.4

Table of Contents