Buffered Test

Dependencies:   ExioBufferdController MCP23S17 mbed-rtos mbed

Revision:
3:ee7fd89f2539
Parent:
2:0a339555ddf6
Child:
4:20ee7612edb9
--- a/main.cpp	Fri Nov 04 19:59:59 2016 +0000
+++ b/main.cpp	Fri Nov 04 20:44:47 2016 +0000
@@ -13,6 +13,7 @@
 
 #include "ExioMcp23s17.h" 
 #include "ExioInBuffer.h"
+#include "ExioBufferedIn.h"
 
 SPI Spi(PC_12, PC_11, PC_10); // SPI3: mosi, miso, sclk
 //SPI Spi(PA_7, PA_6, PA_5); // SPI1:  mosi, miso, sclk
@@ -27,11 +28,11 @@
     // Reset MCP23S17 (初期化時にreset()が必要)
     Exio.reset();
 
-    ExioInBuffer exioInBufferA(&Exio, ExioPortA, 1);
-    ExioInBuffer exioInBufferB(&Exio, ExioPortB, 1);
+    ExioInBuffer exioInBufferA(&Exio, ExioPortA);
+    ExioInBuffer exioInBufferB(&Exio, ExioPortB);
     
-    exioInBufferA.run();
-    exioInBufferB.run();
+    exioInBufferA.run(1);
+    exioInBufferB.run(1);
     
     while (true) {
         uint8_t va = exioInBufferA.readPort();
@@ -41,8 +42,40 @@
         //Thread::wait(10);
     }
 }
-
+/*
+void testExioBufferedIn()
+{
+    printf("*** Test ExioBuffedIn ***\r\n");
+    
+    // Reset MCP23S17 (初期化時にreset()が必要)
+    Exio.reset();
+    
+    ExioInBuffer inBufferB(&Exio, ExioPortB, 1);
+    ExioBufferedIn inB[] = {
+        ExioBufferedIn(&inBufferB, 0),
+        ExioBufferedIn(&inBufferB, 1),
+        ExioBufferedIn(&inBufferB, 2),
+        ExioBufferedIn(&inBufferB, 3),
+        ExioBufferedIn(&inBufferB, 4),
+        ExioBufferedIn(&inBufferB, 5),
+        ExioBufferedIn(&inBufferB, 6),
+        ExioBufferedIn(&inBufferB, 7)
+    };
+    
+    inBufferB.run();
+    
+    while (true) {
+        for (int i = 0; i < 8; i++) {
+            int v = inB[i].read();
+            printf("%d ", v);
+        }
+        printf("\r\n");
+        //Thread::wait(10);
+    }
+}
+*/
 int main()
 {
     testExioInBuffer();
+    //testExioBufferedIn();
 }
\ No newline at end of file