Merge branch 'feature/multiple_github_prs' into 'master'
Fixes from github PRs See merge request idf/esp-idf!5040
This commit is contained in:
@@ -31,7 +31,7 @@ Configure Driver
|
||||
|
||||
The first step to establishing I2C communication is to configure the driver. This is done by setting several parameters contained in :cpp:type:`i2c_config_t` structure:
|
||||
|
||||
* I2C **operation mode** - select either slave or master from :cpp:type:`i2c_opmode_t`
|
||||
* I2C **mode** - select either slave or master from :cpp:type:`i2c_mode_t`
|
||||
* Settings of the **communication pins**:
|
||||
|
||||
* GPIO pin numbers assigned to the SDA and SCL signals
|
||||
@@ -56,7 +56,7 @@ Install Driver
|
||||
Having the configuration initialized, the next step is to install the I2C driver by calling :cpp:func:`i2c_driver_install`. This function call requires the following parameters:
|
||||
|
||||
* The port number, one of the two ports available, selected from :cpp:type:`i2c_port_t`
|
||||
* The operation mode, slave or master selected from :cpp:type:`i2c_opmode_t`
|
||||
* The I2C mode, slave or master, selected from :cpp:type:`i2c_mode_t`
|
||||
* Sizes of buffers that will be allocated for sending and receiving data **in the slave mode**
|
||||
* Flags used to allocate the interrupt
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ and/or address. This is reflected in the device configuration: when the ``comman
|
||||
fields are set to zero, no command or address phase is done.
|
||||
|
||||
Something similar is true for the read and write phase: not every transaction needs both data to be written
|
||||
as well as data to be read. When ``rx_buffer`` is NULL (and SPI_USE_RXDATA) is not set) the read phase
|
||||
is skipped. When ``tx_buffer`` is NULL (and SPI_USE_TXDATA) is not set) the write phase is skipped.
|
||||
as well as data to be read. When ``rx_buffer`` is NULL (and SPI_TRANS_USE_RXDATA) is not set) the read phase
|
||||
is skipped. When ``tx_buffer`` is NULL (and SPI_TRANS_USE_TXDATA) is not set) the write phase is skipped.
|
||||
|
||||
The driver offers two different kinds of transactions: the interrupt
|
||||
transactions and the polling transactions. Each device can choose one kind of
|
||||
@@ -205,8 +205,8 @@ Tips
|
||||
1. Transactions with small amount of data:
|
||||
Sometimes, the amount of data is very small making it less than optimal allocating a separate buffer
|
||||
for it. If the data to be transferred is 32 bits or less, it can be stored in the transaction struct
|
||||
itself. For transmitted data, use the ``tx_data`` member for this and set the ``SPI_USE_TXDATA`` flag
|
||||
on the transmission. For received data, use ``rx_data`` and set ``SPI_USE_RXDATA``. In both cases, do
|
||||
itself. For transmitted data, use the ``tx_data`` member for this and set the ``SPI_TRANS_USE_TXDATA`` flag
|
||||
on the transmission. For received data, use ``rx_data`` and set ``SPI_TRANS_USE_RXDATA``. In both cases, do
|
||||
not touch the ``tx_buffer`` or ``rx_buffer`` members, because they use the same memory locations
|
||||
as ``tx_data`` and ``rx_data``.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user