cualquier cosa

Dependencies:   mbed

Fork of 00_LAB_matrix8x8_SPI by ferney alberto beltran molina

Committer:
oggonei
Date:
Fri Sep 07 12:59:13 2018 +0000
Revision:
7:315c0b5f9425
Parent:
5:377b23953ba1
tetris

Who changed what in which revision?

UserRevisionLine numberNew contents of line
oggonei 4:b38a9b0501dc 1 #include "mbed.h"
fabeltranm 0:61199d9d0aed 2
oggonei 7:315c0b5f9425 3
oggonei 4:b38a9b0501dc 4 SPI deviceM(PB_5, PB_4, PB_3);
oggonei 4:b38a9b0501dc 5 DigitalOut ssel (PB_9);
oggonei 5:377b23953ba1 6 Serial command(USBTX,USBRX);
oggonei 5:377b23953ba1 7
oggonei 5:377b23953ba1 8 #define FIG_C 0x01
oggonei 5:377b23953ba1 9 #define FIG_I 0x02
oggonei 5:377b23953ba1 10 #define FIG_L 0x03
oggonei 5:377b23953ba1 11 #define FIG_T 0x04
oggonei 5:377b23953ba1 12 #define FIG_S 0x05
fabeltranm 0:61199d9d0aed 13
fabeltranm 0:61199d9d0aed 14 void sendSPI(uint8_t d1, uint8_t d2)
fabeltranm 0:61199d9d0aed 15 {
fabeltranm 0:61199d9d0aed 16 deviceM.unlock();
fabeltranm 0:61199d9d0aed 17 ssel=0;
oggonei 4:b38a9b0501dc 18 deviceM.write(d1);
oggonei 4:b38a9b0501dc 19 deviceM.write(d2);
fabeltranm 0:61199d9d0aed 20 ssel=1;
fabeltranm 0:61199d9d0aed 21 deviceM.lock();
fabeltranm 0:61199d9d0aed 22 };
fabeltranm 0:61199d9d0aed 23
oggonei 4:b38a9b0501dc 24 void test() //test
oggonei 4:b38a9b0501dc 25 {
oggonei 4:b38a9b0501dc 26 sendSPI(0x0F,1);
oggonei 4:b38a9b0501dc 27 wait(0.5);
oggonei 4:b38a9b0501dc 28 sendSPI(0x0F,0);
oggonei 4:b38a9b0501dc 29 wait(0.5);
oggonei 4:b38a9b0501dc 30 };
fabeltranm 0:61199d9d0aed 31
oggonei 5:377b23953ba1 32 void cuadro(int x,int y)
fabeltranm 0:61199d9d0aed 33 {
oggonei 7:315c0b5f9425 34 int j;
oggonei 7:315c0b5f9425 35 int cu[8]={0xC0,0x60,0x30,0x18,0xc,0x6,0x3,0x1};
oggonei 7:315c0b5f9425 36 switch(y)
oggonei 4:b38a9b0501dc 37 {
oggonei 7:315c0b5f9425 38 case 1: case1:
oggonei 7:315c0b5f9425 39 for(j=0;j<=7;j++)
oggonei 7:315c0b5f9425 40 {
oggonei 7:315c0b5f9425 41 sendSPI(0x0+j,cu[x-1]);
oggonei 7:315c0b5f9425 42 sendSPI(0x0+(j+1),cu[x-1]);
oggonei 7:315c0b5f9425 43 wait_ms(200);
oggonei 7:315c0b5f9425 44 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 45 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 46 wait_us(10);
oggonei 7:315c0b5f9425 47 }
oggonei 7:315c0b5f9425 48 sendSPI(0x07,cu[x-1]);
oggonei 7:315c0b5f9425 49 sendSPI(0x08,cu[x-1]);
oggonei 7:315c0b5f9425 50 break;
oggonei 7:315c0b5f9425 51 case 2: goto case1;
oggonei 7:315c0b5f9425 52 case 3: goto case1;
oggonei 7:315c0b5f9425 53 case 4: goto case1;
oggonei 4:b38a9b0501dc 54 }
oggonei 4:b38a9b0501dc 55 };
fabeltranm 2:414129d953dd 56
oggonei 5:377b23953ba1 57 void linea(int x,int y)
oggonei 4:b38a9b0501dc 58 {
oggonei 7:315c0b5f9425 59 int j;
oggonei 5:377b23953ba1 60 int lin0[8]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
oggonei 7:315c0b5f9425 61 int lin90[8]={0b11100000,0b01110000,0b00111000,0b00011100,0b00001110,0b00000111,0b00000111,0b00000111};
fabeltranm 2:414129d953dd 62 {
oggonei 7:315c0b5f9425 63 switch (y){
oggonei 7:315c0b5f9425 64 case 1: case1: for(j=0;j<=6;j++)
oggonei 4:b38a9b0501dc 65 {
oggonei 7:315c0b5f9425 66 sendSPI(0x0+j,lin0[x-1]);
oggonei 7:315c0b5f9425 67 sendSPI(0x0+(j+1),lin0[x-1]);
oggonei 7:315c0b5f9425 68 sendSPI(0x0+(j+2),lin0[x-1]);
oggonei 4:b38a9b0501dc 69 wait_ms(200);
oggonei 4:b38a9b0501dc 70 sendSPI(0x0+j,0x00);
oggonei 4:b38a9b0501dc 71 sendSPI(0x0+(j+1),0x00);
oggonei 4:b38a9b0501dc 72 sendSPI(0x0+(j+2),0x00);
oggonei 4:b38a9b0501dc 73 wait_us(10);
oggonei 4:b38a9b0501dc 74 }
oggonei 7:315c0b5f9425 75 sendSPI(0x06,lin0[x-1]);
oggonei 7:315c0b5f9425 76 sendSPI(0x07,lin0[x-1]);
oggonei 7:315c0b5f9425 77 sendSPI(0x08,lin0[x-1]);
oggonei 5:377b23953ba1 78 break;
oggonei 7:315c0b5f9425 79 case 2: case2: for(j=0;j<=7;j++)
oggonei 5:377b23953ba1 80 {
oggonei 7:315c0b5f9425 81 sendSPI(0x0+j,lin90[x-1]);
oggonei 5:377b23953ba1 82 wait_ms(200);
oggonei 5:377b23953ba1 83 sendSPI(0x0+j,0x00);
oggonei 5:377b23953ba1 84 wait_us(10);
oggonei 5:377b23953ba1 85 }
oggonei 7:315c0b5f9425 86 sendSPI(0x08,lin90[x-1]);
oggonei 5:377b23953ba1 87 break;
oggonei 7:315c0b5f9425 88 case 3: goto case1;
oggonei 7:315c0b5f9425 89 case 4: goto case2;
oggonei 5:377b23953ba1 90 }
oggonei 5:377b23953ba1 91
oggonei 5:377b23953ba1 92 }
oggonei 4:b38a9b0501dc 93 };
oggonei 4:b38a9b0501dc 94
oggonei 5:377b23953ba1 95 void ele(int x,int y)
fabeltranm 2:414129d953dd 96 {
oggonei 7:315c0b5f9425 97 int j;
oggonei 7:315c0b5f9425 98 int ele10[8]={0xc0,0x60,0x30,0x18,0xc,0x06,0x03,0x01};
oggonei 7:315c0b5f9425 99 int ele20[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
oggonei 7:315c0b5f9425 100 int ele190[8]={0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001,0x00,0x00};
oggonei 7:315c0b5f9425 101 int ele290[8]={0b11100000,0b01110000,0b00111000,0b00011100,0b00001110,0b00000111,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 102 int ele1180[8]={0b11000000,0b01100000,0b00110000,0b00011000,0b00001100,0b00000110,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 103 int ele2180[8]={0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001,0b00000000};
oggonei 7:315c0b5f9425 104 int ele1270[8]={0b11100000,0b01110000,0b00111000,0b00011100,0b00001110,0b00000111,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 105 int ele2270[8]={0b10000000,0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001};
oggonei 7:315c0b5f9425 106 switch(y)
oggonei 4:b38a9b0501dc 107 {
oggonei 7:315c0b5f9425 108 case 1:
oggonei 7:315c0b5f9425 109 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 110 {
oggonei 7:315c0b5f9425 111 sendSPI(0x0+j,ele20[x-1]);
oggonei 7:315c0b5f9425 112 sendSPI(0x0+(j+1),ele20[x-1]);
oggonei 7:315c0b5f9425 113 sendSPI(0x0+(j+2),ele10[x-1]);
oggonei 7:315c0b5f9425 114 wait_ms(200);
oggonei 7:315c0b5f9425 115 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 116 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 117 sendSPI(0x0+(j+2),0x00);
oggonei 7:315c0b5f9425 118 wait_us(10);
oggonei 7:315c0b5f9425 119 }
oggonei 7:315c0b5f9425 120 sendSPI(0x06,ele20[x-1]);
oggonei 7:315c0b5f9425 121 sendSPI(0x07,ele20[x-1]);
oggonei 7:315c0b5f9425 122 sendSPI(0x08,ele10[x-1]);
oggonei 7:315c0b5f9425 123 break;
oggonei 7:315c0b5f9425 124 case 2:
oggonei 7:315c0b5f9425 125 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 126 {
oggonei 7:315c0b5f9425 127 sendSPI(0x0+j,ele190[x-1]);
oggonei 7:315c0b5f9425 128 sendSPI(0x0+(j+1),ele290[x-1]);
oggonei 7:315c0b5f9425 129 wait_ms(200);
oggonei 7:315c0b5f9425 130 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 131 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 132 wait_us(10);
oggonei 7:315c0b5f9425 133 }
oggonei 7:315c0b5f9425 134 sendSPI(0x07,ele190[x-1]);
oggonei 7:315c0b5f9425 135 sendSPI(0x08,ele290[x-1]);
oggonei 7:315c0b5f9425 136 break;
oggonei 7:315c0b5f9425 137 case 3:
oggonei 7:315c0b5f9425 138 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 139 {
oggonei 7:315c0b5f9425 140 sendSPI(0x0+j,ele1180[x-1]);
oggonei 7:315c0b5f9425 141 sendSPI(0x0+(j+1),ele2180[x-1]);
oggonei 7:315c0b5f9425 142 sendSPI(0x0+(j+2),ele2180[x-1]);
oggonei 7:315c0b5f9425 143 wait_ms(200);
oggonei 7:315c0b5f9425 144 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 145 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 146 sendSPI(0x0+(j+2),0x00);
oggonei 7:315c0b5f9425 147 wait_us(10);
oggonei 7:315c0b5f9425 148 }
oggonei 7:315c0b5f9425 149 sendSPI(0x06,ele1180[x-1]);
oggonei 7:315c0b5f9425 150 sendSPI(0x07,ele2180[x-1]);
oggonei 7:315c0b5f9425 151 sendSPI(0x08,ele2180[x-1]);
oggonei 7:315c0b5f9425 152 break;
oggonei 7:315c0b5f9425 153 case 4:
oggonei 7:315c0b5f9425 154 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 155 {
oggonei 7:315c0b5f9425 156 sendSPI(0x0+j,ele1270[x-1]);
oggonei 7:315c0b5f9425 157 sendSPI(0x0+(j+1),ele2270[x-1]);
oggonei 7:315c0b5f9425 158 wait_ms(200);
oggonei 7:315c0b5f9425 159 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 160 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 161 wait_us(10);
oggonei 7:315c0b5f9425 162 }
oggonei 7:315c0b5f9425 163 sendSPI(0x07,ele1270[x-1]);
oggonei 7:315c0b5f9425 164 sendSPI(0x08,ele2270[x-1]);
oggonei 7:315c0b5f9425 165 break;
oggonei 7:315c0b5f9425 166 }
oggonei 7:315c0b5f9425 167 };
oggonei 7:315c0b5f9425 168
oggonei 7:315c0b5f9425 169 void te(int x,int y)
oggonei 7:315c0b5f9425 170 {
oggonei 7:315c0b5f9425 171 int te10[8]={0x40,0x20,0x10,0x8,0x4,0x2,0x1,0x01};
oggonei 7:315c0b5f9425 172 int te20[8]={0xe0,0x70,0x38,0x1c,0xe,0x7,0x03,0x01};
oggonei 7:315c0b5f9425 173 int te190[8]={0b10000000,0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001};
oggonei 7:315c0b5f9425 174 int te290[8]={0b11000000,0b01100000,0b00110000,0b00011000,0b00001100,0b00000110,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 175 int te1180[8]={0b11100000,0b01110000,0b00111000,0b00011100,0b00001110,0b00000111,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 176 int te2180[8]={0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001,0b00000000};
oggonei 7:315c0b5f9425 177 int te1270[8]={0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001,0b00000000};
oggonei 7:315c0b5f9425 178 int te2270[8]={0b11000000,0b01100000,0b00110000,0b00011000,0b00001100,0b00000110,0b00000011,0b00000001};
oggonei 7:315c0b5f9425 179 int j;
oggonei 7:315c0b5f9425 180
oggonei 7:315c0b5f9425 181 switch(y)
oggonei 7:315c0b5f9425 182 {
oggonei 7:315c0b5f9425 183 case 1:
oggonei 7:315c0b5f9425 184 for(j=0;j<=7;j++)
oggonei 4:b38a9b0501dc 185 {
oggonei 7:315c0b5f9425 186 sendSPI(0x0+j,te10[x-1]);
oggonei 7:315c0b5f9425 187 sendSPI(0x0+(j+1),te20[x-1]);
oggonei 7:315c0b5f9425 188 wait_ms(200);
oggonei 7:315c0b5f9425 189 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 190 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 191 wait_us(10);
oggonei 7:315c0b5f9425 192 }
oggonei 7:315c0b5f9425 193 sendSPI(0x07,te10[x-1]);
oggonei 7:315c0b5f9425 194 sendSPI(0x08,te20[x-1]);
oggonei 7:315c0b5f9425 195 break;
oggonei 7:315c0b5f9425 196 case 2:
oggonei 7:315c0b5f9425 197 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 198 {
oggonei 7:315c0b5f9425 199 sendSPI(0x0+j,te190[x-1]);
oggonei 7:315c0b5f9425 200 sendSPI(0x0+(j+1),te290[x-1]);
oggonei 7:315c0b5f9425 201 sendSPI(0x0+(j+2),te190[x-1]);
oggonei 4:b38a9b0501dc 202 wait_ms(200);
oggonei 4:b38a9b0501dc 203 sendSPI(0x0+j,0x00);
oggonei 4:b38a9b0501dc 204 sendSPI(0x0+(j+1),0x00);
oggonei 4:b38a9b0501dc 205 sendSPI(0x0+(j+2),0x00);
oggonei 4:b38a9b0501dc 206 wait_us(10);
oggonei 4:b38a9b0501dc 207 }
oggonei 7:315c0b5f9425 208 sendSPI(0x06,te190[x-1]);
oggonei 7:315c0b5f9425 209 sendSPI(0x07,te290[x-1]);
oggonei 7:315c0b5f9425 210 sendSPI(0x08,te190[x-1]);
oggonei 7:315c0b5f9425 211 break;
oggonei 7:315c0b5f9425 212 case 3:
oggonei 7:315c0b5f9425 213 for(j=0;j<=7;j++)
oggonei 7:315c0b5f9425 214 {
oggonei 7:315c0b5f9425 215 sendSPI(0x0+j,te1180[x-1]);
oggonei 7:315c0b5f9425 216 sendSPI(0x0+(j+1),te2180[x-1]);
oggonei 7:315c0b5f9425 217 wait_ms(200);
oggonei 7:315c0b5f9425 218 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 219 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 220 sendSPI(0x0+(j+2),0x00);
oggonei 7:315c0b5f9425 221 wait_us(10);
oggonei 7:315c0b5f9425 222 }
oggonei 7:315c0b5f9425 223 sendSPI(0x07,te1180[x-1]);
oggonei 7:315c0b5f9425 224 sendSPI(0x08,te2180[x-1]);
oggonei 7:315c0b5f9425 225 break;
oggonei 7:315c0b5f9425 226 case 4:
oggonei 7:315c0b5f9425 227 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 228 {
oggonei 7:315c0b5f9425 229 sendSPI(0x0+j,te1270[x-1]);
oggonei 7:315c0b5f9425 230 sendSPI(0x0+(j+1),te2270[x-1]);
oggonei 7:315c0b5f9425 231 sendSPI(0x0+(j+2),te1270[x-1]);
oggonei 7:315c0b5f9425 232 wait_ms(200);
oggonei 7:315c0b5f9425 233 sendSPI(0x0+j,0x00);
oggonei 7:315c0b5f9425 234 sendSPI(0x0+(j+1),0x00);
oggonei 7:315c0b5f9425 235 sendSPI(0x0+(j+2),0x00);
oggonei 7:315c0b5f9425 236 wait_us(10);
oggonei 7:315c0b5f9425 237 }
oggonei 7:315c0b5f9425 238 sendSPI(0x06,te1270[x-1]);
oggonei 7:315c0b5f9425 239 sendSPI(0x07,te2270[x-1]);
oggonei 7:315c0b5f9425 240 sendSPI(0x08,te1270[x-1]);
oggonei 7:315c0b5f9425 241 break;
oggonei 7:315c0b5f9425 242 }
oggonei 4:b38a9b0501dc 243 };
fabeltranm 2:414129d953dd 244
oggonei 7:315c0b5f9425 245 void ese(int x,int y)
fabeltranm 1:b732136485e0 246 {
oggonei 7:315c0b5f9425 247 int ese10[8]={0x60,0x30,0x18,0xc,0x6,0x3,0x1,0x0};
oggonei 7:315c0b5f9425 248 int ese20[8]={0xc0,0x60,0x30,0x18,0xc,0x6,0x3,0x01};
oggonei 7:315c0b5f9425 249 int ese190[8]={0b10000000,0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0x01};
oggonei 7:315c0b5f9425 250 int ese290[8]={0b11000000,0b01100000,0b00110000,0b00011000,0b00001100,0b00000110,0b00000011,0x01};
oggonei 7:315c0b5f9425 251 int ese390[8]={0b01000000,0b00100000,0b00010000,0b00001000,0b00000100,0b00000010,0b00000001,0x00};
oggonei 7:315c0b5f9425 252
oggonei 7:315c0b5f9425 253 int j;
oggonei 7:315c0b5f9425 254 switch(y)
oggonei 4:b38a9b0501dc 255 {
oggonei 7:315c0b5f9425 256 case 1: case1:
oggonei 7:315c0b5f9425 257 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 258 {
oggonei 7:315c0b5f9425 259 sendSPI(0x0+j,ese10[x-1]);
oggonei 7:315c0b5f9425 260 sendSPI(0x0+(j+1),ese20[x-1]);
oggonei 4:b38a9b0501dc 261 wait_ms(200);
oggonei 4:b38a9b0501dc 262 sendSPI(0x0+j,0x00);
oggonei 4:b38a9b0501dc 263 sendSPI(0x0+(j+1),0x00);
oggonei 4:b38a9b0501dc 264 wait_us(10);
oggonei 7:315c0b5f9425 265 }
oggonei 7:315c0b5f9425 266 sendSPI(0x07,ese10[x-1]);
oggonei 7:315c0b5f9425 267 sendSPI(0x08,ese20[x-1]);
oggonei 7:315c0b5f9425 268 break;
oggonei 7:315c0b5f9425 269 case 2: case2:
oggonei 7:315c0b5f9425 270 for(j=0;j<=6;j++)
oggonei 7:315c0b5f9425 271 {
oggonei 7:315c0b5f9425 272 sendSPI(0x0+j,ese190[x-1]);
oggonei 7:315c0b5f9425 273 sendSPI(0x0+(j+1),ese290[x-1]);
oggonei 7:315c0b5f9425 274 sendSPI(0x0+(j+2),ese390[x-1]);
oggonei 4:b38a9b0501dc 275 wait_ms(200);
oggonei 4:b38a9b0501dc 276 sendSPI(0x0+j,0x00);
oggonei 4:b38a9b0501dc 277 sendSPI(0x0+(j+1),0x00);
oggonei 4:b38a9b0501dc 278 wait_us(10);
oggonei 7:315c0b5f9425 279 }
oggonei 7:315c0b5f9425 280 sendSPI(0x06,ese190[x-1]);
oggonei 7:315c0b5f9425 281 sendSPI(0x07,ese290[x-1]);
oggonei 7:315c0b5f9425 282 sendSPI(0x08,ese390[x-1]);
oggonei 7:315c0b5f9425 283 break;
oggonei 7:315c0b5f9425 284 case 3: goto case1;
oggonei 7:315c0b5f9425 285 case 4: goto case2;
oggonei 4:b38a9b0501dc 286 }
oggonei 4:b38a9b0501dc 287 };
oggonei 4:b38a9b0501dc 288
oggonei 4:b38a9b0501dc 289 void borrar()
oggonei 4:b38a9b0501dc 290 {
oggonei 4:b38a9b0501dc 291 int i;
oggonei 4:b38a9b0501dc 292 for(i=0;i<=8;i++)
oggonei 4:b38a9b0501dc 293 {
oggonei 4:b38a9b0501dc 294 sendSPI(0x0+i,0x00);
oggonei 4:b38a9b0501dc 295 }
oggonei 4:b38a9b0501dc 296 };
fabeltranm 0:61199d9d0aed 297
oggonei 7:315c0b5f9425 298 void dibujar(int type_fig,int grados, int columna)
oggonei 5:377b23953ba1 299 {
oggonei 5:377b23953ba1 300 //borrar();
oggonei 5:377b23953ba1 301
oggonei 5:377b23953ba1 302 switch (type_fig){
oggonei 5:377b23953ba1 303 case FIG_C: cuadro(columna,grados); break;
oggonei 5:377b23953ba1 304 case FIG_I: linea(columna,grados); break;
oggonei 5:377b23953ba1 305 case FIG_L: ele(columna,grados); break;
oggonei 5:377b23953ba1 306 case FIG_T: te(columna,grados); break;
oggonei 5:377b23953ba1 307 case FIG_S: ese(columna,grados); break;
oggonei 5:377b23953ba1 308
oggonei 5:377b23953ba1 309 };
oggonei 5:377b23953ba1 310
oggonei 5:377b23953ba1 311 }
fabeltranm 0:61199d9d0aed 312
fabeltranm 0:61199d9d0aed 313 int main() {
oggonei 4:b38a9b0501dc 314 sendSPI(0x09,0); //no decodificacion
oggonei 4:b38a9b0501dc 315 sendSPI(0x0A,0x0); //intensidad
oggonei 4:b38a9b0501dc 316 sendSPI(0x0B,0x07); //usa 7 leds
oggonei 4:b38a9b0501dc 317 sendSPI(0x0C,1); //no apaga
oggonei 4:b38a9b0501dc 318 sendSPI(0x0F,0); //operacion normal
oggonei 4:b38a9b0501dc 319
oggonei 5:377b23953ba1 320 int tipo_fig=1,ncolumna=1,grados=1,lee1=0x00,lee2=0x00; // enviar ficha y columna
fabeltranm 0:61199d9d0aed 321
oggonei 5:377b23953ba1 322 while(1){
oggonei 5:377b23953ba1 323 lee1=command.getc();
oggonei 5:377b23953ba1 324 tipo_fig=command.getc();
oggonei 5:377b23953ba1 325 grados=command.getc();
oggonei 5:377b23953ba1 326 ncolumna=command.getc();
oggonei 5:377b23953ba1 327 lee2=command.getc();
oggonei 5:377b23953ba1 328
oggonei 5:377b23953ba1 329 if(lee1==0x3c && lee2==0x3e)
oggonei 5:377b23953ba1 330 {
oggonei 7:315c0b5f9425 331 dibujar(tipo_fig,grados,ncolumna);
oggonei 5:377b23953ba1 332 }
oggonei 5:377b23953ba1 333 }
oggonei 5:377b23953ba1 334 }