Assignment: I2C master receive data API implementation
In this article, let’s implement the I2C master receive data. The parameters of this API are similar to the master TX API, or master send data API, as shown in Figure 1.
Exercise:
In Figure 1, you can observe a couple of comments, according to which code is written for the master to receive the data from the slave. Here the comments describe what exactly you have to do.
For example, in the first case, write the code to call the corresponding API or function. Then, confirm the start generation’s completion, which is exactly similar to what you did to send data API.
There are two sections in I2C_MasterReceiveData API, as shown in Figure 2.
- Procedure to receive data when the length is equal to 1.
- Procedure to receive data when the length is greater than 1.
Look at Figure 2. There are several comments written inside each section, according to which you have to write the code.
In the following article, let’s implement the I2C master receive data API.
FastBit Embedded Brain Academy Courses,
Click here: https://fastbitlab.com/course1