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:
- 2:c520d7c7739d
- Parent:
- 1:58f0712d9aa2
- Child:
- 3:f9aa81ae7c4c
--- a/spi_api_multibyte.c Wed May 31 07:39:37 2017 +0000
+++ b/spi_api_multibyte.c Wed May 31 09:30:53 2017 +0000
@@ -85,7 +85,8 @@
uint8_t m_tx_buf[] = TEST_STRING; /**< 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 receive_bytes;
+
static spi_info_t m_spi_info[SPI_COUNT];
typedef struct {
@@ -188,7 +189,7 @@
if (event.evt_type == NRF_DRV_SPIS_XFER_DONE) {
// Signal that there is some data received that could be read.
- if(event.rx_amount == 3)//Tsungta
+ if(event.rx_amount == receive_bytes)//Tsungta
p_spi_info->flag.readable = true;
// And prepare for the next transfer.
@@ -470,8 +471,9 @@
return m_rx_buf;
}
-int spi_slave_receive_multibyte(spi_mb_t *obj)
+int spi_slave_receive_multibyte(spi_mb_t *obj, int bytes)
{
+ receive_bytes = bytes;//Tsungta
spi_info_t *p_spi_info = SPI_INFO(obj);
MBED_ASSERT(!p_spi_info->master);
return p_spi_info->flag.readable;
@@ -488,12 +490,13 @@
return m_rx_buf;
}
-void spi_slave_write_multibyte(spi_mb_t *obj, int value)
+void spi_slave_write_multibyte(spi_mb_t *obj, uint8_t *value, int bytes)
{
spi_info_t *p_spi_info = SPI_INFO(obj);
MBED_ASSERT(!p_spi_info->master);
- //m_tx_buf = (uint8_t)value;
+// m_tx_buf = value;//Need TO FIX
+// m_length = bytes;//Need TO FIX
}
#if DEVICE_SPI_ASYNCH
