forked from espressif/esp-idf
Change SPI_USE_RXDATA->SPI_TRANS_USE_RXDATA and SPI_USE_TXDATA->SPI_TRANS_USE_TXDATA on documentation
Closes https://github.com/espressif/esp-idf/pull/2802
This commit is contained in:
committed by
Mahavir Jain
parent
058c6afd3c
commit
4430456b64
@@ -133,11 +133,11 @@ struct spi_transaction_t {
|
|||||||
void *user; ///< User-defined variable. Can be used to store eg transaction ID.
|
void *user; ///< User-defined variable. Can be used to store eg transaction ID.
|
||||||
union {
|
union {
|
||||||
const void *tx_buffer; ///< Pointer to transmit buffer, or NULL for no MOSI phase
|
const void *tx_buffer; ///< Pointer to transmit buffer, or NULL for no MOSI phase
|
||||||
uint8_t tx_data[4]; ///< If SPI_USE_TXDATA is set, data set here is sent directly from this variable.
|
uint8_t tx_data[4]; ///< If SPI_TRANS_USE_TXDATA is set, data set here is sent directly from this variable.
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
void *rx_buffer; ///< Pointer to receive buffer, or NULL for no MISO phase. Written by 4 bytes-unit if DMA is used.
|
void *rx_buffer; ///< Pointer to receive buffer, or NULL for no MISO phase. Written by 4 bytes-unit if DMA is used.
|
||||||
uint8_t rx_data[4]; ///< If SPI_USE_RXDATA is set, data is received directly to this variable
|
uint8_t rx_data[4]; ///< If SPI_TRANS_USE_RXDATA is set, data is received directly to this variable
|
||||||
};
|
};
|
||||||
} ; //the rx data should start from a 32-bit aligned address to get around dma issue.
|
} ; //the rx data should start from a 32-bit aligned address to get around dma issue.
|
||||||
|
|
||||||
|
@@ -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.
|
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
|
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
|
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_USE_TXDATA) is not set) the write phase is skipped.
|
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
|
The driver offers two different kinds of transactions: the interrupt
|
||||||
transactions and the polling transactions. Each device can choose one kind of
|
transactions and the polling transactions. Each device can choose one kind of
|
||||||
@@ -205,8 +205,8 @@ Tips
|
|||||||
1. Transactions with small amount of data:
|
1. Transactions with small amount of data:
|
||||||
Sometimes, the amount of data is very small making it less than optimal allocating a separate buffer
|
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
|
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
|
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_USE_RXDATA``. In both cases, do
|
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
|
not touch the ``tx_buffer`` or ``rx_buffer`` members, because they use the same memory locations
|
||||||
as ``tx_data`` and ``rx_data``.
|
as ``tx_data`` and ``rx_data``.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user