Mfonobong Ekanem
/
buzzer
code for turning two lights on and off
main.cpp@0:10d7f18a8cb6, 2015-05-02 (annotated)
- Committer:
- el12moe
- Date:
- Sat May 02 15:40:25 2015 +0000
- Revision:
- 0:10d7f18a8cb6
Function for two rooms(reed switches and pir)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el12moe | 0:10d7f18a8cb6 | 1 | #include "mbed.h" |
el12moe | 0:10d7f18a8cb6 | 2 | #include <string.h> |
el12moe | 0:10d7f18a8cb6 | 3 | #include <stdio.h> |
el12moe | 0:10d7f18a8cb6 | 4 | |
el12moe | 0:10d7f18a8cb6 | 5 | |
el12moe | 0:10d7f18a8cb6 | 6 | Serial xbee(p9,p10); //Initalise xbee_lib |
el12moe | 0:10d7f18a8cb6 | 7 | |
el12moe | 0:10d7f18a8cb6 | 8 | DigitalOut myled(LED1); |
el12moe | 0:10d7f18a8cb6 | 9 | DigitalOut mled(LED2); |
el12moe | 0:10d7f18a8cb6 | 10 | DigitalOut m3led(LED3); |
el12moe | 0:10d7f18a8cb6 | 11 | DigitalOut m4led(LED4); |
el12moe | 0:10d7f18a8cb6 | 12 | |
el12moe | 0:10d7f18a8cb6 | 13 | |
el12moe | 0:10d7f18a8cb6 | 14 | void xbee_detect(void); |
el12moe | 0:10d7f18a8cb6 | 15 | void light2(void); |
el12moe | 0:10d7f18a8cb6 | 16 | void light1(void); |
el12moe | 0:10d7f18a8cb6 | 17 | void reed1(void); |
el12moe | 0:10d7f18a8cb6 | 18 | void reed2(void); |
el12moe | 0:10d7f18a8cb6 | 19 | void count1(void); |
el12moe | 0:10d7f18a8cb6 | 20 | void count2(void); |
el12moe | 0:10d7f18a8cb6 | 21 | void count3(void); |
el12moe | 0:10d7f18a8cb6 | 22 | void count4(void); |
el12moe | 0:10d7f18a8cb6 | 23 | |
el12moe | 0:10d7f18a8cb6 | 24 | |
el12moe | 0:10d7f18a8cb6 | 25 | //pin D4 and D3 configured |
el12moe | 0:10d7f18a8cb6 | 26 | int xbee1 = 104;// reed switches |
el12moe | 0:10d7f18a8cb6 | 27 | int xbee2 = 45; // PIR |
el12moe | 0:10d7f18a8cb6 | 28 | int xbee3 = 76;// reed switches |
el12moe | 0:10d7f18a8cb6 | 29 | int xbee4 = 69;// PIR |
el12moe | 0:10d7f18a8cb6 | 30 | |
el12moe | 0:10d7f18a8cb6 | 31 | |
el12moe | 0:10d7f18a8cb6 | 32 | short counter1 = 0; |
el12moe | 0:10d7f18a8cb6 | 33 | short counter2 = 0; |
el12moe | 0:10d7f18a8cb6 | 34 | short counter3 = 0; |
el12moe | 0:10d7f18a8cb6 | 35 | short counter4 = 0; |
el12moe | 0:10d7f18a8cb6 | 36 | int readAddress = 0; |
el12moe | 0:10d7f18a8cb6 | 37 | int readValue=0; |
el12moe | 0:10d7f18a8cb6 | 38 | |
el12moe | 0:10d7f18a8cb6 | 39 | |
el12moe | 0:10d7f18a8cb6 | 40 | //function declarations |
el12moe | 0:10d7f18a8cb6 | 41 | //void setRGBPixel(int r, int g, int b); //sets colour of one RGB Pixel |
el12moe | 0:10d7f18a8cb6 | 42 | void setRGBStrip1(int r, int g, int b); //sets colour of a strip of 8 RGB Pixels on pin 5 |
el12moe | 0:10d7f18a8cb6 | 43 | void setRGBStrip2(int r, int g, int b); //sets colour of a strip of 8 RGB Pixels on pin 11 |
el12moe | 0:10d7f18a8cb6 | 44 | void setRGBPixels1(int colours[8][3]); //sets sequence of colours for a strip of 8 RGB Pixels on pin 5 |
el12moe | 0:10d7f18a8cb6 | 45 | void setRGBPixels2(int colours[8][3]); //sets sequence of colours for a strip of 8 RGB Pixels on pin 11 |
el12moe | 0:10d7f18a8cb6 | 46 | //void setRGBFloor1(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels on pin 5 |
el12moe | 0:10d7f18a8cb6 | 47 | //void setRGBFloor2(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels on pin 11 |
el12moe | 0:10d7f18a8cb6 | 48 | |
el12moe | 0:10d7f18a8cb6 | 49 | |
el12moe | 0:10d7f18a8cb6 | 50 | void spi_init(); //initializes SPI pin at correct bit length and bit rate |
el12moe | 0:10d7f18a8cb6 | 51 | int * decimalToBinary(int n); //converts a decimal value between 0 and 255 to an 8 bit binary array of 0xF00 (0) and 0xFF0 (1) |
el12moe | 0:10d7f18a8cb6 | 52 | |
el12moe | 0:10d7f18a8cb6 | 53 | //initialize pins |
el12moe | 0:10d7f18a8cb6 | 54 | DigitalOut volt(p16); //pin for LV voltage |
el12moe | 0:10d7f18a8cb6 | 55 | SPI spi(p5, p6, p7);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK |
el12moe | 0:10d7f18a8cb6 | 56 | SPI spi2(p11, p12, p13);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK |
el12moe | 0:10d7f18a8cb6 | 57 | |
el12moe | 0:10d7f18a8cb6 | 58 | int main() { |
el12moe | 0:10d7f18a8cb6 | 59 | setRGBStrip1(0,0,0); |
el12moe | 0:10d7f18a8cb6 | 60 | wait(2); |
el12moe | 0:10d7f18a8cb6 | 61 | |
el12moe | 0:10d7f18a8cb6 | 62 | while(1) { |
el12moe | 0:10d7f18a8cb6 | 63 | xbee_detect(); |
el12moe | 0:10d7f18a8cb6 | 64 | //setRGBStrip1(127,127,127); |
el12moe | 0:10d7f18a8cb6 | 65 | light2(); |
el12moe | 0:10d7f18a8cb6 | 66 | light1(); |
el12moe | 0:10d7f18a8cb6 | 67 | reed1(); |
el12moe | 0:10d7f18a8cb6 | 68 | reed2(); |
el12moe | 0:10d7f18a8cb6 | 69 | } |
el12moe | 0:10d7f18a8cb6 | 70 | } |
el12moe | 0:10d7f18a8cb6 | 71 | |
el12moe | 0:10d7f18a8cb6 | 72 | void xbee_detect(void){ |
el12moe | 0:10d7f18a8cb6 | 73 | if (xbee.getc() == 0x7E) { |
el12moe | 0:10d7f18a8cb6 | 74 | for (int i = 0; i < 19; i++) { |
el12moe | 0:10d7f18a8cb6 | 75 | if (i<10){ |
el12moe | 0:10d7f18a8cb6 | 76 | int discard = xbee.getc(); |
el12moe | 0:10d7f18a8cb6 | 77 | } |
el12moe | 0:10d7f18a8cb6 | 78 | else if (i<11){ |
el12moe | 0:10d7f18a8cb6 | 79 | readAddress = xbee.getc(); |
el12moe | 0:10d7f18a8cb6 | 80 | } |
el12moe | 0:10d7f18a8cb6 | 81 | else{ |
el12moe | 0:10d7f18a8cb6 | 82 | int discarded = xbee.getc(); |
el12moe | 0:10d7f18a8cb6 | 83 | } |
el12moe | 0:10d7f18a8cb6 | 84 | } |
el12moe | 0:10d7f18a8cb6 | 85 | readValue = xbee.getc(); |
el12moe | 0:10d7f18a8cb6 | 86 | } |
el12moe | 0:10d7f18a8cb6 | 87 | } |
el12moe | 0:10d7f18a8cb6 | 88 | //lights room1 |
el12moe | 0:10d7f18a8cb6 | 89 | void light1(void){ |
el12moe | 0:10d7f18a8cb6 | 90 | if ( readAddress == xbee2){ |
el12moe | 0:10d7f18a8cb6 | 91 | if (readValue == 0){ |
el12moe | 0:10d7f18a8cb6 | 92 | counter2++; |
el12moe | 0:10d7f18a8cb6 | 93 | count2(); |
el12moe | 0:10d7f18a8cb6 | 94 | } |
el12moe | 0:10d7f18a8cb6 | 95 | else if(readValue == 16){ |
el12moe | 0:10d7f18a8cb6 | 96 | counter2 = 0; |
el12moe | 0:10d7f18a8cb6 | 97 | setRGBStrip1(127,127,127); |
el12moe | 0:10d7f18a8cb6 | 98 | wait(2);//mled = 1; |
el12moe | 0:10d7f18a8cb6 | 99 | } |
el12moe | 0:10d7f18a8cb6 | 100 | } |
el12moe | 0:10d7f18a8cb6 | 101 | } |
el12moe | 0:10d7f18a8cb6 | 102 | //room 2 |
el12moe | 0:10d7f18a8cb6 | 103 | void light2(void){ |
el12moe | 0:10d7f18a8cb6 | 104 | if ( readAddress == xbee4){ |
el12moe | 0:10d7f18a8cb6 | 105 | if (readValue == 0){ |
el12moe | 0:10d7f18a8cb6 | 106 | counter4++; |
el12moe | 0:10d7f18a8cb6 | 107 | count4(); |
el12moe | 0:10d7f18a8cb6 | 108 | |
el12moe | 0:10d7f18a8cb6 | 109 | } |
el12moe | 0:10d7f18a8cb6 | 110 | |
el12moe | 0:10d7f18a8cb6 | 111 | else if(readValue == 16){ |
el12moe | 0:10d7f18a8cb6 | 112 | counter4 = 0; |
el12moe | 0:10d7f18a8cb6 | 113 | setRGBStrip2(127,127,127); |
el12moe | 0:10d7f18a8cb6 | 114 | } |
el12moe | 0:10d7f18a8cb6 | 115 | } |
el12moe | 0:10d7f18a8cb6 | 116 | } |
el12moe | 0:10d7f18a8cb6 | 117 | |
el12moe | 0:10d7f18a8cb6 | 118 | void reed1(void){ |
el12moe | 0:10d7f18a8cb6 | 119 | if( readAddress == xbee1){ |
el12moe | 0:10d7f18a8cb6 | 120 | if (readValue == 0){ |
el12moe | 0:10d7f18a8cb6 | 121 | counter1++; |
el12moe | 0:10d7f18a8cb6 | 122 | count1(); |
el12moe | 0:10d7f18a8cb6 | 123 | } |
el12moe | 0:10d7f18a8cb6 | 124 | else if(readValue == 16){ |
el12moe | 0:10d7f18a8cb6 | 125 | counter1 = 0; |
el12moe | 0:10d7f18a8cb6 | 126 | myled = 1; |
el12moe | 0:10d7f18a8cb6 | 127 | } |
el12moe | 0:10d7f18a8cb6 | 128 | } |
el12moe | 0:10d7f18a8cb6 | 129 | } |
el12moe | 0:10d7f18a8cb6 | 130 | //room 2 |
el12moe | 0:10d7f18a8cb6 | 131 | void reed2(void){ |
el12moe | 0:10d7f18a8cb6 | 132 | if ( readAddress == xbee3){ |
el12moe | 0:10d7f18a8cb6 | 133 | if (readValue == 0){ |
el12moe | 0:10d7f18a8cb6 | 134 | counter3++; |
el12moe | 0:10d7f18a8cb6 | 135 | count3(); |
el12moe | 0:10d7f18a8cb6 | 136 | } |
el12moe | 0:10d7f18a8cb6 | 137 | else if(readValue == 16){ |
el12moe | 0:10d7f18a8cb6 | 138 | counter3 = 0; |
el12moe | 0:10d7f18a8cb6 | 139 | m3led = 1; |
el12moe | 0:10d7f18a8cb6 | 140 | } |
el12moe | 0:10d7f18a8cb6 | 141 | } |
el12moe | 0:10d7f18a8cb6 | 142 | } |
el12moe | 0:10d7f18a8cb6 | 143 | |
el12moe | 0:10d7f18a8cb6 | 144 | void count1(void){ |
el12moe | 0:10d7f18a8cb6 | 145 | if(counter1==10){ |
el12moe | 0:10d7f18a8cb6 | 146 | myled = 0; |
el12moe | 0:10d7f18a8cb6 | 147 | counter1 = 0; |
el12moe | 0:10d7f18a8cb6 | 148 | } |
el12moe | 0:10d7f18a8cb6 | 149 | } |
el12moe | 0:10d7f18a8cb6 | 150 | void count3(void){ |
el12moe | 0:10d7f18a8cb6 | 151 | if(counter3==10){ |
el12moe | 0:10d7f18a8cb6 | 152 | m3led = 0; |
el12moe | 0:10d7f18a8cb6 | 153 | counter1 = 0; |
el12moe | 0:10d7f18a8cb6 | 154 | } |
el12moe | 0:10d7f18a8cb6 | 155 | } |
el12moe | 0:10d7f18a8cb6 | 156 | |
el12moe | 0:10d7f18a8cb6 | 157 | //lights count |
el12moe | 0:10d7f18a8cb6 | 158 | void count2(void){ |
el12moe | 0:10d7f18a8cb6 | 159 | if(counter2==150){ |
el12moe | 0:10d7f18a8cb6 | 160 | // mled = 0; |
el12moe | 0:10d7f18a8cb6 | 161 | setRGBStrip1(0,0,0); |
el12moe | 0:10d7f18a8cb6 | 162 | wait(2); |
el12moe | 0:10d7f18a8cb6 | 163 | counter2 = 0; |
el12moe | 0:10d7f18a8cb6 | 164 | } |
el12moe | 0:10d7f18a8cb6 | 165 | } |
el12moe | 0:10d7f18a8cb6 | 166 | |
el12moe | 0:10d7f18a8cb6 | 167 | void count4(void){ |
el12moe | 0:10d7f18a8cb6 | 168 | if(counter4==150){ |
el12moe | 0:10d7f18a8cb6 | 169 | // mled = 0; |
el12moe | 0:10d7f18a8cb6 | 170 | setRGBStrip2(0,0,0); |
el12moe | 0:10d7f18a8cb6 | 171 | counter2 = 0; |
el12moe | 0:10d7f18a8cb6 | 172 | } |
el12moe | 0:10d7f18a8cb6 | 173 | } |
el12moe | 0:10d7f18a8cb6 | 174 | |
el12moe | 0:10d7f18a8cb6 | 175 | void setRGBStrip1(int r, int g, int b){ |
el12moe | 0:10d7f18a8cb6 | 176 | int r_array[8]; |
el12moe | 0:10d7f18a8cb6 | 177 | int g_array[8]; |
el12moe | 0:10d7f18a8cb6 | 178 | int b_array[8]; |
el12moe | 0:10d7f18a8cb6 | 179 | memcpy(r_array, decimalToBinary(r), sizeof(r_array)); |
el12moe | 0:10d7f18a8cb6 | 180 | memcpy(g_array, decimalToBinary(g), sizeof(g_array)); |
el12moe | 0:10d7f18a8cb6 | 181 | memcpy(b_array, decimalToBinary(b), sizeof(b_array)); |
el12moe | 0:10d7f18a8cb6 | 182 | |
el12moe | 0:10d7f18a8cb6 | 183 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 184 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 185 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 186 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 187 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 188 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 189 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 190 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 191 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 192 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 193 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 194 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 195 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 196 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 197 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 198 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 199 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 200 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 201 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 202 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 203 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 204 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 205 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 206 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 207 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 208 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 209 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 210 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 211 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 212 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 213 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 214 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 215 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 216 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 217 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 218 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 219 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 220 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 221 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 222 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 223 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 224 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 225 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 226 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 227 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 228 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 229 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 230 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 231 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 232 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 233 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 234 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 235 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 236 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 237 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 238 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 239 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 240 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 241 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 242 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 243 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 244 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 245 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 246 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 247 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 248 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 249 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 250 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 251 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 252 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 253 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 254 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 255 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 256 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 257 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 258 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 259 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 260 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 261 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 262 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 263 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 264 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 265 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 266 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 267 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 268 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 269 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 270 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 271 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 272 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 273 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 274 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 275 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 276 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 277 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 278 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 279 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 280 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 281 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 282 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 283 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 284 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 285 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 286 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 287 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 288 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 289 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 290 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 291 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 292 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 293 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 294 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 295 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 296 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 297 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 298 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 299 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 300 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 301 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 302 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 303 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 304 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 305 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 306 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 307 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 308 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 309 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 310 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 311 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 312 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 313 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 314 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 315 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 316 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 317 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 318 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 319 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 320 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 321 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 322 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 323 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 324 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 325 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 326 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 327 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 328 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 329 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 330 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 331 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 332 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 333 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 334 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 335 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 336 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 337 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 338 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 339 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 340 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 341 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 342 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 343 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 344 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 345 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 346 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 347 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 348 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 349 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 350 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 351 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 352 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 353 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 354 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 355 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 356 | |
el12moe | 0:10d7f18a8cb6 | 357 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 358 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 359 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 360 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 361 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 362 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 363 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 364 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 365 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 366 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 367 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 368 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 369 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 370 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 371 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 372 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 373 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 374 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 375 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 376 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 377 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 378 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 379 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 380 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 381 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 382 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 383 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 384 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 385 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 386 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 387 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 388 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 389 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 390 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 391 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 392 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 393 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 394 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 395 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 396 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 397 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 398 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 399 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 400 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 401 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 402 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 403 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 404 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 405 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 406 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 407 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 408 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 409 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 410 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 411 | |
el12moe | 0:10d7f18a8cb6 | 412 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 413 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 414 | } |
el12moe | 0:10d7f18a8cb6 | 415 | |
el12moe | 0:10d7f18a8cb6 | 416 | void setRGBStrip2(int r, int g, int b){ |
el12moe | 0:10d7f18a8cb6 | 417 | int r_array[8]; |
el12moe | 0:10d7f18a8cb6 | 418 | int g_array[8]; |
el12moe | 0:10d7f18a8cb6 | 419 | int b_array[8]; |
el12moe | 0:10d7f18a8cb6 | 420 | memcpy(r_array, decimalToBinary(r), sizeof(r_array)); |
el12moe | 0:10d7f18a8cb6 | 421 | memcpy(g_array, decimalToBinary(g), sizeof(g_array)); |
el12moe | 0:10d7f18a8cb6 | 422 | memcpy(b_array, decimalToBinary(b), sizeof(b_array)); |
el12moe | 0:10d7f18a8cb6 | 423 | |
el12moe | 0:10d7f18a8cb6 | 424 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 425 | //initialize spi |
el12moe | 0:10d7f18a8cb6 | 426 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 427 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 428 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 429 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 430 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 431 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 432 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 433 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 434 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 435 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 436 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 437 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 438 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 439 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 440 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 441 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 442 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 443 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 444 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 445 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 446 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 447 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 448 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 449 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 450 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 451 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 452 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 453 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 454 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 455 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 456 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 457 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 458 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 459 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 460 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 461 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 462 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 463 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 464 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 465 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 466 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 467 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 468 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 469 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 470 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 471 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 472 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 473 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 474 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 475 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 476 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 477 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 478 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 479 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 480 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 481 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 482 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 483 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 484 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 485 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 486 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 487 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 488 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 489 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 490 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 491 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 492 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 493 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 494 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 495 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 496 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 497 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 498 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 499 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 500 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 501 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 502 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 503 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 504 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 505 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 506 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 507 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 508 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 509 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 510 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 511 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 512 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 513 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 514 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 515 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 516 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 517 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 518 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 519 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 520 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 521 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 522 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 523 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 524 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 525 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 526 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 527 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 528 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 529 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 530 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 531 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 532 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 533 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 534 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 535 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 536 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 537 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 538 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 539 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 540 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 541 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 542 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 543 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 544 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 545 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 546 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 547 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 548 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 549 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 550 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 551 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 552 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 553 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 554 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 555 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 556 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 557 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 558 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 559 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 560 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 561 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 562 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 563 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 564 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 565 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 566 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 567 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 568 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 569 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 570 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 571 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 572 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 573 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 574 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 575 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 576 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 577 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 578 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 579 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 580 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 581 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 582 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 583 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 584 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 585 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 586 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 587 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 588 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 589 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 590 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 591 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 592 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 593 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 594 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 595 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 596 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 597 | |
el12moe | 0:10d7f18a8cb6 | 598 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 599 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 600 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 601 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 602 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 603 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 604 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 605 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 606 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 607 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 608 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 609 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 610 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 611 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 612 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 613 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 614 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 615 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 616 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 617 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 618 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 619 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 620 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 621 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 622 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 623 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 624 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 625 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 626 | spi2.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 627 | spi2.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 628 | spi2.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 629 | spi2.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 630 | spi2.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 631 | spi2.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 632 | spi2.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 633 | spi2.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 634 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 635 | spi2.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 636 | spi2.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 637 | spi2.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 638 | spi2.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 639 | spi2.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 640 | spi2.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 641 | spi2.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 642 | spi2.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 643 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 644 | spi2.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 645 | spi2.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 646 | spi2.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 647 | spi2.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 648 | spi2.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 649 | spi2.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 650 | spi2.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 651 | spi2.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 652 | |
el12moe | 0:10d7f18a8cb6 | 653 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 654 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 655 | } |
el12moe | 0:10d7f18a8cb6 | 656 | |
el12moe | 0:10d7f18a8cb6 | 657 | |
el12moe | 0:10d7f18a8cb6 | 658 | |
el12moe | 0:10d7f18a8cb6 | 659 | void setRGBPixel(int r, int g, int b){ |
el12moe | 0:10d7f18a8cb6 | 660 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
el12moe | 0:10d7f18a8cb6 | 661 | int r_array[8]; |
el12moe | 0:10d7f18a8cb6 | 662 | int g_array[8]; |
el12moe | 0:10d7f18a8cb6 | 663 | int b_array[8]; |
el12moe | 0:10d7f18a8cb6 | 664 | memcpy(r_array, decimalToBinary(r), sizeof(r_array)); |
el12moe | 0:10d7f18a8cb6 | 665 | memcpy(g_array, decimalToBinary(g), sizeof(g_array)); |
el12moe | 0:10d7f18a8cb6 | 666 | memcpy(b_array, decimalToBinary(b), sizeof(b_array)); |
el12moe | 0:10d7f18a8cb6 | 667 | |
el12moe | 0:10d7f18a8cb6 | 668 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 669 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 670 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 671 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 672 | spi.write(g_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 673 | spi.write(g_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 674 | spi.write(g_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 675 | spi.write(g_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 676 | spi.write(g_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 677 | spi.write(g_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 678 | spi.write(g_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 679 | spi.write(g_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 680 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 681 | spi.write(r_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 682 | spi.write(r_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 683 | spi.write(r_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 684 | spi.write(r_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 685 | spi.write(r_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 686 | spi.write(r_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 687 | spi.write(r_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 688 | spi.write(r_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 689 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 690 | spi.write(b_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 691 | spi.write(b_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 692 | spi.write(b_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 693 | spi.write(b_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 694 | spi.write(b_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 695 | spi.write(b_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 696 | spi.write(b_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 697 | spi.write(b_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 698 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 699 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 700 | } |
el12moe | 0:10d7f18a8cb6 | 701 | |
el12moe | 0:10d7f18a8cb6 | 702 | void setRGBPixels1(int colours[8][3]){ |
el12moe | 0:10d7f18a8cb6 | 703 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
el12moe | 0:10d7f18a8cb6 | 704 | int r0_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 705 | int g0_array[8]; |
el12moe | 0:10d7f18a8cb6 | 706 | int b0_array[8]; |
el12moe | 0:10d7f18a8cb6 | 707 | memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array)); |
el12moe | 0:10d7f18a8cb6 | 708 | memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array)); |
el12moe | 0:10d7f18a8cb6 | 709 | memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array)); |
el12moe | 0:10d7f18a8cb6 | 710 | int r1_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 711 | int g1_array[8]; |
el12moe | 0:10d7f18a8cb6 | 712 | int b1_array[8]; |
el12moe | 0:10d7f18a8cb6 | 713 | memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array)); |
el12moe | 0:10d7f18a8cb6 | 714 | memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array)); |
el12moe | 0:10d7f18a8cb6 | 715 | memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array)); |
el12moe | 0:10d7f18a8cb6 | 716 | int r2_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 717 | int g2_array[8]; |
el12moe | 0:10d7f18a8cb6 | 718 | int b2_array[8]; |
el12moe | 0:10d7f18a8cb6 | 719 | memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array)); |
el12moe | 0:10d7f18a8cb6 | 720 | memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array)); |
el12moe | 0:10d7f18a8cb6 | 721 | memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array)); |
el12moe | 0:10d7f18a8cb6 | 722 | int r3_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 723 | int g3_array[8]; |
el12moe | 0:10d7f18a8cb6 | 724 | int b3_array[8]; |
el12moe | 0:10d7f18a8cb6 | 725 | memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array)); |
el12moe | 0:10d7f18a8cb6 | 726 | memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array)); |
el12moe | 0:10d7f18a8cb6 | 727 | memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array)); |
el12moe | 0:10d7f18a8cb6 | 728 | int r4_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 729 | int g4_array[8]; |
el12moe | 0:10d7f18a8cb6 | 730 | int b4_array[8]; |
el12moe | 0:10d7f18a8cb6 | 731 | memcpy(r4_array, decimalToBinary(colours[4][0]), sizeof(r4_array)); |
el12moe | 0:10d7f18a8cb6 | 732 | memcpy(g4_array, decimalToBinary(colours[4][1]), sizeof(g4_array)); |
el12moe | 0:10d7f18a8cb6 | 733 | memcpy(b4_array, decimalToBinary(colours[4][2]), sizeof(b4_array)); |
el12moe | 0:10d7f18a8cb6 | 734 | int r5_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 735 | int g5_array[8]; |
el12moe | 0:10d7f18a8cb6 | 736 | int b5_array[8]; |
el12moe | 0:10d7f18a8cb6 | 737 | memcpy(r5_array, decimalToBinary(colours[5][0]), sizeof(r5_array)); |
el12moe | 0:10d7f18a8cb6 | 738 | memcpy(g5_array, decimalToBinary(colours[5][1]), sizeof(g5_array)); |
el12moe | 0:10d7f18a8cb6 | 739 | memcpy(b5_array, decimalToBinary(colours[5][2]), sizeof(b5_array)); |
el12moe | 0:10d7f18a8cb6 | 740 | int r6_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 741 | int g6_array[8]; |
el12moe | 0:10d7f18a8cb6 | 742 | int b6_array[8]; |
el12moe | 0:10d7f18a8cb6 | 743 | memcpy(r6_array, decimalToBinary(colours[6][0]), sizeof(r6_array)); |
el12moe | 0:10d7f18a8cb6 | 744 | memcpy(g6_array, decimalToBinary(colours[6][1]), sizeof(g6_array)); |
el12moe | 0:10d7f18a8cb6 | 745 | memcpy(b6_array, decimalToBinary(colours[6][2]), sizeof(b6_array)); |
el12moe | 0:10d7f18a8cb6 | 746 | int r7_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 747 | int g7_array[8]; |
el12moe | 0:10d7f18a8cb6 | 748 | int b7_array[8]; |
el12moe | 0:10d7f18a8cb6 | 749 | memcpy(r7_array, decimalToBinary(colours[7][0]), sizeof(r7_array)); |
el12moe | 0:10d7f18a8cb6 | 750 | memcpy(g7_array, decimalToBinary(colours[7][1]), sizeof(g7_array)); |
el12moe | 0:10d7f18a8cb6 | 751 | memcpy(b7_array, decimalToBinary(colours[7][2]), sizeof(b7_array)); |
el12moe | 0:10d7f18a8cb6 | 752 | |
el12moe | 0:10d7f18a8cb6 | 753 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 754 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 755 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 756 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 757 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 758 | spi.write(g0_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 759 | spi.write(g0_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 760 | spi.write(g0_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 761 | spi.write(g0_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 762 | spi.write(g0_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 763 | spi.write(g0_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 764 | spi.write(g0_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 765 | spi.write(g0_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 766 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 767 | spi.write(r0_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 768 | spi.write(r0_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 769 | spi.write(r0_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 770 | spi.write(r0_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 771 | spi.write(r0_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 772 | spi.write(r0_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 773 | spi.write(r0_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 774 | spi.write(r0_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 775 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 776 | spi.write(b0_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 777 | spi.write(b0_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 778 | spi.write(b0_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 779 | spi.write(b0_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 780 | spi.write(b0_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 781 | spi.write(b0_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 782 | spi.write(b0_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 783 | spi.write(b0_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 784 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 785 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 786 | spi.write(g1_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 787 | spi.write(g1_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 788 | spi.write(g1_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 789 | spi.write(g1_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 790 | spi.write(g1_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 791 | spi.write(g1_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 792 | spi.write(g1_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 793 | spi.write(g1_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 794 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 795 | spi.write(r1_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 796 | spi.write(r1_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 797 | spi.write(r1_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 798 | spi.write(r1_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 799 | spi.write(r1_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 800 | spi.write(r1_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 801 | spi.write(r1_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 802 | spi.write(r1_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 803 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 804 | spi.write(b1_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 805 | spi.write(b1_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 806 | spi.write(b1_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 807 | spi.write(b1_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 808 | spi.write(b1_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 809 | spi.write(b1_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 810 | spi.write(b1_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 811 | spi.write(b1_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 812 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 813 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 814 | spi.write(g2_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 815 | spi.write(g2_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 816 | spi.write(g2_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 817 | spi.write(g2_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 818 | spi.write(g2_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 819 | spi.write(g2_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 820 | spi.write(g2_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 821 | spi.write(g2_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 822 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 823 | spi.write(r2_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 824 | spi.write(r2_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 825 | spi.write(r2_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 826 | spi.write(r2_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 827 | spi.write(r2_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 828 | spi.write(r2_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 829 | spi.write(r2_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 830 | spi.write(r2_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 831 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 832 | spi.write(b2_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 833 | spi.write(b2_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 834 | spi.write(b2_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 835 | spi.write(b2_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 836 | spi.write(b2_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 837 | spi.write(b2_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 838 | spi.write(b2_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 839 | spi.write(b2_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 840 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 841 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 842 | spi.write(g3_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 843 | spi.write(g3_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 844 | spi.write(g3_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 845 | spi.write(g3_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 846 | spi.write(g3_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 847 | spi.write(g3_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 848 | spi.write(g3_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 849 | spi.write(g3_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 850 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 851 | spi.write(r3_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 852 | spi.write(r3_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 853 | spi.write(r3_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 854 | spi.write(r3_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 855 | spi.write(r3_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 856 | spi.write(r3_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 857 | spi.write(r3_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 858 | spi.write(r3_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 859 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 860 | spi.write(b3_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 861 | spi.write(b3_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 862 | spi.write(b3_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 863 | spi.write(b3_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 864 | spi.write(b3_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 865 | spi.write(b3_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 866 | spi.write(b3_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 867 | spi.write(b3_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 868 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 869 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 870 | spi.write(g4_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 871 | spi.write(g4_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 872 | spi.write(g4_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 873 | spi.write(g4_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 874 | spi.write(g4_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 875 | spi.write(g4_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 876 | spi.write(g4_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 877 | spi.write(g4_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 878 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 879 | spi.write(r4_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 880 | spi.write(r4_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 881 | spi.write(r4_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 882 | spi.write(r4_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 883 | spi.write(r4_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 884 | spi.write(r4_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 885 | spi.write(r4_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 886 | spi.write(r4_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 887 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 888 | spi.write(b4_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 889 | spi.write(b4_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 890 | spi.write(b4_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 891 | spi.write(b4_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 892 | spi.write(b4_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 893 | spi.write(b4_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 894 | spi.write(b4_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 895 | spi.write(b4_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 896 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 897 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 898 | spi.write(g5_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 899 | spi.write(g5_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 900 | spi.write(g5_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 901 | spi.write(g5_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 902 | spi.write(g5_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 903 | spi.write(g5_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 904 | spi.write(g5_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 905 | spi.write(g5_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 906 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 907 | spi.write(r5_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 908 | spi.write(r5_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 909 | spi.write(r5_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 910 | spi.write(r5_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 911 | spi.write(r5_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 912 | spi.write(r5_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 913 | spi.write(r5_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 914 | spi.write(r5_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 915 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 916 | spi.write(b5_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 917 | spi.write(b5_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 918 | spi.write(b5_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 919 | spi.write(b5_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 920 | spi.write(b5_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 921 | spi.write(b5_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 922 | spi.write(b5_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 923 | spi.write(b5_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 924 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 925 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 926 | spi.write(g6_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 927 | spi.write(g6_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 928 | spi.write(g6_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 929 | spi.write(g6_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 930 | spi.write(g6_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 931 | spi.write(g6_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 932 | spi.write(g6_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 933 | spi.write(g6_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 934 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 935 | spi.write(r6_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 936 | spi.write(r6_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 937 | spi.write(r6_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 938 | spi.write(r6_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 939 | spi.write(r6_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 940 | spi.write(r6_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 941 | spi.write(r6_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 942 | spi.write(r6_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 943 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 944 | spi.write(b6_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 945 | spi.write(b6_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 946 | spi.write(b6_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 947 | spi.write(b6_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 948 | spi.write(b6_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 949 | spi.write(b6_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 950 | spi.write(b6_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 951 | spi.write(b6_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 952 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 953 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 954 | spi.write(g7_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 955 | spi.write(g7_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 956 | spi.write(g7_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 957 | spi.write(g7_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 958 | spi.write(g7_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 959 | spi.write(g7_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 960 | spi.write(g7_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 961 | spi.write(g7_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 962 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 963 | spi.write(r7_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 964 | spi.write(r7_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 965 | spi.write(r7_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 966 | spi.write(r7_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 967 | spi.write(r7_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 968 | spi.write(r7_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 969 | spi.write(r7_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 970 | spi.write(r7_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 971 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 972 | spi.write(b7_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 973 | spi.write(b7_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 974 | spi.write(b7_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 975 | spi.write(b7_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 976 | spi.write(b7_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 977 | spi.write(b7_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 978 | spi.write(b7_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 979 | spi.write(b7_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 980 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 981 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 982 | } |
el12moe | 0:10d7f18a8cb6 | 983 | |
el12moe | 0:10d7f18a8cb6 | 984 | void setRGBPixels2(int colours[8][3]){ |
el12moe | 0:10d7f18a8cb6 | 985 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
el12moe | 0:10d7f18a8cb6 | 986 | int r0_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 987 | int g0_array[8]; |
el12moe | 0:10d7f18a8cb6 | 988 | int b0_array[8]; |
el12moe | 0:10d7f18a8cb6 | 989 | memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array)); |
el12moe | 0:10d7f18a8cb6 | 990 | memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array)); |
el12moe | 0:10d7f18a8cb6 | 991 | memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array)); |
el12moe | 0:10d7f18a8cb6 | 992 | int r1_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 993 | int g1_array[8]; |
el12moe | 0:10d7f18a8cb6 | 994 | int b1_array[8]; |
el12moe | 0:10d7f18a8cb6 | 995 | memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array)); |
el12moe | 0:10d7f18a8cb6 | 996 | memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array)); |
el12moe | 0:10d7f18a8cb6 | 997 | memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array)); |
el12moe | 0:10d7f18a8cb6 | 998 | int r2_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 999 | int g2_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1000 | int b2_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1001 | memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array)); |
el12moe | 0:10d7f18a8cb6 | 1002 | memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array)); |
el12moe | 0:10d7f18a8cb6 | 1003 | memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array)); |
el12moe | 0:10d7f18a8cb6 | 1004 | int r3_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 1005 | int g3_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1006 | int b3_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1007 | memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array)); |
el12moe | 0:10d7f18a8cb6 | 1008 | memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array)); |
el12moe | 0:10d7f18a8cb6 | 1009 | memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array)); |
el12moe | 0:10d7f18a8cb6 | 1010 | int r4_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 1011 | int g4_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1012 | int b4_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1013 | memcpy(r4_array, decimalToBinary(colours[4][0]), sizeof(r4_array)); |
el12moe | 0:10d7f18a8cb6 | 1014 | memcpy(g4_array, decimalToBinary(colours[4][1]), sizeof(g4_array)); |
el12moe | 0:10d7f18a8cb6 | 1015 | memcpy(b4_array, decimalToBinary(colours[4][2]), sizeof(b4_array)); |
el12moe | 0:10d7f18a8cb6 | 1016 | int r5_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 1017 | int g5_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1018 | int b5_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1019 | memcpy(r5_array, decimalToBinary(colours[5][0]), sizeof(r5_array)); |
el12moe | 0:10d7f18a8cb6 | 1020 | memcpy(g5_array, decimalToBinary(colours[5][1]), sizeof(g5_array)); |
el12moe | 0:10d7f18a8cb6 | 1021 | memcpy(b5_array, decimalToBinary(colours[5][2]), sizeof(b5_array)); |
el12moe | 0:10d7f18a8cb6 | 1022 | int r6_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 1023 | int g6_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1024 | int b6_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1025 | memcpy(r6_array, decimalToBinary(colours[6][0]), sizeof(r6_array)); |
el12moe | 0:10d7f18a8cb6 | 1026 | memcpy(g6_array, decimalToBinary(colours[6][1]), sizeof(g6_array)); |
el12moe | 0:10d7f18a8cb6 | 1027 | memcpy(b6_array, decimalToBinary(colours[6][2]), sizeof(b6_array)); |
el12moe | 0:10d7f18a8cb6 | 1028 | int r7_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 1029 | int g7_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1030 | int b7_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1031 | memcpy(r7_array, decimalToBinary(colours[7][0]), sizeof(r7_array)); |
el12moe | 0:10d7f18a8cb6 | 1032 | memcpy(g7_array, decimalToBinary(colours[7][1]), sizeof(g7_array)); |
el12moe | 0:10d7f18a8cb6 | 1033 | memcpy(b7_array, decimalToBinary(colours[7][2]), sizeof(b7_array)); |
el12moe | 0:10d7f18a8cb6 | 1034 | |
el12moe | 0:10d7f18a8cb6 | 1035 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 1036 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 1037 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 1038 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 1039 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1040 | spi2.write(g0_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1041 | spi2.write(g0_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1042 | spi2.write(g0_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1043 | spi2.write(g0_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1044 | spi2.write(g0_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1045 | spi2.write(g0_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1046 | spi2.write(g0_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1047 | spi2.write(g0_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1048 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1049 | spi2.write(r0_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1050 | spi2.write(r0_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1051 | spi2.write(r0_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1052 | spi2.write(r0_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1053 | spi2.write(r0_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1054 | spi2.write(r0_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1055 | spi2.write(r0_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1056 | spi2.write(r0_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1057 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1058 | spi2.write(b0_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1059 | spi2.write(b0_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1060 | spi2.write(b0_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1061 | spi2.write(b0_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1062 | spi2.write(b0_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1063 | spi2.write(b0_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1064 | spi2.write(b0_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1065 | spi2.write(b0_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1066 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 1067 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1068 | spi2.write(g1_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1069 | spi2.write(g1_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1070 | spi2.write(g1_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1071 | spi2.write(g1_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1072 | spi2.write(g1_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1073 | spi2.write(g1_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1074 | spi2.write(g1_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1075 | spi2.write(g1_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1076 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1077 | spi2.write(r1_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1078 | spi2.write(r1_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1079 | spi2.write(r1_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1080 | spi2.write(r1_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1081 | spi2.write(r1_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1082 | spi2.write(r1_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1083 | spi2.write(r1_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1084 | spi2.write(r1_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1085 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1086 | spi2.write(b1_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1087 | spi2.write(b1_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1088 | spi2.write(b1_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1089 | spi2.write(b1_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1090 | spi2.write(b1_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1091 | spi2.write(b1_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1092 | spi2.write(b1_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1093 | spi2.write(b1_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1094 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 1095 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1096 | spi2.write(g2_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1097 | spi2.write(g2_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1098 | spi2.write(g2_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1099 | spi2.write(g2_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1100 | spi2.write(g2_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1101 | spi2.write(g2_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1102 | spi2.write(g2_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1103 | spi2.write(g2_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1104 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1105 | spi2.write(r2_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1106 | spi2.write(r2_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1107 | spi2.write(r2_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1108 | spi2.write(r2_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1109 | spi2.write(r2_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1110 | spi2.write(r2_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1111 | spi2.write(r2_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1112 | spi2.write(r2_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1113 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1114 | spi2.write(b2_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1115 | spi2.write(b2_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1116 | spi2.write(b2_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1117 | spi2.write(b2_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1118 | spi2.write(b2_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1119 | spi2.write(b2_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1120 | spi2.write(b2_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1121 | spi2.write(b2_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1122 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 1123 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1124 | spi2.write(g3_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1125 | spi2.write(g3_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1126 | spi2.write(g3_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1127 | spi2.write(g3_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1128 | spi2.write(g3_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1129 | spi2.write(g3_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1130 | spi2.write(g3_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1131 | spi2.write(g3_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1132 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1133 | spi2.write(r3_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1134 | spi2.write(r3_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1135 | spi2.write(r3_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1136 | spi2.write(r3_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1137 | spi2.write(r3_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1138 | spi2.write(r3_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1139 | spi2.write(r3_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1140 | spi2.write(r3_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1141 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1142 | spi2.write(b3_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1143 | spi2.write(b3_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1144 | spi2.write(b3_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1145 | spi2.write(b3_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1146 | spi2.write(b3_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1147 | spi2.write(b3_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1148 | spi2.write(b3_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1149 | spi2.write(b3_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1150 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 1151 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1152 | spi2.write(g4_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1153 | spi2.write(g4_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1154 | spi2.write(g4_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1155 | spi2.write(g4_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1156 | spi2.write(g4_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1157 | spi2.write(g4_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1158 | spi2.write(g4_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1159 | spi2.write(g4_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1160 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1161 | spi2.write(r4_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1162 | spi2.write(r4_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1163 | spi2.write(r4_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1164 | spi2.write(r4_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1165 | spi2.write(r4_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1166 | spi2.write(r4_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1167 | spi2.write(r4_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1168 | spi2.write(r4_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1169 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1170 | spi2.write(b4_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1171 | spi2.write(b4_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1172 | spi2.write(b4_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1173 | spi2.write(b4_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1174 | spi2.write(b4_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1175 | spi2.write(b4_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1176 | spi2.write(b4_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1177 | spi2.write(b4_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1178 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 1179 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1180 | spi2.write(g5_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1181 | spi2.write(g5_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1182 | spi2.write(g5_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1183 | spi2.write(g5_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1184 | spi2.write(g5_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1185 | spi2.write(g5_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1186 | spi2.write(g5_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1187 | spi2.write(g5_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1188 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1189 | spi2.write(r5_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1190 | spi2.write(r5_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1191 | spi2.write(r5_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1192 | spi2.write(r5_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1193 | spi2.write(r5_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1194 | spi2.write(r5_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1195 | spi2.write(r5_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1196 | spi2.write(r5_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1197 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1198 | spi2.write(b5_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1199 | spi2.write(b5_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1200 | spi2.write(b5_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1201 | spi2.write(b5_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1202 | spi2.write(b5_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1203 | spi2.write(b5_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1204 | spi2.write(b5_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1205 | spi2.write(b5_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1206 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 1207 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1208 | spi2.write(g6_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1209 | spi2.write(g6_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1210 | spi2.write(g6_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1211 | spi2.write(g6_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1212 | spi2.write(g6_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1213 | spi2.write(g6_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1214 | spi2.write(g6_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1215 | spi2.write(g6_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1216 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1217 | spi2.write(r6_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1218 | spi2.write(r6_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1219 | spi2.write(r6_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1220 | spi2.write(r6_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1221 | spi2.write(r6_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1222 | spi2.write(r6_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1223 | spi2.write(r6_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1224 | spi2.write(r6_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1225 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1226 | spi2.write(b6_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1227 | spi2.write(b6_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1228 | spi2.write(b6_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1229 | spi2.write(b6_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1230 | spi2.write(b6_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1231 | spi2.write(b6_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1232 | spi2.write(b6_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1233 | spi2.write(b6_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1234 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 1235 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1236 | spi2.write(g7_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1237 | spi2.write(g7_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1238 | spi2.write(g7_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1239 | spi2.write(g7_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1240 | spi2.write(g7_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1241 | spi2.write(g7_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1242 | spi2.write(g7_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1243 | spi2.write(g7_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1244 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1245 | spi2.write(r7_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1246 | spi2.write(r7_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1247 | spi2.write(r7_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1248 | spi2.write(r7_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1249 | spi2.write(r7_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1250 | spi2.write(r7_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1251 | spi2.write(r7_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1252 | spi2.write(r7_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1253 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1254 | spi2.write(b7_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1255 | spi2.write(b7_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1256 | spi2.write(b7_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1257 | spi2.write(b7_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1258 | spi2.write(b7_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1259 | spi2.write(b7_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1260 | spi2.write(b7_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1261 | spi2.write(b7_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1262 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 1263 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 1264 | } |
el12moe | 0:10d7f18a8cb6 | 1265 | /* |
el12moe | 0:10d7f18a8cb6 | 1266 | void setRGBFloor_1(int room1[8][3], int room2[8][3]){ |
el12moe | 0:10d7f18a8cb6 | 1267 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
el12moe | 0:10d7f18a8cb6 | 1268 | //room1 |
el12moe | 0:10d7f18a8cb6 | 1269 | int r00_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 1270 | int g00_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1271 | int b00_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1272 | memcpy(r00_array, decimalToBinary(room1[0][0]), sizeof(r00_array)); |
el12moe | 0:10d7f18a8cb6 | 1273 | memcpy(g00_array, decimalToBinary(room1[0][1]), sizeof(g00_array)); |
el12moe | 0:10d7f18a8cb6 | 1274 | memcpy(b00_array, decimalToBinary(room1[0][2]), sizeof(b00_array)); |
el12moe | 0:10d7f18a8cb6 | 1275 | int r01_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 1276 | int g01_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1277 | int b01_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1278 | memcpy(r01_array, decimalToBinary(room1[1][0]), sizeof(r01_array)); |
el12moe | 0:10d7f18a8cb6 | 1279 | memcpy(g01_array, decimalToBinary(room1[1][1]), sizeof(g01_array)); |
el12moe | 0:10d7f18a8cb6 | 1280 | memcpy(b01_array, decimalToBinary(room1[1][2]), sizeof(b01_array)); |
el12moe | 0:10d7f18a8cb6 | 1281 | int r02_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 1282 | int g02_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1283 | int b02_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1284 | memcpy(r02_array, decimalToBinary(room1[2][0]), sizeof(r02_array)); |
el12moe | 0:10d7f18a8cb6 | 1285 | memcpy(g02_array, decimalToBinary(room1[2][1]), sizeof(g02_array)); |
el12moe | 0:10d7f18a8cb6 | 1286 | memcpy(b02_array, decimalToBinary(room1[2][2]), sizeof(b02_array)); |
el12moe | 0:10d7f18a8cb6 | 1287 | int r03_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 1288 | int g03_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1289 | int b03_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1290 | memcpy(r03_array, decimalToBinary(room1[3][0]), sizeof(r03_array)); |
el12moe | 0:10d7f18a8cb6 | 1291 | memcpy(g03_array, decimalToBinary(room1[3][1]), sizeof(g03_array)); |
el12moe | 0:10d7f18a8cb6 | 1292 | memcpy(b03_array, decimalToBinary(room1[3][2]), sizeof(b03_array)); |
el12moe | 0:10d7f18a8cb6 | 1293 | int r04_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 1294 | int g04_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1295 | int b04_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1296 | memcpy(r04_array, decimalToBinary(room1[4][0]), sizeof(r04_array)); |
el12moe | 0:10d7f18a8cb6 | 1297 | memcpy(g04_array, decimalToBinary(room1[4][1]), sizeof(g04_array)); |
el12moe | 0:10d7f18a8cb6 | 1298 | memcpy(b04_array, decimalToBinary(room1[4][2]), sizeof(b04_array)); |
el12moe | 0:10d7f18a8cb6 | 1299 | int r05_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 1300 | int g05_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1301 | int b05_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1302 | memcpy(r05_array, decimalToBinary(room1[5][0]), sizeof(r05_array)); |
el12moe | 0:10d7f18a8cb6 | 1303 | memcpy(g05_array, decimalToBinary(room1[5][1]), sizeof(g05_array)); |
el12moe | 0:10d7f18a8cb6 | 1304 | memcpy(b05_array, decimalToBinary(room1[5][2]), sizeof(b05_array)); |
el12moe | 0:10d7f18a8cb6 | 1305 | int r06_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 1306 | int g06_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1307 | int b06_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1308 | memcpy(r06_array, decimalToBinary(room1[6][0]), sizeof(r06_array)); |
el12moe | 0:10d7f18a8cb6 | 1309 | memcpy(g06_array, decimalToBinary(room1[6][1]), sizeof(g06_array)); |
el12moe | 0:10d7f18a8cb6 | 1310 | memcpy(b06_array, decimalToBinary(room1[6][2]), sizeof(b06_array)); |
el12moe | 0:10d7f18a8cb6 | 1311 | int r07_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 1312 | int g07_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1313 | int b07_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1314 | memcpy(r07_array, decimalToBinary(room1[7][0]), sizeof(r07_array)); |
el12moe | 0:10d7f18a8cb6 | 1315 | memcpy(g07_array, decimalToBinary(room1[7][1]), sizeof(g07_array)); |
el12moe | 0:10d7f18a8cb6 | 1316 | memcpy(b07_array, decimalToBinary(room1[7][2]), sizeof(b07_array)); |
el12moe | 0:10d7f18a8cb6 | 1317 | |
el12moe | 0:10d7f18a8cb6 | 1318 | //room2 |
el12moe | 0:10d7f18a8cb6 | 1319 | int r10_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 1320 | int g10_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1321 | int b10_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1322 | memcpy(r10_array, decimalToBinary(room2[0][0]), sizeof(r10_array)); |
el12moe | 0:10d7f18a8cb6 | 1323 | memcpy(g10_array, decimalToBinary(room2[0][1]), sizeof(g10_array)); |
el12moe | 0:10d7f18a8cb6 | 1324 | memcpy(b10_array, decimalToBinary(room2[0][2]), sizeof(b10_array)); |
el12moe | 0:10d7f18a8cb6 | 1325 | int r11_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 1326 | int g11_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1327 | int b11_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1328 | memcpy(r11_array, decimalToBinary(room2[1][0]), sizeof(r11_array)); |
el12moe | 0:10d7f18a8cb6 | 1329 | memcpy(g11_array, decimalToBinary(room2[1][1]), sizeof(g11_array)); |
el12moe | 0:10d7f18a8cb6 | 1330 | memcpy(b11_array, decimalToBinary(room2[1][2]), sizeof(b11_array)); |
el12moe | 0:10d7f18a8cb6 | 1331 | int r12_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 1332 | int g12_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1333 | int b12_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1334 | memcpy(r12_array, decimalToBinary(room2[2][0]), sizeof(r12_array)); |
el12moe | 0:10d7f18a8cb6 | 1335 | memcpy(g12_array, decimalToBinary(room2[2][1]), sizeof(g12_array)); |
el12moe | 0:10d7f18a8cb6 | 1336 | memcpy(b12_array, decimalToBinary(room2[2][2]), sizeof(b12_array)); |
el12moe | 0:10d7f18a8cb6 | 1337 | int r13_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 1338 | int g13_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1339 | int b13_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1340 | memcpy(r13_array, decimalToBinary(room2[3][0]), sizeof(r13_array)); |
el12moe | 0:10d7f18a8cb6 | 1341 | memcpy(g13_array, decimalToBinary(room2[3][1]), sizeof(g13_array)); |
el12moe | 0:10d7f18a8cb6 | 1342 | memcpy(b13_array, decimalToBinary(room2[3][2]), sizeof(b13_array)); |
el12moe | 0:10d7f18a8cb6 | 1343 | int r14_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 1344 | int g14_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1345 | int b14_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1346 | memcpy(r14_array, decimalToBinary(room2[4][0]), sizeof(r14_array)); |
el12moe | 0:10d7f18a8cb6 | 1347 | memcpy(g14_array, decimalToBinary(room2[4][1]), sizeof(g14_array)); |
el12moe | 0:10d7f18a8cb6 | 1348 | memcpy(b14_array, decimalToBinary(room2[4][2]), sizeof(b14_array)); |
el12moe | 0:10d7f18a8cb6 | 1349 | int r15_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 1350 | int g15_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1351 | int b15_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1352 | memcpy(r15_array, decimalToBinary(room2[5][0]), sizeof(r15_array)); |
el12moe | 0:10d7f18a8cb6 | 1353 | memcpy(g15_array, decimalToBinary(room2[5][1]), sizeof(g15_array)); |
el12moe | 0:10d7f18a8cb6 | 1354 | memcpy(b15_array, decimalToBinary(room2[5][2]), sizeof(b15_array)); |
el12moe | 0:10d7f18a8cb6 | 1355 | int r16_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 1356 | int g16_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1357 | int b16_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1358 | memcpy(r16_array, decimalToBinary(room2[6][0]), sizeof(r16_array)); |
el12moe | 0:10d7f18a8cb6 | 1359 | memcpy(g16_array, decimalToBinary(room2[6][1]), sizeof(g16_array)); |
el12moe | 0:10d7f18a8cb6 | 1360 | memcpy(b16_array, decimalToBinary(room2[6][2]), sizeof(b16_array)); |
el12moe | 0:10d7f18a8cb6 | 1361 | int r17_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 1362 | int g17_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1363 | int b17_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1364 | memcpy(r17_array, decimalToBinary(room2[7][0]), sizeof(r17_array)); |
el12moe | 0:10d7f18a8cb6 | 1365 | memcpy(g17_array, decimalToBinary(room2[7][1]), sizeof(g17_array)); |
el12moe | 0:10d7f18a8cb6 | 1366 | memcpy(b17_array, decimalToBinary(room2[7][2]), sizeof(b17_array)); |
el12moe | 0:10d7f18a8cb6 | 1367 | |
el12moe | 0:10d7f18a8cb6 | 1368 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 1369 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 1370 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 1371 | //room1 |
el12moe | 0:10d7f18a8cb6 | 1372 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 1373 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1374 | spi.write(g00_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1375 | spi.write(g00_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1376 | spi.write(g00_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1377 | spi.write(g00_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1378 | spi.write(g00_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1379 | spi.write(g00_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1380 | spi.write(g00_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1381 | spi.write(g00_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1382 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1383 | spi.write(r00_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1384 | spi.write(r00_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1385 | spi.write(r00_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1386 | spi.write(r00_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1387 | spi.write(r00_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1388 | spi.write(r00_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1389 | spi.write(r00_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1390 | spi.write(r00_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1391 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1392 | spi.write(b00_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1393 | spi.write(b00_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1394 | spi.write(b00_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1395 | spi.write(b00_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1396 | spi.write(b00_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1397 | spi.write(b00_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1398 | spi.write(b00_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1399 | spi.write(b00_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1400 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 1401 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1402 | spi.write(g01_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1403 | spi.write(g01_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1404 | spi.write(g01_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1405 | spi.write(g01_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1406 | spi.write(g01_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1407 | spi.write(g01_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1408 | spi.write(g01_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1409 | spi.write(g01_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1410 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1411 | spi.write(r01_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1412 | spi.write(r01_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1413 | spi.write(r01_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1414 | spi.write(r01_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1415 | spi.write(r01_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1416 | spi.write(r01_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1417 | spi.write(r01_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1418 | spi.write(r01_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1419 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1420 | spi.write(b01_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1421 | spi.write(b01_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1422 | spi.write(b01_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1423 | spi.write(b01_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1424 | spi.write(b01_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1425 | spi.write(b01_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1426 | spi.write(b01_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1427 | spi.write(b01_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1428 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 1429 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1430 | spi.write(g02_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1431 | spi.write(g02_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1432 | spi.write(g02_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1433 | spi.write(g02_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1434 | spi.write(g02_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1435 | spi.write(g02_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1436 | spi.write(g02_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1437 | spi.write(g02_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1438 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1439 | spi.write(r02_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1440 | spi.write(r02_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1441 | spi.write(r02_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1442 | spi.write(r02_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1443 | spi.write(r02_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1444 | spi.write(r02_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1445 | spi.write(r02_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1446 | spi.write(r02_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1447 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1448 | spi.write(b02_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1449 | spi.write(b02_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1450 | spi.write(b02_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1451 | spi.write(b02_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1452 | spi.write(b02_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1453 | spi.write(b02_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1454 | spi.write(b02_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1455 | spi.write(b02_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1456 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 1457 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1458 | spi.write(g03_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1459 | spi.write(g03_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1460 | spi.write(g03_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1461 | spi.write(g03_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1462 | spi.write(g03_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1463 | spi.write(g03_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1464 | spi.write(g03_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1465 | spi.write(g03_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1466 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1467 | spi.write(r03_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1468 | spi.write(r03_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1469 | spi.write(r03_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1470 | spi.write(r03_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1471 | spi.write(r03_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1472 | spi.write(r03_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1473 | spi.write(r03_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1474 | spi.write(r03_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1475 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1476 | spi.write(b03_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1477 | spi.write(b03_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1478 | spi.write(b03_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1479 | spi.write(b03_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1480 | spi.write(b03_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1481 | spi.write(b03_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1482 | spi.write(b03_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1483 | spi.write(b03_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1484 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 1485 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1486 | spi.write(g04_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1487 | spi.write(g04_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1488 | spi.write(g04_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1489 | spi.write(g04_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1490 | spi.write(g04_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1491 | spi.write(g04_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1492 | spi.write(g04_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1493 | spi.write(g04_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1494 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1495 | spi.write(r04_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1496 | spi.write(r04_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1497 | spi.write(r04_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1498 | spi.write(r04_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1499 | spi.write(r04_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1500 | spi.write(r04_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1501 | spi.write(r04_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1502 | spi.write(r04_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1503 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1504 | spi.write(b04_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1505 | spi.write(b04_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1506 | spi.write(b04_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1507 | spi.write(b04_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1508 | spi.write(b04_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1509 | spi.write(b04_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1510 | spi.write(b04_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1511 | spi.write(b04_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1512 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 1513 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1514 | spi.write(g05_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1515 | spi.write(g05_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1516 | spi.write(g05_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1517 | spi.write(g05_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1518 | spi.write(g05_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1519 | spi.write(g05_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1520 | spi.write(g05_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1521 | spi.write(g05_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1522 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1523 | spi.write(r05_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1524 | spi.write(r05_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1525 | spi.write(r05_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1526 | spi.write(r05_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1527 | spi.write(r05_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1528 | spi.write(r05_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1529 | spi.write(r05_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1530 | spi.write(r05_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1531 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1532 | spi.write(b05_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1533 | spi.write(b05_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1534 | spi.write(b05_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1535 | spi.write(b05_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1536 | spi.write(b05_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1537 | spi.write(b05_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1538 | spi.write(b05_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1539 | spi.write(b05_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1540 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 1541 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1542 | spi.write(g06_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1543 | spi.write(g06_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1544 | spi.write(g06_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1545 | spi.write(g06_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1546 | spi.write(g06_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1547 | spi.write(g06_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1548 | spi.write(g06_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1549 | spi.write(g06_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1550 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1551 | spi.write(r06_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1552 | spi.write(r06_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1553 | spi.write(r06_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1554 | spi.write(r06_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1555 | spi.write(r06_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1556 | spi.write(r06_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1557 | spi.write(r06_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1558 | spi.write(r06_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1559 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1560 | spi.write(b06_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1561 | spi.write(b06_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1562 | spi.write(b06_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1563 | spi.write(b06_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1564 | spi.write(b06_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1565 | spi.write(b06_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1566 | spi.write(b06_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1567 | spi.write(b06_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1568 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 1569 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1570 | spi.write(g07_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1571 | spi.write(g07_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1572 | spi.write(g07_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1573 | spi.write(g07_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1574 | spi.write(g07_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1575 | spi.write(g07_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1576 | spi.write(g07_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1577 | spi.write(g07_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1578 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1579 | spi.write(r07_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1580 | spi.write(r07_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1581 | spi.write(r07_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1582 | spi.write(r07_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1583 | spi.write(r07_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1584 | spi.write(r07_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1585 | spi.write(r07_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1586 | spi.write(r07_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1587 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1588 | spi.write(b07_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1589 | spi.write(b07_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1590 | spi.write(b07_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1591 | spi.write(b07_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1592 | spi.write(b07_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1593 | spi.write(b07_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1594 | spi.write(b07_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1595 | spi.write(b07_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1596 | //room2 |
el12moe | 0:10d7f18a8cb6 | 1597 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 1598 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1599 | spi.write(g10_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1600 | spi.write(g10_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1601 | spi.write(g10_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1602 | spi.write(g10_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1603 | spi.write(g10_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1604 | spi.write(g10_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1605 | spi.write(g10_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1606 | spi.write(g10_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1607 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1608 | spi.write(r10_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1609 | spi.write(r10_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1610 | spi.write(r10_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1611 | spi.write(r10_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1612 | spi.write(r10_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1613 | spi.write(r10_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1614 | spi.write(r10_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1615 | spi.write(r10_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1616 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1617 | spi.write(b10_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1618 | spi.write(b10_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1619 | spi.write(b10_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1620 | spi.write(b10_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1621 | spi.write(b10_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1622 | spi.write(b10_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1623 | spi.write(b10_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1624 | spi.write(b10_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1625 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 1626 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1627 | spi.write(g11_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1628 | spi.write(g11_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1629 | spi.write(g11_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1630 | spi.write(g11_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1631 | spi.write(g11_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1632 | spi.write(g11_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1633 | spi.write(g11_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1634 | spi.write(g11_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1635 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1636 | spi.write(r11_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1637 | spi.write(r11_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1638 | spi.write(r11_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1639 | spi.write(r11_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1640 | spi.write(r11_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1641 | spi.write(r11_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1642 | spi.write(r11_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1643 | spi.write(r11_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1644 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1645 | spi.write(b11_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1646 | spi.write(b11_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1647 | spi.write(b11_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1648 | spi.write(b11_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1649 | spi.write(b11_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1650 | spi.write(b11_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1651 | spi.write(b11_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1652 | spi.write(b11_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1653 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 1654 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1655 | spi.write(g12_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1656 | spi.write(g12_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1657 | spi.write(g12_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1658 | spi.write(g12_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1659 | spi.write(g12_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1660 | spi.write(g12_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1661 | spi.write(g12_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1662 | spi.write(g12_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1663 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1664 | spi.write(r12_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1665 | spi.write(r12_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1666 | spi.write(r12_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1667 | spi.write(r12_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1668 | spi.write(r12_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1669 | spi.write(r12_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1670 | spi.write(r12_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1671 | spi.write(r12_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1672 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1673 | spi.write(b12_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1674 | spi.write(b12_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1675 | spi.write(b12_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1676 | spi.write(b12_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1677 | spi.write(b12_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1678 | spi.write(b12_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1679 | spi.write(b12_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1680 | spi.write(b12_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1681 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 1682 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1683 | spi.write(g13_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1684 | spi.write(g13_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1685 | spi.write(g13_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1686 | spi.write(g13_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1687 | spi.write(g13_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1688 | spi.write(g13_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1689 | spi.write(g13_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1690 | spi.write(g13_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1691 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1692 | spi.write(r13_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1693 | spi.write(r13_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1694 | spi.write(r13_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1695 | spi.write(r13_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1696 | spi.write(r13_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1697 | spi.write(r13_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1698 | spi.write(r13_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1699 | spi.write(r13_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1700 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1701 | spi.write(b13_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1702 | spi.write(b13_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1703 | spi.write(b13_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1704 | spi.write(b13_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1705 | spi.write(b13_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1706 | spi.write(b13_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1707 | spi.write(b13_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1708 | spi.write(b13_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1709 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 1710 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1711 | spi.write(g14_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1712 | spi.write(g14_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1713 | spi.write(g14_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1714 | spi.write(g14_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1715 | spi.write(g14_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1716 | spi.write(g14_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1717 | spi.write(g14_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1718 | spi.write(g14_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1719 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1720 | spi.write(r14_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1721 | spi.write(r14_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1722 | spi.write(r14_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1723 | spi.write(r14_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1724 | spi.write(r14_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1725 | spi.write(r14_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1726 | spi.write(r14_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1727 | spi.write(r14_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1728 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1729 | spi.write(b14_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1730 | spi.write(b14_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1731 | spi.write(b14_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1732 | spi.write(b14_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1733 | spi.write(b14_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1734 | spi.write(b14_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1735 | spi.write(b14_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1736 | spi.write(b14_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1737 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 1738 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1739 | spi.write(g15_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1740 | spi.write(g15_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1741 | spi.write(g15_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1742 | spi.write(g15_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1743 | spi.write(g15_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1744 | spi.write(g15_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1745 | spi.write(g15_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1746 | spi.write(g15_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1747 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1748 | spi.write(r15_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1749 | spi.write(r15_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1750 | spi.write(r15_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1751 | spi.write(r15_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1752 | spi.write(r15_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1753 | spi.write(r15_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1754 | spi.write(r15_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1755 | spi.write(r15_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1756 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1757 | spi.write(b15_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1758 | spi.write(b15_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1759 | spi.write(b15_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1760 | spi.write(b15_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1761 | spi.write(b15_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1762 | spi.write(b15_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1763 | spi.write(b15_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1764 | spi.write(b15_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1765 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 1766 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1767 | spi.write(g16_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1768 | spi.write(g16_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1769 | spi.write(g16_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1770 | spi.write(g16_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1771 | spi.write(g16_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1772 | spi.write(g16_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1773 | spi.write(g16_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1774 | spi.write(g16_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1775 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1776 | spi.write(r16_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1777 | spi.write(r16_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1778 | spi.write(r16_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1779 | spi.write(r16_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1780 | spi.write(r16_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1781 | spi.write(r16_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1782 | spi.write(r16_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1783 | spi.write(r16_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1784 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1785 | spi.write(b16_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1786 | spi.write(b16_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1787 | spi.write(b16_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1788 | spi.write(b16_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1789 | spi.write(b16_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1790 | spi.write(b16_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1791 | spi.write(b16_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1792 | spi.write(b16_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1793 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 1794 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1795 | spi.write(g17_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1796 | spi.write(g17_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1797 | spi.write(g17_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1798 | spi.write(g17_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1799 | spi.write(g17_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1800 | spi.write(g17_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1801 | spi.write(g17_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1802 | spi.write(g17_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1803 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1804 | spi.write(r17_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1805 | spi.write(r17_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1806 | spi.write(r17_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1807 | spi.write(r17_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1808 | spi.write(r17_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1809 | spi.write(r17_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1810 | spi.write(r17_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1811 | spi.write(r17_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1812 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1813 | spi.write(b17_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1814 | spi.write(b17_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1815 | spi.write(b17_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1816 | spi.write(b17_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1817 | spi.write(b17_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1818 | spi.write(b17_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1819 | spi.write(b17_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1820 | spi.write(b17_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1821 | |
el12moe | 0:10d7f18a8cb6 | 1822 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 1823 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 1824 | } |
el12moe | 0:10d7f18a8cb6 | 1825 | |
el12moe | 0:10d7f18a8cb6 | 1826 | void setRGBFloor_2(int room3[8][3], int room4[8][3]){ |
el12moe | 0:10d7f18a8cb6 | 1827 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
el12moe | 0:10d7f18a8cb6 | 1828 | //room3 |
el12moe | 0:10d7f18a8cb6 | 1829 | int r00_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 1830 | int g00_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1831 | int b00_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1832 | memcpy(r00_array, decimalToBinary(room3[0][0]), sizeof(r00_array)); |
el12moe | 0:10d7f18a8cb6 | 1833 | memcpy(g00_array, decimalToBinary(room3[0][1]), sizeof(g00_array)); |
el12moe | 0:10d7f18a8cb6 | 1834 | memcpy(b00_array, decimalToBinary(room3[0][2]), sizeof(b00_array)); |
el12moe | 0:10d7f18a8cb6 | 1835 | int r01_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 1836 | int g01_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1837 | int b01_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1838 | memcpy(r01_array, decimalToBinary(room3[1][0]), sizeof(r01_array)); |
el12moe | 0:10d7f18a8cb6 | 1839 | memcpy(g01_array, decimalToBinary(room3[1][1]), sizeof(g01_array)); |
el12moe | 0:10d7f18a8cb6 | 1840 | memcpy(b01_array, decimalToBinary(room3[1][2]), sizeof(b01_array)); |
el12moe | 0:10d7f18a8cb6 | 1841 | int r02_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 1842 | int g02_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1843 | int b02_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1844 | memcpy(r02_array, decimalToBinary(room3[2][0]), sizeof(r02_array)); |
el12moe | 0:10d7f18a8cb6 | 1845 | memcpy(g02_array, decimalToBinary(room3[2][1]), sizeof(g02_array)); |
el12moe | 0:10d7f18a8cb6 | 1846 | memcpy(b02_array, decimalToBinary(room3[2][2]), sizeof(b02_array)); |
el12moe | 0:10d7f18a8cb6 | 1847 | int r03_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 1848 | int g03_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1849 | int b03_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1850 | memcpy(r03_array, decimalToBinary(room3[3][0]), sizeof(r03_array)); |
el12moe | 0:10d7f18a8cb6 | 1851 | memcpy(g03_array, decimalToBinary(room3[3][1]), sizeof(g03_array)); |
el12moe | 0:10d7f18a8cb6 | 1852 | memcpy(b03_array, decimalToBinary(room3[3][2]), sizeof(b03_array)); |
el12moe | 0:10d7f18a8cb6 | 1853 | int r04_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 1854 | int g04_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1855 | int b04_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1856 | memcpy(r04_array, decimalToBinary(room3[4][0]), sizeof(r04_array)); |
el12moe | 0:10d7f18a8cb6 | 1857 | memcpy(g04_array, decimalToBinary(room3[4][1]), sizeof(g04_array)); |
el12moe | 0:10d7f18a8cb6 | 1858 | memcpy(b04_array, decimalToBinary(room3[4][2]), sizeof(b04_array)); |
el12moe | 0:10d7f18a8cb6 | 1859 | int r05_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 1860 | int g05_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1861 | int b05_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1862 | memcpy(r05_array, decimalToBinary(room3[5][0]), sizeof(r05_array)); |
el12moe | 0:10d7f18a8cb6 | 1863 | memcpy(g05_array, decimalToBinary(room3[5][1]), sizeof(g05_array)); |
el12moe | 0:10d7f18a8cb6 | 1864 | memcpy(b05_array, decimalToBinary(room3[5][2]), sizeof(b05_array)); |
el12moe | 0:10d7f18a8cb6 | 1865 | int r06_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 1866 | int g06_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1867 | int b06_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1868 | memcpy(r06_array, decimalToBinary(room3[6][0]), sizeof(r06_array)); |
el12moe | 0:10d7f18a8cb6 | 1869 | memcpy(g06_array, decimalToBinary(room3[6][1]), sizeof(g06_array)); |
el12moe | 0:10d7f18a8cb6 | 1870 | memcpy(b06_array, decimalToBinary(room3[6][2]), sizeof(b06_array)); |
el12moe | 0:10d7f18a8cb6 | 1871 | int r07_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 1872 | int g07_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1873 | int b07_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1874 | memcpy(r07_array, decimalToBinary(room3[7][0]), sizeof(r07_array)); |
el12moe | 0:10d7f18a8cb6 | 1875 | memcpy(g07_array, decimalToBinary(room3[7][1]), sizeof(g07_array)); |
el12moe | 0:10d7f18a8cb6 | 1876 | memcpy(b07_array, decimalToBinary(room3[7][2]), sizeof(b07_array)); |
el12moe | 0:10d7f18a8cb6 | 1877 | |
el12moe | 0:10d7f18a8cb6 | 1878 | //room4 |
el12moe | 0:10d7f18a8cb6 | 1879 | int r10_array[8]; //LED0 |
el12moe | 0:10d7f18a8cb6 | 1880 | int g10_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1881 | int b10_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1882 | memcpy(r10_array, decimalToBinary(room4[0][0]), sizeof(r10_array)); |
el12moe | 0:10d7f18a8cb6 | 1883 | memcpy(g10_array, decimalToBinary(room4[0][1]), sizeof(g10_array)); |
el12moe | 0:10d7f18a8cb6 | 1884 | memcpy(b10_array, decimalToBinary(room4[0][2]), sizeof(b10_array)); |
el12moe | 0:10d7f18a8cb6 | 1885 | int r11_array[8]; //LED1 |
el12moe | 0:10d7f18a8cb6 | 1886 | int g11_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1887 | int b11_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1888 | memcpy(r11_array, decimalToBinary(room4[1][0]), sizeof(r11_array)); |
el12moe | 0:10d7f18a8cb6 | 1889 | memcpy(g11_array, decimalToBinary(room4[1][1]), sizeof(g11_array)); |
el12moe | 0:10d7f18a8cb6 | 1890 | memcpy(b11_array, decimalToBinary(room4[1][2]), sizeof(b11_array)); |
el12moe | 0:10d7f18a8cb6 | 1891 | int r12_array[8]; //LED2 |
el12moe | 0:10d7f18a8cb6 | 1892 | int g12_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1893 | int b12_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1894 | memcpy(r12_array, decimalToBinary(room4[2][0]), sizeof(r12_array)); |
el12moe | 0:10d7f18a8cb6 | 1895 | memcpy(g12_array, decimalToBinary(room4[2][1]), sizeof(g12_array)); |
el12moe | 0:10d7f18a8cb6 | 1896 | memcpy(b12_array, decimalToBinary(room4[2][2]), sizeof(b12_array)); |
el12moe | 0:10d7f18a8cb6 | 1897 | int r13_array[8]; //LED3 |
el12moe | 0:10d7f18a8cb6 | 1898 | int g13_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1899 | int b13_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1900 | memcpy(r13_array, decimalToBinary(room4[3][0]), sizeof(r13_array)); |
el12moe | 0:10d7f18a8cb6 | 1901 | memcpy(g13_array, decimalToBinary(room4[3][1]), sizeof(g13_array)); |
el12moe | 0:10d7f18a8cb6 | 1902 | memcpy(b13_array, decimalToBinary(room4[3][2]), sizeof(b13_array)); |
el12moe | 0:10d7f18a8cb6 | 1903 | int r14_array[8]; //LED4 |
el12moe | 0:10d7f18a8cb6 | 1904 | int g14_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1905 | int b14_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1906 | memcpy(r14_array, decimalToBinary(room4[4][0]), sizeof(r14_array)); |
el12moe | 0:10d7f18a8cb6 | 1907 | memcpy(g14_array, decimalToBinary(room4[4][1]), sizeof(g14_array)); |
el12moe | 0:10d7f18a8cb6 | 1908 | memcpy(b14_array, decimalToBinary(room4[4][2]), sizeof(b14_array)); |
el12moe | 0:10d7f18a8cb6 | 1909 | int r15_array[8]; //LED5 |
el12moe | 0:10d7f18a8cb6 | 1910 | int g15_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1911 | int b15_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1912 | memcpy(r15_array, decimalToBinary(room4[5][0]), sizeof(r15_array)); |
el12moe | 0:10d7f18a8cb6 | 1913 | memcpy(g15_array, decimalToBinary(room4[5][1]), sizeof(g15_array)); |
el12moe | 0:10d7f18a8cb6 | 1914 | memcpy(b15_array, decimalToBinary(room4[5][2]), sizeof(b15_array)); |
el12moe | 0:10d7f18a8cb6 | 1915 | int r16_array[8]; //LED6 |
el12moe | 0:10d7f18a8cb6 | 1916 | int g16_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1917 | int b16_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1918 | memcpy(r16_array, decimalToBinary(room4[6][0]), sizeof(r16_array)); |
el12moe | 0:10d7f18a8cb6 | 1919 | memcpy(g16_array, decimalToBinary(room4[6][1]), sizeof(g16_array)); |
el12moe | 0:10d7f18a8cb6 | 1920 | memcpy(b16_array, decimalToBinary(room4[6][2]), sizeof(b16_array)); |
el12moe | 0:10d7f18a8cb6 | 1921 | int r17_array[8]; //LED7 |
el12moe | 0:10d7f18a8cb6 | 1922 | int g17_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1923 | int b17_array[8]; |
el12moe | 0:10d7f18a8cb6 | 1924 | memcpy(r17_array, decimalToBinary(room4[7][0]), sizeof(r17_array)); |
el12moe | 0:10d7f18a8cb6 | 1925 | memcpy(g17_array, decimalToBinary(room4[7][1]), sizeof(g17_array)); |
el12moe | 0:10d7f18a8cb6 | 1926 | memcpy(b17_array, decimalToBinary(room4[7][2]), sizeof(b17_array)); |
el12moe | 0:10d7f18a8cb6 | 1927 | |
el12moe | 0:10d7f18a8cb6 | 1928 | //send commands to LED Driver |
el12moe | 0:10d7f18a8cb6 | 1929 | //initialize SPI |
el12moe | 0:10d7f18a8cb6 | 1930 | spi_init(); |
el12moe | 0:10d7f18a8cb6 | 1931 | //room3 |
el12moe | 0:10d7f18a8cb6 | 1932 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 1933 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1934 | spi2.write(g00_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1935 | spi2.write(g00_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1936 | spi2.write(g00_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1937 | spi2.write(g00_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1938 | spi2.write(g00_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1939 | spi2.write(g00_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1940 | spi2.write(g00_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1941 | spi2.write(g00_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1942 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1943 | spi2.write(r00_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1944 | spi2.write(r00_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1945 | spi2.write(r00_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1946 | spi2.write(r00_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1947 | spi2.write(r00_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1948 | spi2.write(r00_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1949 | spi2.write(r00_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1950 | spi2.write(r00_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1951 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1952 | spi2.write(b00_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1953 | spi2.write(b00_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1954 | spi2.write(b00_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1955 | spi2.write(b00_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1956 | spi2.write(b00_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1957 | spi2.write(b00_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1958 | spi2.write(b00_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1959 | spi2.write(b00_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1960 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 1961 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1962 | spi2.write(g01_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1963 | spi2.write(g01_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1964 | spi2.write(g01_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1965 | spi2.write(g01_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1966 | spi2.write(g01_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1967 | spi2.write(g01_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1968 | spi2.write(g01_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1969 | spi2.write(g01_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1970 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1971 | spi2.write(r01_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 1972 | spi2.write(r01_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 1973 | spi2.write(r01_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 1974 | spi2.write(r01_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 1975 | spi2.write(r01_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 1976 | spi2.write(r01_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 1977 | spi2.write(r01_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 1978 | spi2.write(r01_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 1979 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 1980 | spi2.write(b01_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 1981 | spi2.write(b01_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 1982 | spi2.write(b01_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 1983 | spi2.write(b01_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 1984 | spi2.write(b01_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 1985 | spi2.write(b01_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 1986 | spi2.write(b01_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 1987 | spi2.write(b01_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 1988 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 1989 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 1990 | spi2.write(g02_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 1991 | spi2.write(g02_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 1992 | spi2.write(g02_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 1993 | spi2.write(g02_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 1994 | spi2.write(g02_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 1995 | spi2.write(g02_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 1996 | spi2.write(g02_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 1997 | spi2.write(g02_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 1998 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 1999 | spi2.write(r02_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2000 | spi2.write(r02_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2001 | spi2.write(r02_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2002 | spi2.write(r02_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2003 | spi2.write(r02_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2004 | spi2.write(r02_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2005 | spi2.write(r02_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2006 | spi2.write(r02_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2007 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2008 | spi2.write(b02_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2009 | spi2.write(b02_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2010 | spi2.write(b02_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2011 | spi2.write(b02_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2012 | spi2.write(b02_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2013 | spi2.write(b02_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2014 | spi2.write(b02_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2015 | spi2.write(b02_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2016 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 2017 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2018 | spi2.write(g03_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2019 | spi2.write(g03_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2020 | spi2.write(g03_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2021 | spi2.write(g03_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2022 | spi2.write(g03_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2023 | spi2.write(g03_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2024 | spi2.write(g03_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2025 | spi2.write(g03_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2026 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2027 | spi2.write(r03_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2028 | spi2.write(r03_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2029 | spi2.write(r03_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2030 | spi2.write(r03_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2031 | spi2.write(r03_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2032 | spi2.write(r03_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2033 | spi2.write(r03_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2034 | spi2.write(r03_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2035 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2036 | spi2.write(b03_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2037 | spi2.write(b03_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2038 | spi2.write(b03_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2039 | spi2.write(b03_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2040 | spi2.write(b03_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2041 | spi2.write(b03_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2042 | spi2.write(b03_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2043 | spi2.write(b03_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2044 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 2045 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2046 | spi2.write(g04_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2047 | spi2.write(g04_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2048 | spi2.write(g04_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2049 | spi2.write(g04_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2050 | spi2.write(g04_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2051 | spi2.write(g04_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2052 | spi2.write(g04_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2053 | spi2.write(g04_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2054 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2055 | spi2.write(r04_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2056 | spi2.write(r04_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2057 | spi2.write(r04_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2058 | spi2.write(r04_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2059 | spi2.write(r04_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2060 | spi2.write(r04_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2061 | spi2.write(r04_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2062 | spi2.write(r04_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2063 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2064 | spi2.write(b04_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2065 | spi2.write(b04_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2066 | spi2.write(b04_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2067 | spi2.write(b04_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2068 | spi2.write(b04_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2069 | spi2.write(b04_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2070 | spi2.write(b04_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2071 | spi2.write(b04_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2072 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 2073 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2074 | spi2.write(g05_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2075 | spi2.write(g05_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2076 | spi2.write(g05_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2077 | spi2.write(g05_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2078 | spi2.write(g05_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2079 | spi2.write(g05_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2080 | spi2.write(g05_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2081 | spi2.write(g05_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2082 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2083 | spi2.write(r05_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2084 | spi2.write(r05_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2085 | spi2.write(r05_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2086 | spi2.write(r05_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2087 | spi2.write(r05_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2088 | spi2.write(r05_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2089 | spi2.write(r05_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2090 | spi2.write(r05_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2091 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2092 | spi2.write(b05_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2093 | spi2.write(b05_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2094 | spi2.write(b05_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2095 | spi2.write(b05_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2096 | spi2.write(b05_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2097 | spi2.write(b05_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2098 | spi2.write(b05_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2099 | spi2.write(b05_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2100 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 2101 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2102 | spi2.write(g06_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2103 | spi2.write(g06_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2104 | spi2.write(g06_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2105 | spi2.write(g06_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2106 | spi2.write(g06_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2107 | spi2.write(g06_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2108 | spi2.write(g06_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2109 | spi2.write(g06_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2110 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2111 | spi2.write(r06_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2112 | spi2.write(r06_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2113 | spi2.write(r06_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2114 | spi2.write(r06_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2115 | spi2.write(r06_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2116 | spi2.write(r06_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2117 | spi2.write(r06_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2118 | spi2.write(r06_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2119 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2120 | spi2.write(b06_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2121 | spi2.write(b06_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2122 | spi2.write(b06_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2123 | spi2.write(b06_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2124 | spi2.write(b06_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2125 | spi2.write(b06_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2126 | spi2.write(b06_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2127 | spi2.write(b06_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2128 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 2129 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2130 | spi2.write(g07_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2131 | spi2.write(g07_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2132 | spi2.write(g07_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2133 | spi2.write(g07_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2134 | spi2.write(g07_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2135 | spi2.write(g07_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2136 | spi2.write(g07_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2137 | spi2.write(g07_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2138 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2139 | spi2.write(r07_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2140 | spi2.write(r07_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2141 | spi2.write(r07_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2142 | spi2.write(r07_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2143 | spi2.write(r07_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2144 | spi2.write(r07_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2145 | spi2.write(r07_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2146 | spi2.write(r07_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2147 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2148 | spi2.write(b07_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2149 | spi2.write(b07_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2150 | spi2.write(b07_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2151 | spi2.write(b07_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2152 | spi2.write(b07_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2153 | spi2.write(b07_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2154 | spi2.write(b07_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2155 | spi2.write(b07_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2156 | //room4 |
el12moe | 0:10d7f18a8cb6 | 2157 | //LED0 |
el12moe | 0:10d7f18a8cb6 | 2158 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2159 | spi2.write(g10_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2160 | spi2.write(g10_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2161 | spi2.write(g10_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2162 | spi2.write(g10_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2163 | spi2.write(g10_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2164 | spi2.write(g10_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2165 | spi2.write(g10_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2166 | spi2.write(g10_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2167 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2168 | spi2.write(r10_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2169 | spi2.write(r10_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2170 | spi2.write(r10_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2171 | spi2.write(r10_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2172 | spi2.write(r10_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2173 | spi2.write(r10_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2174 | spi2.write(r10_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2175 | spi2.write(r10_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2176 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2177 | spi2.write(b10_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2178 | spi2.write(b10_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2179 | spi2.write(b10_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2180 | spi2.write(b10_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2181 | spi2.write(b10_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2182 | spi2.write(b10_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2183 | spi2.write(b10_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2184 | spi2.write(b10_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2185 | //LED1 |
el12moe | 0:10d7f18a8cb6 | 2186 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2187 | spi2.write(g11_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2188 | spi2.write(g11_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2189 | spi2.write(g11_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2190 | spi2.write(g11_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2191 | spi2.write(g11_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2192 | spi2.write(g11_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2193 | spi2.write(g11_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2194 | spi2.write(g11_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2195 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2196 | spi2.write(r11_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2197 | spi2.write(r11_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2198 | spi2.write(r11_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2199 | spi2.write(r11_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2200 | spi2.write(r11_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2201 | spi2.write(r11_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2202 | spi2.write(r11_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2203 | spi2.write(r11_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2204 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2205 | spi2.write(b11_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2206 | spi2.write(b11_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2207 | spi2.write(b11_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2208 | spi2.write(b11_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2209 | spi2.write(b11_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2210 | spi2.write(b11_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2211 | spi2.write(b11_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2212 | spi2.write(b11_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2213 | //LED2 |
el12moe | 0:10d7f18a8cb6 | 2214 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2215 | spi2.write(g12_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2216 | spi2.write(g12_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2217 | spi2.write(g12_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2218 | spi2.write(g12_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2219 | spi2.write(g12_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2220 | spi2.write(g12_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2221 | spi2.write(g12_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2222 | spi2.write(g12_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2223 | //s2et red bits |
el12moe | 0:10d7f18a8cb6 | 2224 | spi2.write(r12_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2225 | spi2.write(r12_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2226 | spi2.write(r12_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2227 | spi2.write(r12_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2228 | spi2.write(r12_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2229 | spi2.write(r12_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2230 | spi2.write(r12_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2231 | spi2.write(r12_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2232 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2233 | spi2.write(b12_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2234 | spi2.write(b12_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2235 | spi2.write(b12_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2236 | spi2.write(b12_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2237 | spi2.write(b12_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2238 | spi2.write(b12_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2239 | spi2.write(b12_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2240 | spi2.write(b12_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2241 | //LED3 |
el12moe | 0:10d7f18a8cb6 | 2242 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2243 | spi2.write(g13_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2244 | spi2.write(g13_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2245 | spi2.write(g13_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2246 | spi2.write(g13_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2247 | spi2.write(g13_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2248 | spi2.write(g13_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2249 | spi2.write(g13_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2250 | spi2.write(g13_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2251 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2252 | spi2.write(r13_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2253 | spi2.write(r13_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2254 | spi2.write(r13_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2255 | spi2.write(r13_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2256 | spi2.write(r13_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2257 | spi2.write(r13_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2258 | spi2.write(r13_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2259 | spi2.write(r13_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2260 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2261 | spi2.write(b13_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2262 | spi2.write(b13_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2263 | spi2.write(b13_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2264 | spi2.write(b13_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2265 | spi2.write(b13_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2266 | spi2.write(b13_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2267 | spi2.write(b13_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2268 | spi2.write(b13_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2269 | //LED4 |
el12moe | 0:10d7f18a8cb6 | 2270 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2271 | spi2.write(g14_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2272 | spi2.write(g14_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2273 | spi2.write(g14_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2274 | spi2.write(g14_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2275 | spi2.write(g14_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2276 | spi2.write(g14_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2277 | spi2.write(g14_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2278 | spi2.write(g14_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2279 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2280 | spi2.write(r14_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2281 | spi2.write(r14_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2282 | spi2.write(r14_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2283 | spi2.write(r14_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2284 | spi2.write(r14_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2285 | spi2.write(r14_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2286 | spi2.write(r14_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2287 | spi2.write(r14_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2288 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2289 | spi2.write(b14_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2290 | spi2.write(b14_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2291 | spi2.write(b14_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2292 | spi2.write(b14_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2293 | spi2.write(b14_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2294 | spi2.write(b14_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2295 | spi2.write(b14_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2296 | spi2.write(b14_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2297 | //LED5 |
el12moe | 0:10d7f18a8cb6 | 2298 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2299 | spi2.write(g15_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2300 | spi2.write(g15_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2301 | spi2.write(g15_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2302 | spi2.write(g15_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2303 | spi2.write(g15_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2304 | spi2.write(g15_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2305 | spi2.write(g15_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2306 | spi2.write(g15_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2307 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2308 | spi2.write(r15_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2309 | spi2.write(r15_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2310 | spi2.write(r15_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2311 | spi2.write(r15_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2312 | spi2.write(r15_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2313 | spi2.write(r15_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2314 | spi2.write(r15_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2315 | spi2.write(r15_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2316 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2317 | spi2.write(b15_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2318 | spi2.write(b15_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2319 | spi2.write(b15_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2320 | spi2.write(b15_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2321 | spi2.write(b15_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2322 | spi2.write(b15_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2323 | spi2.write(b15_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2324 | spi2.write(b15_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2325 | //LED6 |
el12moe | 0:10d7f18a8cb6 | 2326 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2327 | spi2.write(g16_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2328 | spi2.write(g16_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2329 | spi2.write(g16_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2330 | spi2.write(g16_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2331 | spi2.write(g16_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2332 | spi2.write(g16_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2333 | spi2.write(g16_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2334 | spi2.write(g16_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2335 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2336 | spi2.write(r16_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2337 | spi2.write(r16_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2338 | spi2.write(r16_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2339 | spi2.write(r16_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2340 | spi2.write(r16_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2341 | spi2.write(r16_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2342 | spi2.write(r16_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2343 | spi2.write(r16_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2344 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2345 | spi2.write(b16_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2346 | spi2.write(b16_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2347 | spi2.write(b16_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2348 | spi2.write(b16_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2349 | spi2.write(b16_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2350 | spi2.write(b16_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2351 | spi2.write(b16_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2352 | spi2.write(b16_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2353 | //LED7 |
el12moe | 0:10d7f18a8cb6 | 2354 | //set green bits |
el12moe | 0:10d7f18a8cb6 | 2355 | spi2.write(g17_array[7]); //set g7 bit |
el12moe | 0:10d7f18a8cb6 | 2356 | spi2.write(g17_array[6]); //set g6 bit |
el12moe | 0:10d7f18a8cb6 | 2357 | spi2.write(g17_array[5]); //set g5 bit |
el12moe | 0:10d7f18a8cb6 | 2358 | spi2.write(g17_array[4]); //set g4 bit |
el12moe | 0:10d7f18a8cb6 | 2359 | spi2.write(g17_array[3]); //set g3 bit |
el12moe | 0:10d7f18a8cb6 | 2360 | spi2.write(g17_array[2]); //set g2 bit |
el12moe | 0:10d7f18a8cb6 | 2361 | spi2.write(g17_array[1]); //set g1 bit |
el12moe | 0:10d7f18a8cb6 | 2362 | spi2.write(g17_array[0]);//set g0 bit |
el12moe | 0:10d7f18a8cb6 | 2363 | //set red bits |
el12moe | 0:10d7f18a8cb6 | 2364 | spi2.write(r17_array[7]);//set r7 bit |
el12moe | 0:10d7f18a8cb6 | 2365 | spi2.write(r17_array[6]); //set r6 bit |
el12moe | 0:10d7f18a8cb6 | 2366 | spi2.write(r17_array[5]); //set r5 bit |
el12moe | 0:10d7f18a8cb6 | 2367 | spi2.write(r17_array[4]); //set r4 bit |
el12moe | 0:10d7f18a8cb6 | 2368 | spi2.write(r17_array[3]); //set r3 bit |
el12moe | 0:10d7f18a8cb6 | 2369 | spi2.write(r17_array[2]); //set r2 bit |
el12moe | 0:10d7f18a8cb6 | 2370 | spi2.write(r17_array[1]); //set r1 bit |
el12moe | 0:10d7f18a8cb6 | 2371 | spi2.write(r17_array[0]); //set r0 bit |
el12moe | 0:10d7f18a8cb6 | 2372 | //set blue bits |
el12moe | 0:10d7f18a8cb6 | 2373 | spi2.write(b17_array[7]); //set b7 bit |
el12moe | 0:10d7f18a8cb6 | 2374 | spi2.write(b17_array[6]); //set b6 bit |
el12moe | 0:10d7f18a8cb6 | 2375 | spi2.write(b17_array[5]); //set b5 bit |
el12moe | 0:10d7f18a8cb6 | 2376 | spi2.write(b17_array[4]); //set b4 bit |
el12moe | 0:10d7f18a8cb6 | 2377 | spi2.write(b17_array[3]); //set b3 bit |
el12moe | 0:10d7f18a8cb6 | 2378 | spi2.write(b17_array[2]); //set b2 bit |
el12moe | 0:10d7f18a8cb6 | 2379 | spi2.write(b17_array[1]); //set b1 bit |
el12moe | 0:10d7f18a8cb6 | 2380 | spi2.write(b17_array[0]); //set b0 bit |
el12moe | 0:10d7f18a8cb6 | 2381 | |
el12moe | 0:10d7f18a8cb6 | 2382 | //wait for latch |
el12moe | 0:10d7f18a8cb6 | 2383 | wait_us(60); |
el12moe | 0:10d7f18a8cb6 | 2384 | } |
el12moe | 0:10d7f18a8cb6 | 2385 | */ |
el12moe | 0:10d7f18a8cb6 | 2386 | int * decimalToBinary(int n) // converts decimal value to 8 bit array of 1's (0xFF0) and 0's (0xF00) |
el12moe | 0:10d7f18a8cb6 | 2387 | { |
el12moe | 0:10d7f18a8cb6 | 2388 | int reminder; |
el12moe | 0:10d7f18a8cb6 | 2389 | int i=0; |
el12moe | 0:10d7f18a8cb6 | 2390 | int static binary[8]; //initialize to 00000000 |
el12moe | 0:10d7f18a8cb6 | 2391 | while (n!=0) |
el12moe | 0:10d7f18a8cb6 | 2392 | { |
el12moe | 0:10d7f18a8cb6 | 2393 | reminder=n%2; |
el12moe | 0:10d7f18a8cb6 | 2394 | if(reminder == 1){ |
el12moe | 0:10d7f18a8cb6 | 2395 | binary[i] = 0xFF0; |
el12moe | 0:10d7f18a8cb6 | 2396 | } |
el12moe | 0:10d7f18a8cb6 | 2397 | if(reminder == 0){ |
el12moe | 0:10d7f18a8cb6 | 2398 | binary[i] = 0xF00; |
el12moe | 0:10d7f18a8cb6 | 2399 | } |
el12moe | 0:10d7f18a8cb6 | 2400 | n = n/2; |
el12moe | 0:10d7f18a8cb6 | 2401 | i++; |
el12moe | 0:10d7f18a8cb6 | 2402 | } |
el12moe | 0:10d7f18a8cb6 | 2403 | //sets the remainder of the digits to 0xF00 if n reaches 0 before i = 7 |
el12moe | 0:10d7f18a8cb6 | 2404 | for(;i<8;i++){ |
el12moe | 0:10d7f18a8cb6 | 2405 | binary[i] = 0xF00; |
el12moe | 0:10d7f18a8cb6 | 2406 | } |
el12moe | 0:10d7f18a8cb6 | 2407 | return binary; |
el12moe | 0:10d7f18a8cb6 | 2408 | } |
el12moe | 0:10d7f18a8cb6 | 2409 | |
el12moe | 0:10d7f18a8cb6 | 2410 | void spi_init(){ //initializes spi port to send 0 bit length |
el12moe | 0:10d7f18a8cb6 | 2411 | spi.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 |
el12moe | 0:10d7f18a8cb6 | 2412 | spi.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length |
el12moe | 0:10d7f18a8cb6 | 2413 | spi2.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 |
el12moe | 0:10d7f18a8cb6 | 2414 | spi2.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length |
el12moe | 0:10d7f18a8cb6 | 2415 | |
el12moe | 0:10d7f18a8cb6 | 2416 | } |
el12moe | 0:10d7f18a8cb6 | 2417 |