Andres Cano
/
00_01LAB_matrix8x8_fig_tetris1
alison castiblanco
Fork of 00_01LAB_matrix8x8_fig_tetris1 by
Diff: main.cpp
- Revision:
- 9:f6536806c250
- Parent:
- 8:0ddb5ffca870
- Child:
- 10:ae8cf84c82ca
--- a/main.cpp Thu Sep 13 13:02:21 2018 +0000 +++ b/main.cpp Thu Sep 13 20:05:40 2018 +0000 @@ -13,7 +13,42 @@ uint8_t matrix_act[8]={0,0,0,0,0,0,0,0}; uint8_t matrix_tmp[11]={0b00000000,0b00000000,0b00000000,0,0,0,0,0,0,0}; - +uint8_t array[3]={0,0,0}; + +void debug_m(char *s , ... ){ + #if DEBUG + command.printf(s); + #endif +} + +void clr_arr() +{ for(int i=0;i<5;i++) +{ + array[i]=0; + }} + +int recibe (void) +{ + char ini=command.getc(); + while(ini!='<') + ini=command.getc(); + + for(int i=0;i<3;i++) + { + array[i]=command.getc(); + } + + ini=command.getc(); + while(ini!='>') + { + debug_m("xx"); + return 0; + + } + debug_m("yy"); + return 1; + + } void sendSPI(uint8_t d1, uint8_t d2) { @@ -37,12 +72,6 @@ } -void debug_m(char *s , ... ){ - #if DEBUG - command.printf(s); - #endif -} - void printMatrix(uint8_t* vC) { @@ -87,19 +116,11 @@ void new_read(){ - - char ini=command.getc(); - char tf=command.getc(); - char ang=command.getc(); - char col=command.getc(); - char fin=command.getc(); - if(ini==0x3C && fin==0x3E) - { - switch (tf) { + switch (array[0]) { case L_TYPE: - switch (ang) + switch (array[1]) { case NOVEN: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_L1,1); break; @@ -127,7 +148,7 @@ } break; case ZERO: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_L,1); break; @@ -157,7 +178,7 @@ break ; case PII: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_L2,1); break; @@ -185,7 +206,7 @@ } break; case DOSSE: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_L3,1); break; @@ -215,9 +236,9 @@ } break ; case S_TYPE: - switch (ang) + switch (array[1]) { case NOVEN: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_S1,1); break; @@ -245,7 +266,7 @@ } break; case ZERO: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_S,1); break; @@ -273,7 +294,7 @@ } break ; case PII: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_S2,1); break; @@ -301,7 +322,7 @@ } break; case DOSSE: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_S3,1); break; @@ -331,10 +352,10 @@ } break ; case I_TYPE: - switch (ang) + switch (array[1]) { case NOVEN: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_I1,1); break; @@ -362,7 +383,7 @@ } break; case ZERO: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_I,1); break; @@ -390,7 +411,7 @@ } break ; case PII: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_I2,1); break; @@ -418,7 +439,7 @@ } break; case DOSSE: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_I3,1); break; @@ -448,7 +469,7 @@ } break ; case C_TYPE: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_C,1); break; @@ -476,9 +497,9 @@ } break ; case T_TYPE: - switch (ang) + switch (array[1]) { case NOVEN: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_T1,1); break; @@ -506,7 +527,7 @@ } break; case ZERO: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_T,1); break; @@ -534,7 +555,7 @@ } break ; case PII: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_T2,1); break; @@ -562,7 +583,7 @@ } break; case DOSSE: - switch(col) + switch(array[2]) {case 1: copy_matrix(FIG_T3,1); break; @@ -595,9 +616,7 @@ copy_matrix(FIG_NULL,1); break; } - } - else - {} + } //desplazamiento horizontal void desplazar_fila(){ @@ -609,6 +628,7 @@ int main() { init_display(); while(1){ + while(recibe()==0); new_read(); for(int i=0;i<8;i++){ act_matrix(matrix_tmp); @@ -616,7 +636,6 @@ //printMatrix(matrix_act); //desplazar_fila(); - - } + } } }