SPI transmission of an array, Master device.

Dependencies:   mbed

Revision:
1:c573caf40864
Parent:
0:8a61e3541a5e
Child:
2:b95b33894176
--- a/main.cpp	Mon Feb 19 12:40:15 2018 +0000
+++ b/main.cpp	Mon Feb 19 13:09:13 2018 +0000
@@ -19,9 +19,12 @@
 int columns;
 
 char array[4];
+char matrix[2][2];
 int i;
+int j;
 
 void Array();
+void Matrix();
 
 int main()
 {
@@ -51,14 +54,19 @@
             myleds = 0;
         }
 
-        Array();
-        device.putc(1);
-        for (int i=0; i<5; i++) {
+        //Array();
+
+        Matrix();
 
-            //device.printf("%i",buffer[i]);
+        device.putc(1);
+        for (int i=0; i<2; i++) {
+            for (int j=0; j<2; j++) {
 
-            //device.putc(buffer[i]);
-            device.putc(array[i]);
+                //device.printf("%i",buffer[i]);
+
+                //device.putc(buffer[i]);
+                device.putc(matrix[i][j]);
+            }
         }
         //wait(1);
     }
@@ -106,3 +114,29 @@
     }*/
     //printf("\n");
 }
+
+void Matrix()
+{
+
+    if (tl > 0) {
+        matrix[0][0] = 1;
+    } else {
+        matrix[0][0] = 0;
+    }
+    if (tr > 0) {
+        matrix[0][1] = 1;
+    } else {
+        matrix[0][1] = 0;
+    }
+    if (bl > 0) {
+        matrix[1][0] = 1;
+    } else {
+        matrix[1][0] = 0;
+    }
+    if (br > 0) {
+        matrix[1][1] = 1;
+    } else {
+        matrix[1][1] = 0;
+    }
+
+}