Sog update version

Dependencies:   NNN50_WIFI_API

Fork of mbed_SPIS_multiByte_example by Tsungta Wu

Revision:
4:8e796b751cd3
Parent:
2:c520d7c7739d
Child:
5:6a1155885fc9
diff -r f9aa81ae7c4c -r 8e796b751cd3 main.cpp
--- a/main.cpp	Thu Jun 01 03:28:29 2017 +0000
+++ b/main.cpp	Thu Jun 01 07:59:21 2017 +0000
@@ -1,18 +1,47 @@
+//#include "mbed.h"
+// 
+//SPI spi(A1, A2, A3); // mosi, miso, sclk
+//DigitalOut cs(A0);
+//
+//uint8_t tx_buf[32] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V'};
+//
+//int main() {
+//    // Chip must be deselected
+//    cs = 1;
+// 
+//    // Setup the spi for 8 bit data, high steady state clock,
+//    // second edge capture, with a 1MHz clock rate
+//    spi.format(8,1);
+//    spi.frequency(8000000);
+// 
+//    // Select the device by seting chip select low
+//    cs = 0;
+// 
+//    for(int i=0; i<32; i++)
+//        spi.write(tx_buf[i]);
+//    printf("End of transmission \r\n");
+//     
+//    // Deselect the device
+//    cs = 1;
+//}
+
 #include "mbed.h"
 
 #include "SPISlave_multiByte.h"
 SPISlave_multiByte device(A1, A2, A3, p3); // mosi, miso, sclk, ssel
 Serial uart(USBTX, USBRX);
 
+#define TXRX_LENGTH 16  //max is 16
 int main() {
     uart.printf("START!");
     device.format(8,1);    
+    device.frequency(8000000);
     
-   device.reply((uint8_t*)"xyz", 3);
+   device.reply((uint8_t*)"xyz", TXRX_LENGTH);
    while(1) {
-       if(device.receive(3)) {
-           int v = device.read();   // Read byte from master
-           uart.printf("v = %s ", v);
+       if(device.receive(TXRX_LENGTH)) {
+           int ret = device.read();   // Read byte from master
+           uart.printf("ret = %s ", ret);
                         
        }
    }