Tsungta Wu / Mbed OS mbed_SPIS_multiByte_example

Files at this revision

API Documentation at this revision

Comitter:
tsungta
Date:
Tue Jun 13 04:17:45 2017 +0000
Parent:
4:8e796b751cd3
Commit message:
bug fix; test under 224 bytes receive

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
spi_api_multibyte.c Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 01 07:59:21 2017 +0000
+++ b/main.cpp	Tue Jun 13 04:17:45 2017 +0000
@@ -31,7 +31,7 @@
 SPISlave_multiByte device(A1, A2, A3, p3); // mosi, miso, sclk, ssel
 Serial uart(USBTX, USBRX);
 
-#define TXRX_LENGTH 16  //max is 16
+#define TXRX_LENGTH 224  //max is 16
 int main() {
     uart.printf("START!");
     device.format(8,1);    
@@ -40,6 +40,7 @@
    device.reply((uint8_t*)"xyz", TXRX_LENGTH);
    while(1) {
        if(device.receive(TXRX_LENGTH)) {
+           //Thread::wait(1000);
            int ret = device.read();   // Read byte from master
            uart.printf("ret = %s ", ret);
                         
--- a/spi_api_multibyte.c	Thu Jun 01 07:59:21 2017 +0000
+++ b/spi_api_multibyte.c	Tue Jun 13 04:17:45 2017 +0000
@@ -79,11 +79,10 @@
     uint32_t event;
 #endif
 } spi_info_t;
-
-    #define TEST_STRING "012"  //Tsungta, handle 32 bytes per SPI CS cycle    
-    #define DATA_LENGTH 16
+ 
+    #define DATA_LENGTH 224
     uint8_t       m_tx_buf[DATA_LENGTH];              /**< TX buffer. */
-    uint8_t       m_rx_buf[sizeof(TEST_STRING)+1];    /**< RX buffer. */
+    uint8_t       m_rx_buf[DATA_LENGTH+1];    /**< RX buffer. */
     int m_length = sizeof(m_tx_buf);        /**< Transfer length. */
     int receive_bytes;