Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed_SPIS_multiByte_example_SOG by
Diff: spi_api_multibyte.c
- Revision:
- 3:f9aa81ae7c4c
- Parent:
- 2:c520d7c7739d
- Child:
- 4:8e796b751cd3
diff -r c520d7c7739d -r f9aa81ae7c4c spi_api_multibyte.c
--- a/spi_api_multibyte.c Wed May 31 09:30:53 2017 +0000
+++ b/spi_api_multibyte.c Thu Jun 01 03:28:29 2017 +0000
@@ -82,9 +82,10 @@
// #define TEST_STRING "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" //Tsungta, handle 32 bytes per SPI CS cycle
#define TEST_STRING "012" //Tsungta, handle 32 bytes per SPI CS cycle
- uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */
+ #define DATA_LENGTH 32
+ uint8_t m_tx_buf[DATA_LENGTH]; /**< TX buffer. */
uint8_t m_rx_buf[sizeof(TEST_STRING)+1]; /**< RX buffer. */
- const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */
+ int m_length = sizeof(m_tx_buf); /**< Transfer length. */
int receive_bytes;
static spi_info_t m_spi_info[SPI_COUNT];
@@ -495,8 +496,9 @@
spi_info_t *p_spi_info = SPI_INFO(obj);
MBED_ASSERT(!p_spi_info->master);
-// m_tx_buf = value;//Need TO FIX
-// m_length = bytes;//Need TO FIX
+ //m_tx_buf[] = &value;//Need TO FIX
+ memcpy(m_tx_buf, value, bytes);
+ m_length = bytes;//Need TO FIX
}
#if DEVICE_SPI_ASYNCH
