Skip to content

Commit 3073cdd

Browse files
4iloWren6991
authored andcommitted
Improve spi write16/read16 documentation.
The write16/read16 only work as described after changing the amount of data_bits using spi_set_format.
1 parent 8a45435 commit 3073cdd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • src/rp2_common/hardware_spi/include/hardware

src/rp2_common/hardware_spi/include/hardware/spi.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ int spi_read_blocking(spi_inst_t *spi, uint8_t repeated_tx_data, uint8_t *dst, s
252252
* Write \p len halfwords from \p src to SPI. Simultaneously read \p len halfwords from SPI to \p dst.
253253
* Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate.
254254
*
255+
* \note SPI should be initialised with 16 data_bits using \ref spi_set_format first, otherwise this function will only read/write 8 data_bits.
256+
*
255257
* \param spi SPI instance specifier, either \ref spi0 or \ref spi1
256258
* \param src Buffer of data to write
257259
* \param dst Buffer for read data
@@ -266,6 +268,8 @@ int spi_write16_read16_blocking(spi_inst_t *spi, const uint16_t *src, uint16_t *
266268
* Write \p len halfwords from \p src to SPI. Discard any data received back.
267269
* Blocks until all data is transferred. No timeout, as SPI hardware always transfers at a known data rate.
268270
*
271+
* \note SPI should be initialised with 16 data_bits using \ref spi_set_format first, otherwise this function will only write 8 data_bits.
272+
*
269273
* \param spi SPI instance specifier, either \ref spi0 or \ref spi1
270274
* \param src Buffer of data to write
271275
* \param len Length of buffers
@@ -282,6 +286,8 @@ int spi_write16_blocking(spi_inst_t *spi, const uint16_t *src, size_t len);
282286
* Generally this can be 0, but some devices require a specific value here,
283287
* e.g. SD cards expect 0xff
284288
*
289+
* \note SPI should be initialised with 16 data_bits using \ref spi_set_format first, otherwise this function will only read 8 data_bits.
290+
*
285291
* \param spi SPI instance specifier, either \ref spi0 or \ref spi1
286292
* \param repeated_tx_data Buffer of data to write
287293
* \param dst Buffer for read data

0 commit comments

Comments
 (0)