NUEVO

Dependencies:   mbed

Fork of 00_01LAB_matrix8x8_fig_tetris by Alyson Castiblanco

Revision:
6:2f42f0b53611
Parent:
5:819f043b99a5
Child:
7:0a94835bc6e4
diff -r 819f043b99a5 -r 2f42f0b53611 main.cpp
--- a/main.cpp	Sat Sep 08 03:46:46 2018 +0000
+++ b/main.cpp	Wed Sep 12 18:27:06 2018 +0000
@@ -71,10 +71,15 @@
  void copy_matrix(uint8_t*  m2, char col){
   
     for (int i=0; i<11;i++){
-        matrix_tmp[i]=  (*(m2+i)>>col);
+        matrix_tmp[i]=  (*(m2+i)>>(col-1));
     }
  } 
-
+void colum(){
+    for (int i=0;i<7;i++){
+        sendSPI(i-1,0);
+        sendSPI(i,temp+i);
+        }
+    }
     
 void new_read(){
     
@@ -89,72 +94,97 @@
     case  L_TYPE: 
     switch (ang)
          {  case NOVEN:
-            copy_matrix(FIG_L1);
+             switch(col)
+             {case 1:
+             copy_matrix(FIG_L1,1);
+             break;
+             case 2:
+             copy_matrix(FIG_L1,2);
+             break;
+             case 3:
+             copy_matrix(FIG_L1,3);
+             break;
+             case 4:
+             copy_matrix(FIG_L1,4);
+             break;
+             case 5:
+             copy_matrix(FIG_L1,5);
+             break;
+             case 6:
+             copy_matrix(FIG_L1,6);
+             break;
+             case 7:
+             copy_matrix(FIG_L1,7);
+             break;
+             case 8:
+             copy_matrix(FIG_L1,8);
+             break;
+            }
             break;
             case ZERO:
-            copy_matrix(FIG_L);
+            copy_matrix(FIG_L,1);
         break ; 
         case PII:
-            copy_matrix(FIG_L2);
+            copy_matrix(FIG_L2,1);
             break;
             case DOSSE:
-            copy_matrix(FIG_L3);
+            copy_matrix(FIG_L3,1);
             break; 
         }
-        break ;     
+                break ;     
     case  S_TYPE: 
         switch (ang)
          {  case NOVEN:
-            copy_matrix(FIG_S1);
+            copy_matrix(FIG_S1,1);
             break;
             case ZERO:
-            copy_matrix(FIG_S);
+            copy_matrix(FIG_S,1);
         break ; 
         case PII:
-            copy_matrix(FIG_S2);
+            copy_matrix(FIG_S2,1);
             break;
             case DOSSE:
-            copy_matrix(FIG_S3);
+            copy_matrix(FIG_S3,1);
             break; 
         }
         break ;     
     case  I_TYPE: 
         switch (ang)
          {  case NOVEN:
-            copy_matrix(FIG_I1);
+            copy_matrix(FIG_I1,1);
             break;
             case ZERO:
-            copy_matrix(FIG_I);
+            copy_matrix(FIG_I,1);
         break ; 
         case PII:
-            copy_matrix(FIG_I2);
+            copy_matrix(FIG_I2,1);
             break;
             case DOSSE:
-            copy_matrix(FIG_I3);
+            copy_matrix(FIG_I3,1);
             break; 
         }
         break ;     
     case  C_TYPE: 
-        copy_matrix(FIG_C);
+        copy_matrix(FIG_C,1);
         break ; 
     case  T_TYPE:
          switch (ang)
          {  case NOVEN:
-            copy_matrix(FIG_T1);
+            copy_matrix(FIG_T1,1);
             break;
             case ZERO:
-            copy_matrix(FIG_T);
+            copy_matrix(FIG_T,1);
         break ; 
         case PII:
-            copy_matrix(FIG_T2);
+            copy_matrix(FIG_T2,1);
             break;
             case DOSSE:
-            copy_matrix(FIG_T3);
+            copy_matrix(FIG_T3,1);
             break; 
         }
         break;
     default: 
-        copy_matrix(FIG_NULL);
+        copy_matrix(FIG_NULL,1);
         break;
         }
         }
@@ -174,9 +204,9 @@
     while(1){
        new_read();
            for(int i=0;i<8;i++){
-            desplazar_fila();
             act_matrix(matrix_tmp);
             printMatrix(matrix_act);
+            //desplazar_fila();
             wait_ms(VELOCITY);
        }  
        }