Ivan Yohuno
/
neopixel_spi
Code to work with NeoPixels
main.cpp@2:35fd99de07b3, 2015-04-23 (annotated)
- Committer:
- ivanyohuno
- Date:
- Thu Apr 23 17:52:28 2015 +0000
- Revision:
- 2:35fd99de07b3
- Parent:
- 1:42b43fa7362f
- Child:
- 3:81ab43d7e3a2
2 spi pin fixed v. 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ivanyohuno | 0:c350fa2f0c19 | 1 | #include "mbed.h" |
ivanyohuno | 0:c350fa2f0c19 | 2 | #include <string.h> |
ivanyohuno | 0:c350fa2f0c19 | 3 | #include <stdio.h> |
ivanyohuno | 0:c350fa2f0c19 | 4 | #include "NeoStrip.h" |
ivanyohuno | 0:c350fa2f0c19 | 5 | |
ivanyohuno | 0:c350fa2f0c19 | 6 | /* |
ivanyohuno | 0:c350fa2f0c19 | 7 | neopixel_spi v03 |
ivanyohuno | 0:c350fa2f0c19 | 8 | Created By: Ivan Yohuno |
ivanyohuno | 0:c350fa2f0c19 | 9 | SSID: 200717683 |
ivanyohuno | 0:c350fa2f0c19 | 10 | |
ivanyohuno | 0:c350fa2f0c19 | 11 | Notes: |
ivanyohuno | 0:c350fa2f0c19 | 12 | -Code to be run on WS2812 neopixel LEDs, can run with a single pixel or a strip of max 8 leds connected together |
ivanyohuno | 0:c350fa2f0c19 | 13 | -Single LED can be connected to power source of 5V but if connected to 5V logic will need to be shifted up from 3.3V to 5V |
ivanyohuno | 0:c350fa2f0c19 | 14 | |
ivanyohuno | 0:c350fa2f0c19 | 15 | Features: |
ivanyohuno | 0:c350fa2f0c19 | 16 | -SetRGBPixel // sets colour of one RGB Pixel (the first pixel connected), generally used for testing. Colour is a mix of 3 8 bit values of red, green and blue |
ivanyohuno | 0:c350fa2f0c19 | 17 | -SetRGBStrip // sets colour of RGB strip of 8 |
ivanyohuno | 0:c350fa2f0c19 | 18 | -setRGBStrips //sets colours of 4 RGB strips of 8 |
ivanyohuno | 0:c350fa2f0c19 | 19 | colours 2D 4x3 matrix: |
ivanyohuno | 0:c350fa2f0c19 | 20 | {{room 1 strip red, room 1 strip green, room 1 strip blue}, |
ivanyohuno | 0:c350fa2f0c19 | 21 | {room 2 strip red, room 2 strip green, room 3 strip blue}, |
ivanyohuno | 0:c350fa2f0c19 | 22 | {room 3 strip red, room 3 strip green, room 3 strip blue} |
ivanyohuno | 0:c350fa2f0c19 | 23 | } |
ivanyohuno | 0:c350fa2f0c19 | 24 | -SetRGBPixels // sets an RGB strip of 8 to individual colours using a 2D 8x3 matrix |
ivanyohuno | 0:c350fa2f0c19 | 25 | colours 2D 8x3 matrix: |
ivanyohuno | 0:c350fa2f0c19 | 26 | {{1st pixel red, 1st pixel blue, 1st pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 27 | {2nd pixel red, 2nd pixel blue, 2nd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 28 | {3rd pixel red, 3rd pixel blue, 3rd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 29 | {4th pixel red, 4th pixel blue, 4th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 30 | {5th pixel red, 5th pixel blue, 5th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 31 | {6th pixel red, 6th pixel blue, 6th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 32 | {7th pixel red, 7th pixel blue, 7th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 33 | {8th pixel red, 8th pixel blue, 8th pixel green} |
ivanyohuno | 0:c350fa2f0c19 | 34 | } |
ivanyohuno | 0:c350fa2f0c19 | 35 | -setRGBAll // sets 4 RGB strips of 8 to individual colours using a 3D 8x4x3 matrix |
ivanyohuno | 0:c350fa2f0c19 | 36 | colours 2D 8x4x3 matrix: |
ivanyohuno | 0:c350fa2f0c19 | 37 | {room1{1st pixel red, 1st pixel blue, 1st pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 38 | {2nd pixel red, 2nd pixel blue, 2nd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 39 | {3rd pixel red, 3rd pixel blue, 3rd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 40 | {4th pixel red, 4th pixel blue, 4th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 41 | {5th pixel red, 5th pixel blue, 5th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 42 | {6th pixel red, 6th pixel blue, 6th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 43 | {7th pixel red, 7th pixel blue, 7th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 44 | {8th pixel red, 8th pixel blue, 8th pixel green} |
ivanyohuno | 0:c350fa2f0c19 | 45 | room2{1st pixel red, 1st pixel blue, 1st pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 46 | {2nd pixel red, 2nd pixel blue, 2nd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 47 | {3rd pixel red, 3rd pixel blue, 3rd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 48 | {4th pixel red, 4th pixel blue, 4th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 49 | {5th pixel red, 5th pixel blue, 5th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 50 | {6th pixel red, 6th pixel blue, 6th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 51 | {7th pixel red, 7th pixel blue, 7th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 52 | {8th pixel red, 8th pixel blue, 8th pixel green} |
ivanyohuno | 0:c350fa2f0c19 | 53 | room3{1st pixel red, 1st pixel blue, 1st pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 54 | {2nd pixel red, 2nd pixel blue, 2nd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 55 | {3rd pixel red, 3rd pixel blue, 3rd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 56 | {4th pixel red, 4th pixel blue, 4th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 57 | {5th pixel red, 5th pixel blue, 5th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 58 | {6th pixel red, 6th pixel blue, 6th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 59 | {7th pixel red, 7th pixel blue, 7th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 60 | {8th pixel red, 8th pixel blue, 8th pixel green} |
ivanyohuno | 0:c350fa2f0c19 | 61 | room4{1st pixel red, 1st pixel blue, 1st pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 62 | {2nd pixel red, 2nd pixel blue, 2nd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 63 | {3rd pixel red, 3rd pixel blue, 3rd pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 64 | {4th pixel red, 4th pixel blue, 4th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 65 | {5th pixel red, 5th pixel blue, 5th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 66 | {6th pixel red, 6th pixel blue, 6th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 67 | {7th pixel red, 7th pixel blue, 7th pixel green}, |
ivanyohuno | 0:c350fa2f0c19 | 68 | {8th pixel red, 8th pixel blue, 8th pixel green} |
ivanyohuno | 0:c350fa2f0c19 | 69 | } |
ivanyohuno | 0:c350fa2f0c19 | 70 | |
ivanyohuno | 0:c350fa2f0c19 | 71 | */ |
ivanyohuno | 0:c350fa2f0c19 | 72 | |
ivanyohuno | 0:c350fa2f0c19 | 73 | //function declarations |
ivanyohuno | 0:c350fa2f0c19 | 74 | void setRGBPixel(int r, int g, int b); //sets colour of one RGB Pixel |
ivanyohuno | 0:c350fa2f0c19 | 75 | void setRGBStrip(int r, int g, int b); //sets colour of a strip of 8 RGB Pixels |
ivanyohuno | 0:c350fa2f0c19 | 76 | void setRGBPixels(int colours[8][3]); //sets sequence of colours for a strip of 8 RGB Pixels |
ivanyohuno | 1:42b43fa7362f | 77 | void setRGBFloor1(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels |
ivanyohuno | 1:42b43fa7362f | 78 | void setRGBFloor2(int colours[2][8][3]); //sets a sequence of colours for 2 strips of 8 RGB Pixels |
ivanyohuno | 1:42b43fa7362f | 79 | |
ivanyohuno | 1:42b43fa7362f | 80 | |
ivanyohuno | 0:c350fa2f0c19 | 81 | void spi_init(); //initializes SPI pin at correct bit length and bit rate |
ivanyohuno | 0:c350fa2f0c19 | 82 | int * decimalToBinary(int n); //converts a decimal value between 0 and 255 to an 8 bit binary array of 0xF00 (0) and 0xFF0 (1) |
ivanyohuno | 0:c350fa2f0c19 | 83 | |
ivanyohuno | 0:c350fa2f0c19 | 84 | //initialize pins |
ivanyohuno | 0:c350fa2f0c19 | 85 | DigitalOut volt(p16); //pin for LV voltage |
ivanyohuno | 2:35fd99de07b3 | 86 | SPI spi(p5, p6, p7);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK |
ivanyohuno | 1:42b43fa7362f | 87 | SPI spi2(p11, p12, p13);//pin for SPI communication - p5 MOSI p5 MISO p6 SCLK |
ivanyohuno | 0:c350fa2f0c19 | 88 | NeoStrip strip(p5,8); |
ivanyohuno | 0:c350fa2f0c19 | 89 | |
ivanyohuno | 0:c350fa2f0c19 | 90 | int main() { |
ivanyohuno | 0:c350fa2f0c19 | 91 | volt = 1; |
ivanyohuno | 0:c350fa2f0c19 | 92 | //use either function |
ivanyohuno | 0:c350fa2f0c19 | 93 | } |
ivanyohuno | 0:c350fa2f0c19 | 94 | |
ivanyohuno | 0:c350fa2f0c19 | 95 | void setRGBStrip(int r, int g, int b){ |
ivanyohuno | 0:c350fa2f0c19 | 96 | int r_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 97 | int g_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 98 | int b_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 99 | memcpy(r_array, decimalToBinary(r), sizeof(r_array)); |
ivanyohuno | 0:c350fa2f0c19 | 100 | memcpy(g_array, decimalToBinary(g), sizeof(g_array)); |
ivanyohuno | 0:c350fa2f0c19 | 101 | memcpy(b_array, decimalToBinary(b), sizeof(b_array)); |
ivanyohuno | 0:c350fa2f0c19 | 102 | |
ivanyohuno | 0:c350fa2f0c19 | 103 | //send commands to LED Driver |
ivanyohuno | 0:c350fa2f0c19 | 104 | //initialize SPI |
ivanyohuno | 0:c350fa2f0c19 | 105 | spi_init(); |
ivanyohuno | 0:c350fa2f0c19 | 106 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 107 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 108 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 109 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 110 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 111 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 112 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 113 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 114 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 115 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 116 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 117 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 118 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 119 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 120 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 121 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 122 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 123 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 124 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 125 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 126 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 127 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 128 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 129 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 130 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 131 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 132 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 133 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 134 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 135 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 136 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 137 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 138 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 139 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 140 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 141 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 142 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 143 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 144 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 145 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 146 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 147 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 148 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 149 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 150 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 151 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 152 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 153 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 154 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 155 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 156 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 157 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 158 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 159 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 160 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 161 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 162 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 163 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 164 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 165 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 166 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 167 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 168 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 169 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 170 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 171 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 172 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 173 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 174 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 175 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 176 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 177 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 178 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 179 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 180 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 181 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 182 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 183 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 184 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 185 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 186 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 187 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 188 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 189 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 190 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 191 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 192 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 193 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 194 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 195 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 196 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 197 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 198 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 199 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 200 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 201 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 202 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 203 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 204 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 205 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 206 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 207 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 208 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 209 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 210 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 211 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 212 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 213 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 214 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 215 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 216 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 217 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 218 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 219 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 220 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 221 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 222 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 223 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 224 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 225 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 226 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 227 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 228 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 229 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 230 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 231 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 232 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 233 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 234 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 235 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 236 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 237 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 238 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 239 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 240 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 241 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 242 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 243 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 244 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 245 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 246 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 247 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 248 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 249 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 250 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 251 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 252 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 253 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 254 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 255 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 256 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 257 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 258 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 259 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 260 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 261 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 262 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 263 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 264 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 265 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 266 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 267 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 268 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 269 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 270 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 271 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 272 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 273 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 274 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 275 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 276 | |
ivanyohuno | 0:c350fa2f0c19 | 277 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 278 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 279 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 280 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 281 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 282 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 283 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 284 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 285 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 286 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 287 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 288 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 289 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 290 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 291 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 292 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 293 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 294 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 295 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 296 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 297 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 298 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 299 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 300 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 301 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 302 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 303 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 304 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 305 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 306 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 307 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 308 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 309 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 310 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 311 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 312 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 313 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 314 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 315 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 316 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 317 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 318 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 319 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 320 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 321 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 322 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 323 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 324 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 325 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 326 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 327 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 328 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 329 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 330 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 2:35fd99de07b3 | 331 | |
ivanyohuno | 0:c350fa2f0c19 | 332 | //wait for latch |
ivanyohuno | 0:c350fa2f0c19 | 333 | wait_us(60); |
ivanyohuno | 0:c350fa2f0c19 | 334 | } |
ivanyohuno | 0:c350fa2f0c19 | 335 | |
ivanyohuno | 0:c350fa2f0c19 | 336 | |
ivanyohuno | 0:c350fa2f0c19 | 337 | void setRGBPixel(int r, int g, int b){ |
ivanyohuno | 0:c350fa2f0c19 | 338 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
ivanyohuno | 0:c350fa2f0c19 | 339 | int r_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 340 | int g_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 341 | int b_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 342 | memcpy(r_array, decimalToBinary(r), sizeof(r_array)); |
ivanyohuno | 0:c350fa2f0c19 | 343 | memcpy(g_array, decimalToBinary(g), sizeof(g_array)); |
ivanyohuno | 0:c350fa2f0c19 | 344 | memcpy(b_array, decimalToBinary(b), sizeof(b_array)); |
ivanyohuno | 0:c350fa2f0c19 | 345 | |
ivanyohuno | 0:c350fa2f0c19 | 346 | //send commands to LED Driver |
ivanyohuno | 0:c350fa2f0c19 | 347 | //initialize SPI |
ivanyohuno | 0:c350fa2f0c19 | 348 | spi_init(); |
ivanyohuno | 0:c350fa2f0c19 | 349 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 350 | spi.write(g_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 351 | spi.write(g_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 352 | spi.write(g_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 353 | spi.write(g_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 354 | spi.write(g_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 355 | spi.write(g_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 356 | spi.write(g_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 357 | spi.write(g_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 358 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 359 | spi.write(r_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 360 | spi.write(r_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 361 | spi.write(r_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 362 | spi.write(r_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 363 | spi.write(r_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 364 | spi.write(r_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 365 | spi.write(r_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 366 | spi.write(r_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 367 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 368 | spi.write(b_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 369 | spi.write(b_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 370 | spi.write(b_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 371 | spi.write(b_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 372 | spi.write(b_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 373 | spi.write(b_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 374 | spi.write(b_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 375 | spi.write(b_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 376 | //wait for latch |
ivanyohuno | 0:c350fa2f0c19 | 377 | wait_us(60); |
ivanyohuno | 0:c350fa2f0c19 | 378 | } |
ivanyohuno | 0:c350fa2f0c19 | 379 | |
ivanyohuno | 0:c350fa2f0c19 | 380 | void setRGBPixels(int colours[8][3]){ |
ivanyohuno | 0:c350fa2f0c19 | 381 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
ivanyohuno | 0:c350fa2f0c19 | 382 | int r0_array[8]; //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 383 | int g0_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 384 | int b0_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 385 | memcpy(r0_array, decimalToBinary(colours[0][0]), sizeof(r0_array)); |
ivanyohuno | 0:c350fa2f0c19 | 386 | memcpy(g0_array, decimalToBinary(colours[0][1]), sizeof(g0_array)); |
ivanyohuno | 0:c350fa2f0c19 | 387 | memcpy(b0_array, decimalToBinary(colours[0][2]), sizeof(b0_array)); |
ivanyohuno | 0:c350fa2f0c19 | 388 | int r1_array[8]; //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 389 | int g1_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 390 | int b1_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 391 | memcpy(r1_array, decimalToBinary(colours[1][0]), sizeof(r1_array)); |
ivanyohuno | 0:c350fa2f0c19 | 392 | memcpy(g1_array, decimalToBinary(colours[1][1]), sizeof(g1_array)); |
ivanyohuno | 0:c350fa2f0c19 | 393 | memcpy(b1_array, decimalToBinary(colours[1][2]), sizeof(b1_array)); |
ivanyohuno | 0:c350fa2f0c19 | 394 | int r2_array[8]; //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 395 | int g2_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 396 | int b2_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 397 | memcpy(r2_array, decimalToBinary(colours[2][0]), sizeof(r2_array)); |
ivanyohuno | 0:c350fa2f0c19 | 398 | memcpy(g2_array, decimalToBinary(colours[2][1]), sizeof(g2_array)); |
ivanyohuno | 0:c350fa2f0c19 | 399 | memcpy(b2_array, decimalToBinary(colours[2][2]), sizeof(b2_array)); |
ivanyohuno | 0:c350fa2f0c19 | 400 | int r3_array[8]; //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 401 | int g3_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 402 | int b3_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 403 | memcpy(r3_array, decimalToBinary(colours[3][0]), sizeof(r3_array)); |
ivanyohuno | 0:c350fa2f0c19 | 404 | memcpy(g3_array, decimalToBinary(colours[3][1]), sizeof(g3_array)); |
ivanyohuno | 0:c350fa2f0c19 | 405 | memcpy(b3_array, decimalToBinary(colours[3][2]), sizeof(b3_array)); |
ivanyohuno | 0:c350fa2f0c19 | 406 | int r4_array[8]; //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 407 | int g4_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 408 | int b4_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 409 | memcpy(r4_array, decimalToBinary(colours[4][0]), sizeof(r4_array)); |
ivanyohuno | 0:c350fa2f0c19 | 410 | memcpy(g4_array, decimalToBinary(colours[4][1]), sizeof(g4_array)); |
ivanyohuno | 0:c350fa2f0c19 | 411 | memcpy(b4_array, decimalToBinary(colours[4][2]), sizeof(b4_array)); |
ivanyohuno | 0:c350fa2f0c19 | 412 | int r5_array[8]; //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 413 | int g5_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 414 | int b5_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 415 | memcpy(r5_array, decimalToBinary(colours[5][0]), sizeof(r5_array)); |
ivanyohuno | 0:c350fa2f0c19 | 416 | memcpy(g5_array, decimalToBinary(colours[5][1]), sizeof(g5_array)); |
ivanyohuno | 0:c350fa2f0c19 | 417 | memcpy(b5_array, decimalToBinary(colours[5][2]), sizeof(b5_array)); |
ivanyohuno | 0:c350fa2f0c19 | 418 | int r6_array[8]; //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 419 | int g6_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 420 | int b6_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 421 | memcpy(r6_array, decimalToBinary(colours[6][0]), sizeof(r6_array)); |
ivanyohuno | 0:c350fa2f0c19 | 422 | memcpy(g6_array, decimalToBinary(colours[6][1]), sizeof(g6_array)); |
ivanyohuno | 0:c350fa2f0c19 | 423 | memcpy(b6_array, decimalToBinary(colours[6][2]), sizeof(b6_array)); |
ivanyohuno | 0:c350fa2f0c19 | 424 | int r7_array[8]; //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 425 | int g7_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 426 | int b7_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 427 | memcpy(r7_array, decimalToBinary(colours[7][0]), sizeof(r7_array)); |
ivanyohuno | 0:c350fa2f0c19 | 428 | memcpy(g7_array, decimalToBinary(colours[7][1]), sizeof(g7_array)); |
ivanyohuno | 0:c350fa2f0c19 | 429 | memcpy(b7_array, decimalToBinary(colours[7][2]), sizeof(b7_array)); |
ivanyohuno | 0:c350fa2f0c19 | 430 | |
ivanyohuno | 0:c350fa2f0c19 | 431 | //send commands to LED Driver |
ivanyohuno | 0:c350fa2f0c19 | 432 | //initialize SPI |
ivanyohuno | 0:c350fa2f0c19 | 433 | spi_init(); |
ivanyohuno | 0:c350fa2f0c19 | 434 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 435 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 436 | spi.write(g0_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 437 | spi.write(g0_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 438 | spi.write(g0_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 439 | spi.write(g0_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 440 | spi.write(g0_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 441 | spi.write(g0_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 442 | spi.write(g0_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 443 | spi.write(g0_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 444 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 445 | spi.write(r0_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 446 | spi.write(r0_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 447 | spi.write(r0_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 448 | spi.write(r0_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 449 | spi.write(r0_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 450 | spi.write(r0_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 451 | spi.write(r0_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 452 | spi.write(r0_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 453 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 454 | spi.write(b0_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 455 | spi.write(b0_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 456 | spi.write(b0_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 457 | spi.write(b0_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 458 | spi.write(b0_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 459 | spi.write(b0_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 460 | spi.write(b0_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 461 | spi.write(b0_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 462 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 463 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 464 | spi.write(g1_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 465 | spi.write(g1_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 466 | spi.write(g1_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 467 | spi.write(g1_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 468 | spi.write(g1_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 469 | spi.write(g1_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 470 | spi.write(g1_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 471 | spi.write(g1_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 472 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 473 | spi.write(r1_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 474 | spi.write(r1_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 475 | spi.write(r1_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 476 | spi.write(r1_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 477 | spi.write(r1_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 478 | spi.write(r1_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 479 | spi.write(r1_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 480 | spi.write(r1_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 481 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 482 | spi.write(b1_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 483 | spi.write(b1_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 484 | spi.write(b1_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 485 | spi.write(b1_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 486 | spi.write(b1_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 487 | spi.write(b1_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 488 | spi.write(b1_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 489 | spi.write(b1_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 490 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 491 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 492 | spi.write(g2_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 493 | spi.write(g2_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 494 | spi.write(g2_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 495 | spi.write(g2_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 496 | spi.write(g2_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 497 | spi.write(g2_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 498 | spi.write(g2_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 499 | spi.write(g2_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 500 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 501 | spi.write(r2_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 502 | spi.write(r2_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 503 | spi.write(r2_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 504 | spi.write(r2_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 505 | spi.write(r2_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 506 | spi.write(r2_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 507 | spi.write(r2_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 508 | spi.write(r2_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 509 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 510 | spi.write(b2_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 511 | spi.write(b2_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 512 | spi.write(b2_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 513 | spi.write(b2_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 514 | spi.write(b2_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 515 | spi.write(b2_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 516 | spi.write(b2_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 517 | spi.write(b2_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 518 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 519 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 520 | spi.write(g3_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 521 | spi.write(g3_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 522 | spi.write(g3_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 523 | spi.write(g3_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 524 | spi.write(g3_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 525 | spi.write(g3_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 526 | spi.write(g3_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 527 | spi.write(g3_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 528 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 529 | spi.write(r3_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 530 | spi.write(r3_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 531 | spi.write(r3_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 532 | spi.write(r3_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 533 | spi.write(r3_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 534 | spi.write(r3_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 535 | spi.write(r3_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 536 | spi.write(r3_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 537 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 538 | spi.write(b3_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 539 | spi.write(b3_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 540 | spi.write(b3_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 541 | spi.write(b3_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 542 | spi.write(b3_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 543 | spi.write(b3_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 544 | spi.write(b3_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 545 | spi.write(b3_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 546 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 547 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 548 | spi.write(g4_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 549 | spi.write(g4_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 550 | spi.write(g4_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 551 | spi.write(g4_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 552 | spi.write(g4_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 553 | spi.write(g4_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 554 | spi.write(g4_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 555 | spi.write(g4_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 556 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 557 | spi.write(r4_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 558 | spi.write(r4_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 559 | spi.write(r4_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 560 | spi.write(r4_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 561 | spi.write(r4_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 562 | spi.write(r4_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 563 | spi.write(r4_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 564 | spi.write(r4_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 565 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 566 | spi.write(b4_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 567 | spi.write(b4_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 568 | spi.write(b4_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 569 | spi.write(b4_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 570 | spi.write(b4_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 571 | spi.write(b4_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 572 | spi.write(b4_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 573 | spi.write(b4_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 574 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 575 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 576 | spi.write(g5_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 577 | spi.write(g5_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 578 | spi.write(g5_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 579 | spi.write(g5_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 580 | spi.write(g5_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 581 | spi.write(g5_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 582 | spi.write(g5_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 583 | spi.write(g5_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 584 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 585 | spi.write(r5_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 586 | spi.write(r5_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 587 | spi.write(r5_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 588 | spi.write(r5_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 589 | spi.write(r5_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 590 | spi.write(r5_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 591 | spi.write(r5_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 592 | spi.write(r5_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 593 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 594 | spi.write(b5_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 595 | spi.write(b5_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 596 | spi.write(b5_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 597 | spi.write(b5_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 598 | spi.write(b5_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 599 | spi.write(b5_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 600 | spi.write(b5_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 601 | spi.write(b5_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 602 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 603 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 604 | spi.write(g6_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 605 | spi.write(g6_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 606 | spi.write(g6_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 607 | spi.write(g6_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 608 | spi.write(g6_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 609 | spi.write(g6_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 610 | spi.write(g6_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 611 | spi.write(g6_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 612 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 613 | spi.write(r6_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 614 | spi.write(r6_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 615 | spi.write(r6_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 616 | spi.write(r6_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 617 | spi.write(r6_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 618 | spi.write(r6_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 619 | spi.write(r6_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 620 | spi.write(r6_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 621 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 622 | spi.write(b6_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 623 | spi.write(b6_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 624 | spi.write(b6_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 625 | spi.write(b6_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 626 | spi.write(b6_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 627 | spi.write(b6_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 628 | spi.write(b6_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 629 | spi.write(b6_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 630 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 631 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 632 | spi.write(g7_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 633 | spi.write(g7_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 634 | spi.write(g7_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 635 | spi.write(g7_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 636 | spi.write(g7_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 637 | spi.write(g7_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 638 | spi.write(g7_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 639 | spi.write(g7_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 640 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 641 | spi.write(r7_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 642 | spi.write(r7_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 643 | spi.write(r7_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 644 | spi.write(r7_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 645 | spi.write(r7_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 646 | spi.write(r7_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 647 | spi.write(r7_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 648 | spi.write(r7_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 649 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 650 | spi.write(b7_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 651 | spi.write(b7_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 652 | spi.write(b7_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 653 | spi.write(b7_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 654 | spi.write(b7_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 655 | spi.write(b7_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 656 | spi.write(b7_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 657 | spi.write(b7_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 658 | //wait for latch |
ivanyohuno | 0:c350fa2f0c19 | 659 | wait_us(60); |
ivanyohuno | 0:c350fa2f0c19 | 660 | } |
ivanyohuno | 0:c350fa2f0c19 | 661 | |
ivanyohuno | 2:35fd99de07b3 | 662 | void setRGBFloor_1(int room1[8][3], int room2[8][3]){ |
ivanyohuno | 0:c350fa2f0c19 | 663 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
ivanyohuno | 0:c350fa2f0c19 | 664 | //room1 |
ivanyohuno | 0:c350fa2f0c19 | 665 | int r00_array[8]; //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 666 | int g00_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 667 | int b00_array[8]; |
ivanyohuno | 1:42b43fa7362f | 668 | memcpy(r00_array, decimalToBinary(room1[0][0]), sizeof(r00_array)); |
ivanyohuno | 1:42b43fa7362f | 669 | memcpy(g00_array, decimalToBinary(room1[0][1]), sizeof(g00_array)); |
ivanyohuno | 1:42b43fa7362f | 670 | memcpy(b00_array, decimalToBinary(room1[0][2]), sizeof(b00_array)); |
ivanyohuno | 0:c350fa2f0c19 | 671 | int r01_array[8]; //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 672 | int g01_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 673 | int b01_array[8]; |
ivanyohuno | 1:42b43fa7362f | 674 | memcpy(r01_array, decimalToBinary(room1[1][0]), sizeof(r01_array)); |
ivanyohuno | 1:42b43fa7362f | 675 | memcpy(g01_array, decimalToBinary(room1[1][1]), sizeof(g01_array)); |
ivanyohuno | 1:42b43fa7362f | 676 | memcpy(b01_array, decimalToBinary(room1[1][2]), sizeof(b01_array)); |
ivanyohuno | 0:c350fa2f0c19 | 677 | int r02_array[8]; //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 678 | int g02_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 679 | int b02_array[8]; |
ivanyohuno | 1:42b43fa7362f | 680 | memcpy(r02_array, decimalToBinary(room1[2][0]), sizeof(r02_array)); |
ivanyohuno | 1:42b43fa7362f | 681 | memcpy(g02_array, decimalToBinary(room1[2][1]), sizeof(g02_array)); |
ivanyohuno | 1:42b43fa7362f | 682 | memcpy(b02_array, decimalToBinary(room1[2][2]), sizeof(b02_array)); |
ivanyohuno | 0:c350fa2f0c19 | 683 | int r03_array[8]; //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 684 | int g03_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 685 | int b03_array[8]; |
ivanyohuno | 1:42b43fa7362f | 686 | memcpy(r03_array, decimalToBinary(room1[3][0]), sizeof(r03_array)); |
ivanyohuno | 1:42b43fa7362f | 687 | memcpy(g03_array, decimalToBinary(room1[3][1]), sizeof(g03_array)); |
ivanyohuno | 1:42b43fa7362f | 688 | memcpy(b03_array, decimalToBinary(room1[3][2]), sizeof(b03_array)); |
ivanyohuno | 0:c350fa2f0c19 | 689 | int r04_array[8]; //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 690 | int g04_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 691 | int b04_array[8]; |
ivanyohuno | 1:42b43fa7362f | 692 | memcpy(r04_array, decimalToBinary(room1[4][0]), sizeof(r04_array)); |
ivanyohuno | 1:42b43fa7362f | 693 | memcpy(g04_array, decimalToBinary(room1[4][1]), sizeof(g04_array)); |
ivanyohuno | 1:42b43fa7362f | 694 | memcpy(b04_array, decimalToBinary(room1[4][2]), sizeof(b04_array)); |
ivanyohuno | 0:c350fa2f0c19 | 695 | int r05_array[8]; //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 696 | int g05_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 697 | int b05_array[8]; |
ivanyohuno | 1:42b43fa7362f | 698 | memcpy(r05_array, decimalToBinary(room1[5][0]), sizeof(r05_array)); |
ivanyohuno | 1:42b43fa7362f | 699 | memcpy(g05_array, decimalToBinary(room1[5][1]), sizeof(g05_array)); |
ivanyohuno | 1:42b43fa7362f | 700 | memcpy(b05_array, decimalToBinary(room1[5][2]), sizeof(b05_array)); |
ivanyohuno | 0:c350fa2f0c19 | 701 | int r06_array[8]; //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 702 | int g06_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 703 | int b06_array[8]; |
ivanyohuno | 1:42b43fa7362f | 704 | memcpy(r06_array, decimalToBinary(room1[6][0]), sizeof(r06_array)); |
ivanyohuno | 1:42b43fa7362f | 705 | memcpy(g06_array, decimalToBinary(room1[6][1]), sizeof(g06_array)); |
ivanyohuno | 1:42b43fa7362f | 706 | memcpy(b06_array, decimalToBinary(room1[6][2]), sizeof(b06_array)); |
ivanyohuno | 0:c350fa2f0c19 | 707 | int r07_array[8]; //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 708 | int g07_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 709 | int b07_array[8]; |
ivanyohuno | 1:42b43fa7362f | 710 | memcpy(r07_array, decimalToBinary(room1[7][0]), sizeof(r07_array)); |
ivanyohuno | 1:42b43fa7362f | 711 | memcpy(g07_array, decimalToBinary(room1[7][1]), sizeof(g07_array)); |
ivanyohuno | 1:42b43fa7362f | 712 | memcpy(b07_array, decimalToBinary(room1[7][2]), sizeof(b07_array)); |
ivanyohuno | 0:c350fa2f0c19 | 713 | |
ivanyohuno | 0:c350fa2f0c19 | 714 | //room2 |
ivanyohuno | 0:c350fa2f0c19 | 715 | int r10_array[8]; //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 716 | int g10_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 717 | int b10_array[8]; |
ivanyohuno | 1:42b43fa7362f | 718 | memcpy(r10_array, decimalToBinary(room2[0][0]), sizeof(r10_array)); |
ivanyohuno | 1:42b43fa7362f | 719 | memcpy(g10_array, decimalToBinary(room2[0][1]), sizeof(g10_array)); |
ivanyohuno | 1:42b43fa7362f | 720 | memcpy(b10_array, decimalToBinary(room2[0][2]), sizeof(b10_array)); |
ivanyohuno | 0:c350fa2f0c19 | 721 | int r11_array[8]; //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 722 | int g11_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 723 | int b11_array[8]; |
ivanyohuno | 1:42b43fa7362f | 724 | memcpy(r11_array, decimalToBinary(room2[1][0]), sizeof(r11_array)); |
ivanyohuno | 1:42b43fa7362f | 725 | memcpy(g11_array, decimalToBinary(room2[1][1]), sizeof(g11_array)); |
ivanyohuno | 1:42b43fa7362f | 726 | memcpy(b11_array, decimalToBinary(room2[1][2]), sizeof(b11_array)); |
ivanyohuno | 0:c350fa2f0c19 | 727 | int r12_array[8]; //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 728 | int g12_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 729 | int b12_array[8]; |
ivanyohuno | 1:42b43fa7362f | 730 | memcpy(r12_array, decimalToBinary(room2[2][0]), sizeof(r12_array)); |
ivanyohuno | 1:42b43fa7362f | 731 | memcpy(g12_array, decimalToBinary(room2[2][1]), sizeof(g12_array)); |
ivanyohuno | 1:42b43fa7362f | 732 | memcpy(b12_array, decimalToBinary(room2[2][2]), sizeof(b12_array)); |
ivanyohuno | 0:c350fa2f0c19 | 733 | int r13_array[8]; //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 734 | int g13_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 735 | int b13_array[8]; |
ivanyohuno | 1:42b43fa7362f | 736 | memcpy(r13_array, decimalToBinary(room2[3][0]), sizeof(r13_array)); |
ivanyohuno | 1:42b43fa7362f | 737 | memcpy(g13_array, decimalToBinary(room2[3][1]), sizeof(g13_array)); |
ivanyohuno | 1:42b43fa7362f | 738 | memcpy(b13_array, decimalToBinary(room2[3][2]), sizeof(b13_array)); |
ivanyohuno | 0:c350fa2f0c19 | 739 | int r14_array[8]; //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 740 | int g14_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 741 | int b14_array[8]; |
ivanyohuno | 1:42b43fa7362f | 742 | memcpy(r14_array, decimalToBinary(room2[4][0]), sizeof(r14_array)); |
ivanyohuno | 1:42b43fa7362f | 743 | memcpy(g14_array, decimalToBinary(room2[4][1]), sizeof(g14_array)); |
ivanyohuno | 1:42b43fa7362f | 744 | memcpy(b14_array, decimalToBinary(room2[4][2]), sizeof(b14_array)); |
ivanyohuno | 0:c350fa2f0c19 | 745 | int r15_array[8]; //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 746 | int g15_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 747 | int b15_array[8]; |
ivanyohuno | 1:42b43fa7362f | 748 | memcpy(r15_array, decimalToBinary(room2[5][0]), sizeof(r15_array)); |
ivanyohuno | 1:42b43fa7362f | 749 | memcpy(g15_array, decimalToBinary(room2[5][1]), sizeof(g15_array)); |
ivanyohuno | 1:42b43fa7362f | 750 | memcpy(b15_array, decimalToBinary(room2[5][2]), sizeof(b15_array)); |
ivanyohuno | 0:c350fa2f0c19 | 751 | int r16_array[8]; //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 752 | int g16_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 753 | int b16_array[8]; |
ivanyohuno | 1:42b43fa7362f | 754 | memcpy(r16_array, decimalToBinary(room2[6][0]), sizeof(r16_array)); |
ivanyohuno | 1:42b43fa7362f | 755 | memcpy(g16_array, decimalToBinary(room2[6][1]), sizeof(g16_array)); |
ivanyohuno | 1:42b43fa7362f | 756 | memcpy(b16_array, decimalToBinary(room2[6][2]), sizeof(b16_array)); |
ivanyohuno | 0:c350fa2f0c19 | 757 | int r17_array[8]; //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 758 | int g17_array[8]; |
ivanyohuno | 0:c350fa2f0c19 | 759 | int b17_array[8]; |
ivanyohuno | 1:42b43fa7362f | 760 | memcpy(r17_array, decimalToBinary(room2[7][0]), sizeof(r17_array)); |
ivanyohuno | 1:42b43fa7362f | 761 | memcpy(g17_array, decimalToBinary(room2[7][1]), sizeof(g17_array)); |
ivanyohuno | 1:42b43fa7362f | 762 | memcpy(b17_array, decimalToBinary(room2[7][2]), sizeof(b17_array)); |
ivanyohuno | 0:c350fa2f0c19 | 763 | |
ivanyohuno | 0:c350fa2f0c19 | 764 | //send commands to LED Driver |
ivanyohuno | 0:c350fa2f0c19 | 765 | //initialize SPI |
ivanyohuno | 0:c350fa2f0c19 | 766 | spi_init(); |
ivanyohuno | 0:c350fa2f0c19 | 767 | //room1 |
ivanyohuno | 0:c350fa2f0c19 | 768 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 769 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 770 | spi.write(g00_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 771 | spi.write(g00_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 772 | spi.write(g00_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 773 | spi.write(g00_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 774 | spi.write(g00_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 775 | spi.write(g00_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 776 | spi.write(g00_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 777 | spi.write(g00_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 778 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 779 | spi.write(r00_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 780 | spi.write(r00_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 781 | spi.write(r00_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 782 | spi.write(r00_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 783 | spi.write(r00_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 784 | spi.write(r00_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 785 | spi.write(r00_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 786 | spi.write(r00_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 787 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 788 | spi.write(b00_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 789 | spi.write(b00_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 790 | spi.write(b00_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 791 | spi.write(b00_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 792 | spi.write(b00_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 793 | spi.write(b00_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 794 | spi.write(b00_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 795 | spi.write(b00_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 796 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 797 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 798 | spi.write(g01_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 799 | spi.write(g01_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 800 | spi.write(g01_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 801 | spi.write(g01_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 802 | spi.write(g01_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 803 | spi.write(g01_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 804 | spi.write(g01_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 805 | spi.write(g01_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 806 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 807 | spi.write(r01_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 808 | spi.write(r01_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 809 | spi.write(r01_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 810 | spi.write(r01_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 811 | spi.write(r01_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 812 | spi.write(r01_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 813 | spi.write(r01_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 814 | spi.write(r01_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 815 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 816 | spi.write(b01_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 817 | spi.write(b01_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 818 | spi.write(b01_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 819 | spi.write(b01_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 820 | spi.write(b01_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 821 | spi.write(b01_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 822 | spi.write(b01_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 823 | spi.write(b01_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 824 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 825 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 826 | spi.write(g02_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 827 | spi.write(g02_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 828 | spi.write(g02_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 829 | spi.write(g02_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 830 | spi.write(g02_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 831 | spi.write(g02_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 832 | spi.write(g02_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 833 | spi.write(g02_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 834 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 835 | spi.write(r02_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 836 | spi.write(r02_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 837 | spi.write(r02_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 838 | spi.write(r02_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 839 | spi.write(r02_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 840 | spi.write(r02_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 841 | spi.write(r02_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 842 | spi.write(r02_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 843 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 844 | spi.write(b02_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 845 | spi.write(b02_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 846 | spi.write(b02_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 847 | spi.write(b02_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 848 | spi.write(b02_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 849 | spi.write(b02_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 850 | spi.write(b02_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 851 | spi.write(b02_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 852 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 853 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 854 | spi.write(g03_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 855 | spi.write(g03_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 856 | spi.write(g03_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 857 | spi.write(g03_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 858 | spi.write(g03_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 859 | spi.write(g03_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 860 | spi.write(g03_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 861 | spi.write(g03_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 862 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 863 | spi.write(r03_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 864 | spi.write(r03_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 865 | spi.write(r03_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 866 | spi.write(r03_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 867 | spi.write(r03_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 868 | spi.write(r03_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 869 | spi.write(r03_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 870 | spi.write(r03_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 871 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 872 | spi.write(b03_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 873 | spi.write(b03_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 874 | spi.write(b03_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 875 | spi.write(b03_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 876 | spi.write(b03_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 877 | spi.write(b03_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 878 | spi.write(b03_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 879 | spi.write(b03_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 880 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 881 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 882 | spi.write(g04_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 883 | spi.write(g04_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 884 | spi.write(g04_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 885 | spi.write(g04_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 886 | spi.write(g04_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 887 | spi.write(g04_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 888 | spi.write(g04_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 889 | spi.write(g04_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 890 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 891 | spi.write(r04_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 892 | spi.write(r04_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 893 | spi.write(r04_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 894 | spi.write(r04_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 895 | spi.write(r04_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 896 | spi.write(r04_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 897 | spi.write(r04_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 898 | spi.write(r04_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 899 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 900 | spi.write(b04_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 901 | spi.write(b04_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 902 | spi.write(b04_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 903 | spi.write(b04_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 904 | spi.write(b04_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 905 | spi.write(b04_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 906 | spi.write(b04_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 907 | spi.write(b04_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 908 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 909 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 910 | spi.write(g05_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 911 | spi.write(g05_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 912 | spi.write(g05_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 913 | spi.write(g05_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 914 | spi.write(g05_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 915 | spi.write(g05_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 916 | spi.write(g05_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 917 | spi.write(g05_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 918 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 919 | spi.write(r05_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 920 | spi.write(r05_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 921 | spi.write(r05_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 922 | spi.write(r05_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 923 | spi.write(r05_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 924 | spi.write(r05_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 925 | spi.write(r05_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 926 | spi.write(r05_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 927 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 928 | spi.write(b05_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 929 | spi.write(b05_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 930 | spi.write(b05_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 931 | spi.write(b05_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 932 | spi.write(b05_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 933 | spi.write(b05_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 934 | spi.write(b05_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 935 | spi.write(b05_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 936 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 937 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 938 | spi.write(g06_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 939 | spi.write(g06_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 940 | spi.write(g06_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 941 | spi.write(g06_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 942 | spi.write(g06_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 943 | spi.write(g06_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 944 | spi.write(g06_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 945 | spi.write(g06_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 946 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 947 | spi.write(r06_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 948 | spi.write(r06_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 949 | spi.write(r06_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 950 | spi.write(r06_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 951 | spi.write(r06_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 952 | spi.write(r06_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 953 | spi.write(r06_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 954 | spi.write(r06_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 955 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 956 | spi.write(b06_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 957 | spi.write(b06_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 958 | spi.write(b06_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 959 | spi.write(b06_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 960 | spi.write(b06_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 961 | spi.write(b06_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 962 | spi.write(b06_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 963 | spi.write(b06_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 964 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 965 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 966 | spi.write(g07_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 967 | spi.write(g07_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 968 | spi.write(g07_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 969 | spi.write(g07_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 970 | spi.write(g07_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 971 | spi.write(g07_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 972 | spi.write(g07_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 973 | spi.write(g07_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 974 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 975 | spi.write(r07_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 976 | spi.write(r07_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 977 | spi.write(r07_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 978 | spi.write(r07_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 979 | spi.write(r07_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 980 | spi.write(r07_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 981 | spi.write(r07_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 982 | spi.write(r07_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 983 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 984 | spi.write(b07_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 985 | spi.write(b07_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 986 | spi.write(b07_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 987 | spi.write(b07_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 988 | spi.write(b07_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 989 | spi.write(b07_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 990 | spi.write(b07_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 991 | spi.write(b07_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 992 | //room2 |
ivanyohuno | 0:c350fa2f0c19 | 993 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 994 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 995 | spi.write(g10_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 996 | spi.write(g10_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 997 | spi.write(g10_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 998 | spi.write(g10_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 999 | spi.write(g10_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1000 | spi.write(g10_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1001 | spi.write(g10_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1002 | spi.write(g10_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1003 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1004 | spi.write(r10_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1005 | spi.write(r10_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1006 | spi.write(r10_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1007 | spi.write(r10_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1008 | spi.write(r10_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1009 | spi.write(r10_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1010 | spi.write(r10_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1011 | spi.write(r10_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1012 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1013 | spi.write(b10_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1014 | spi.write(b10_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1015 | spi.write(b10_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1016 | spi.write(b10_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1017 | spi.write(b10_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1018 | spi.write(b10_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1019 | spi.write(b10_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1020 | spi.write(b10_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1021 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 1022 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1023 | spi.write(g11_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1024 | spi.write(g11_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1025 | spi.write(g11_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1026 | spi.write(g11_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1027 | spi.write(g11_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1028 | spi.write(g11_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1029 | spi.write(g11_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1030 | spi.write(g11_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1031 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1032 | spi.write(r11_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1033 | spi.write(r11_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1034 | spi.write(r11_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1035 | spi.write(r11_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1036 | spi.write(r11_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1037 | spi.write(r11_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1038 | spi.write(r11_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1039 | spi.write(r11_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1040 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1041 | spi.write(b11_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1042 | spi.write(b11_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1043 | spi.write(b11_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1044 | spi.write(b11_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1045 | spi.write(b11_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1046 | spi.write(b11_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1047 | spi.write(b11_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1048 | spi.write(b11_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1049 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 1050 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1051 | spi.write(g12_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1052 | spi.write(g12_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1053 | spi.write(g12_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1054 | spi.write(g12_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1055 | spi.write(g12_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1056 | spi.write(g12_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1057 | spi.write(g12_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1058 | spi.write(g12_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1059 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1060 | spi.write(r12_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1061 | spi.write(r12_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1062 | spi.write(r12_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1063 | spi.write(r12_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1064 | spi.write(r12_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1065 | spi.write(r12_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1066 | spi.write(r12_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1067 | spi.write(r12_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1068 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1069 | spi.write(b12_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1070 | spi.write(b12_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1071 | spi.write(b12_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1072 | spi.write(b12_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1073 | spi.write(b12_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1074 | spi.write(b12_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1075 | spi.write(b12_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1076 | spi.write(b12_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1077 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 1078 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1079 | spi.write(g13_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1080 | spi.write(g13_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1081 | spi.write(g13_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1082 | spi.write(g13_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1083 | spi.write(g13_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1084 | spi.write(g13_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1085 | spi.write(g13_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1086 | spi.write(g13_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1087 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1088 | spi.write(r13_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1089 | spi.write(r13_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1090 | spi.write(r13_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1091 | spi.write(r13_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1092 | spi.write(r13_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1093 | spi.write(r13_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1094 | spi.write(r13_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1095 | spi.write(r13_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1096 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1097 | spi.write(b13_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1098 | spi.write(b13_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1099 | spi.write(b13_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1100 | spi.write(b13_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1101 | spi.write(b13_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1102 | spi.write(b13_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1103 | spi.write(b13_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1104 | spi.write(b13_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1105 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 1106 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1107 | spi.write(g14_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1108 | spi.write(g14_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1109 | spi.write(g14_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1110 | spi.write(g14_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1111 | spi.write(g14_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1112 | spi.write(g14_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1113 | spi.write(g14_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1114 | spi.write(g14_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1115 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1116 | spi.write(r14_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1117 | spi.write(r14_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1118 | spi.write(r14_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1119 | spi.write(r14_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1120 | spi.write(r14_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1121 | spi.write(r14_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1122 | spi.write(r14_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1123 | spi.write(r14_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1124 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1125 | spi.write(b14_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1126 | spi.write(b14_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1127 | spi.write(b14_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1128 | spi.write(b14_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1129 | spi.write(b14_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1130 | spi.write(b14_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1131 | spi.write(b14_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1132 | spi.write(b14_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1133 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 1134 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1135 | spi.write(g15_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1136 | spi.write(g15_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1137 | spi.write(g15_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1138 | spi.write(g15_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1139 | spi.write(g15_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1140 | spi.write(g15_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1141 | spi.write(g15_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1142 | spi.write(g15_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1143 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1144 | spi.write(r15_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1145 | spi.write(r15_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1146 | spi.write(r15_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1147 | spi.write(r15_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1148 | spi.write(r15_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1149 | spi.write(r15_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1150 | spi.write(r15_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1151 | spi.write(r15_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1152 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1153 | spi.write(b15_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1154 | spi.write(b15_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1155 | spi.write(b15_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1156 | spi.write(b15_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1157 | spi.write(b15_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1158 | spi.write(b15_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1159 | spi.write(b15_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1160 | spi.write(b15_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1161 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 1162 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1163 | spi.write(g16_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1164 | spi.write(g16_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1165 | spi.write(g16_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1166 | spi.write(g16_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1167 | spi.write(g16_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1168 | spi.write(g16_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1169 | spi.write(g16_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1170 | spi.write(g16_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1171 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1172 | spi.write(r16_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1173 | spi.write(r16_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1174 | spi.write(r16_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1175 | spi.write(r16_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1176 | spi.write(r16_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1177 | spi.write(r16_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1178 | spi.write(r16_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1179 | spi.write(r16_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1180 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1181 | spi.write(b16_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1182 | spi.write(b16_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1183 | spi.write(b16_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1184 | spi.write(b16_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1185 | spi.write(b16_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1186 | spi.write(b16_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1187 | spi.write(b16_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1188 | spi.write(b16_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1189 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 1190 | //set green bits |
ivanyohuno | 0:c350fa2f0c19 | 1191 | spi.write(g17_array[7]); //set g7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1192 | spi.write(g17_array[6]); //set g6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1193 | spi.write(g17_array[5]); //set g5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1194 | spi.write(g17_array[4]); //set g4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1195 | spi.write(g17_array[3]); //set g3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1196 | spi.write(g17_array[2]); //set g2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1197 | spi.write(g17_array[1]); //set g1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1198 | spi.write(g17_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1199 | //set red bits |
ivanyohuno | 0:c350fa2f0c19 | 1200 | spi.write(r17_array[7]);//set r7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1201 | spi.write(r17_array[6]); //set r6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1202 | spi.write(r17_array[5]); //set r5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1203 | spi.write(r17_array[4]); //set r4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1204 | spi.write(r17_array[3]); //set r3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1205 | spi.write(r17_array[2]); //set r2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1206 | spi.write(r17_array[1]); //set r1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1207 | spi.write(r17_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1208 | //set blue bits |
ivanyohuno | 0:c350fa2f0c19 | 1209 | spi.write(b17_array[7]); //set b7 bit |
ivanyohuno | 0:c350fa2f0c19 | 1210 | spi.write(b17_array[6]); //set b6 bit |
ivanyohuno | 0:c350fa2f0c19 | 1211 | spi.write(b17_array[5]); //set b5 bit |
ivanyohuno | 0:c350fa2f0c19 | 1212 | spi.write(b17_array[4]); //set b4 bit |
ivanyohuno | 0:c350fa2f0c19 | 1213 | spi.write(b17_array[3]); //set b3 bit |
ivanyohuno | 0:c350fa2f0c19 | 1214 | spi.write(b17_array[2]); //set b2 bit |
ivanyohuno | 0:c350fa2f0c19 | 1215 | spi.write(b17_array[1]); //set b1 bit |
ivanyohuno | 0:c350fa2f0c19 | 1216 | spi.write(b17_array[0]); //set b0 bit |
ivanyohuno | 1:42b43fa7362f | 1217 | |
ivanyohuno | 1:42b43fa7362f | 1218 | //wait for latch |
ivanyohuno | 1:42b43fa7362f | 1219 | wait_us(60); |
ivanyohuno | 1:42b43fa7362f | 1220 | } |
ivanyohuno | 1:42b43fa7362f | 1221 | |
ivanyohuno | 1:42b43fa7362f | 1222 | void setRGBFloor_2(int room3[8][3], int room4[8][3]){ |
ivanyohuno | 1:42b43fa7362f | 1223 | //translate int values to array of 0xF00 (0) and 0xFF0 (1) binary |
ivanyohuno | 2:35fd99de07b3 | 1224 | //room3 |
ivanyohuno | 1:42b43fa7362f | 1225 | int r00_array[8]; //LED0 |
ivanyohuno | 1:42b43fa7362f | 1226 | int g00_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1227 | int b00_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1228 | memcpy(r00_array, decimalToBinary(room3[0][0]), sizeof(r00_array)); |
ivanyohuno | 1:42b43fa7362f | 1229 | memcpy(g00_array, decimalToBinary(room3[0][1]), sizeof(g00_array)); |
ivanyohuno | 1:42b43fa7362f | 1230 | memcpy(b00_array, decimalToBinary(room3[0][2]), sizeof(b00_array)); |
ivanyohuno | 1:42b43fa7362f | 1231 | int r01_array[8]; //LED1 |
ivanyohuno | 1:42b43fa7362f | 1232 | int g01_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1233 | int b01_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1234 | memcpy(r01_array, decimalToBinary(room3[1][0]), sizeof(r01_array)); |
ivanyohuno | 1:42b43fa7362f | 1235 | memcpy(g01_array, decimalToBinary(room3[1][1]), sizeof(g01_array)); |
ivanyohuno | 1:42b43fa7362f | 1236 | memcpy(b01_array, decimalToBinary(room3[1][2]), sizeof(b01_array)); |
ivanyohuno | 1:42b43fa7362f | 1237 | int r02_array[8]; //LED2 |
ivanyohuno | 1:42b43fa7362f | 1238 | int g02_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1239 | int b02_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1240 | memcpy(r02_array, decimalToBinary(room3[2][0]), sizeof(r02_array)); |
ivanyohuno | 1:42b43fa7362f | 1241 | memcpy(g02_array, decimalToBinary(room3[2][1]), sizeof(g02_array)); |
ivanyohuno | 1:42b43fa7362f | 1242 | memcpy(b02_array, decimalToBinary(room3[2][2]), sizeof(b02_array)); |
ivanyohuno | 1:42b43fa7362f | 1243 | int r03_array[8]; //LED3 |
ivanyohuno | 1:42b43fa7362f | 1244 | int g03_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1245 | int b03_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1246 | memcpy(r03_array, decimalToBinary(room3[3][0]), sizeof(r03_array)); |
ivanyohuno | 1:42b43fa7362f | 1247 | memcpy(g03_array, decimalToBinary(room3[3][1]), sizeof(g03_array)); |
ivanyohuno | 1:42b43fa7362f | 1248 | memcpy(b03_array, decimalToBinary(room3[3][2]), sizeof(b03_array)); |
ivanyohuno | 1:42b43fa7362f | 1249 | int r04_array[8]; //LED4 |
ivanyohuno | 1:42b43fa7362f | 1250 | int g04_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1251 | int b04_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1252 | memcpy(r04_array, decimalToBinary(room3[4][0]), sizeof(r04_array)); |
ivanyohuno | 1:42b43fa7362f | 1253 | memcpy(g04_array, decimalToBinary(room3[4][1]), sizeof(g04_array)); |
ivanyohuno | 1:42b43fa7362f | 1254 | memcpy(b04_array, decimalToBinary(room3[4][2]), sizeof(b04_array)); |
ivanyohuno | 1:42b43fa7362f | 1255 | int r05_array[8]; //LED5 |
ivanyohuno | 1:42b43fa7362f | 1256 | int g05_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1257 | int b05_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1258 | memcpy(r05_array, decimalToBinary(room3[5][0]), sizeof(r05_array)); |
ivanyohuno | 1:42b43fa7362f | 1259 | memcpy(g05_array, decimalToBinary(room3[5][1]), sizeof(g05_array)); |
ivanyohuno | 1:42b43fa7362f | 1260 | memcpy(b05_array, decimalToBinary(room3[5][2]), sizeof(b05_array)); |
ivanyohuno | 1:42b43fa7362f | 1261 | int r06_array[8]; //LED6 |
ivanyohuno | 1:42b43fa7362f | 1262 | int g06_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1263 | int b06_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1264 | memcpy(r06_array, decimalToBinary(room3[6][0]), sizeof(r06_array)); |
ivanyohuno | 1:42b43fa7362f | 1265 | memcpy(g06_array, decimalToBinary(room3[6][1]), sizeof(g06_array)); |
ivanyohuno | 1:42b43fa7362f | 1266 | memcpy(b06_array, decimalToBinary(room3[6][2]), sizeof(b06_array)); |
ivanyohuno | 1:42b43fa7362f | 1267 | int r07_array[8]; //LED7 |
ivanyohuno | 1:42b43fa7362f | 1268 | int g07_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1269 | int b07_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1270 | memcpy(r07_array, decimalToBinary(room3[7][0]), sizeof(r07_array)); |
ivanyohuno | 1:42b43fa7362f | 1271 | memcpy(g07_array, decimalToBinary(room3[7][1]), sizeof(g07_array)); |
ivanyohuno | 1:42b43fa7362f | 1272 | memcpy(b07_array, decimalToBinary(room3[7][2]), sizeof(b07_array)); |
ivanyohuno | 1:42b43fa7362f | 1273 | |
ivanyohuno | 1:42b43fa7362f | 1274 | //room4 |
ivanyohuno | 1:42b43fa7362f | 1275 | int r10_array[8]; //LED0 |
ivanyohuno | 1:42b43fa7362f | 1276 | int g10_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1277 | int b10_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1278 | memcpy(r10_array, decimalToBinary(room4[0][0]), sizeof(r10_array)); |
ivanyohuno | 1:42b43fa7362f | 1279 | memcpy(g10_array, decimalToBinary(room4[0][1]), sizeof(g10_array)); |
ivanyohuno | 1:42b43fa7362f | 1280 | memcpy(b10_array, decimalToBinary(room4[0][2]), sizeof(b10_array)); |
ivanyohuno | 1:42b43fa7362f | 1281 | int r11_array[8]; //LED1 |
ivanyohuno | 1:42b43fa7362f | 1282 | int g11_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1283 | int b11_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1284 | memcpy(r11_array, decimalToBinary(room4[1][0]), sizeof(r11_array)); |
ivanyohuno | 1:42b43fa7362f | 1285 | memcpy(g11_array, decimalToBinary(room4[1][1]), sizeof(g11_array)); |
ivanyohuno | 1:42b43fa7362f | 1286 | memcpy(b11_array, decimalToBinary(room4[1][2]), sizeof(b11_array)); |
ivanyohuno | 1:42b43fa7362f | 1287 | int r12_array[8]; //LED2 |
ivanyohuno | 1:42b43fa7362f | 1288 | int g12_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1289 | int b12_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1290 | memcpy(r12_array, decimalToBinary(room4[2][0]), sizeof(r12_array)); |
ivanyohuno | 1:42b43fa7362f | 1291 | memcpy(g12_array, decimalToBinary(room4[2][1]), sizeof(g12_array)); |
ivanyohuno | 1:42b43fa7362f | 1292 | memcpy(b12_array, decimalToBinary(room4[2][2]), sizeof(b12_array)); |
ivanyohuno | 1:42b43fa7362f | 1293 | int r13_array[8]; //LED3 |
ivanyohuno | 1:42b43fa7362f | 1294 | int g13_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1295 | int b13_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1296 | memcpy(r13_array, decimalToBinary(room4[3][0]), sizeof(r13_array)); |
ivanyohuno | 1:42b43fa7362f | 1297 | memcpy(g13_array, decimalToBinary(room4[3][1]), sizeof(g13_array)); |
ivanyohuno | 1:42b43fa7362f | 1298 | memcpy(b13_array, decimalToBinary(room4[3][2]), sizeof(b13_array)); |
ivanyohuno | 1:42b43fa7362f | 1299 | int r14_array[8]; //LED4 |
ivanyohuno | 1:42b43fa7362f | 1300 | int g14_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1301 | int b14_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1302 | memcpy(r14_array, decimalToBinary(room4[4][0]), sizeof(r14_array)); |
ivanyohuno | 1:42b43fa7362f | 1303 | memcpy(g14_array, decimalToBinary(room4[4][1]), sizeof(g14_array)); |
ivanyohuno | 1:42b43fa7362f | 1304 | memcpy(b14_array, decimalToBinary(room4[4][2]), sizeof(b14_array)); |
ivanyohuno | 1:42b43fa7362f | 1305 | int r15_array[8]; //LED5 |
ivanyohuno | 1:42b43fa7362f | 1306 | int g15_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1307 | int b15_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1308 | memcpy(r15_array, decimalToBinary(room4[5][0]), sizeof(r15_array)); |
ivanyohuno | 1:42b43fa7362f | 1309 | memcpy(g15_array, decimalToBinary(room4[5][1]), sizeof(g15_array)); |
ivanyohuno | 1:42b43fa7362f | 1310 | memcpy(b15_array, decimalToBinary(room4[5][2]), sizeof(b15_array)); |
ivanyohuno | 1:42b43fa7362f | 1311 | int r16_array[8]; //LED6 |
ivanyohuno | 1:42b43fa7362f | 1312 | int g16_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1313 | int b16_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1314 | memcpy(r16_array, decimalToBinary(room4[6][0]), sizeof(r16_array)); |
ivanyohuno | 1:42b43fa7362f | 1315 | memcpy(g16_array, decimalToBinary(room4[6][1]), sizeof(g16_array)); |
ivanyohuno | 1:42b43fa7362f | 1316 | memcpy(b16_array, decimalToBinary(room4[6][2]), sizeof(b16_array)); |
ivanyohuno | 1:42b43fa7362f | 1317 | int r17_array[8]; //LED7 |
ivanyohuno | 1:42b43fa7362f | 1318 | int g17_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1319 | int b17_array[8]; |
ivanyohuno | 1:42b43fa7362f | 1320 | memcpy(r17_array, decimalToBinary(room4[7][0]), sizeof(r17_array)); |
ivanyohuno | 1:42b43fa7362f | 1321 | memcpy(g17_array, decimalToBinary(room4[7][1]), sizeof(g17_array)); |
ivanyohuno | 1:42b43fa7362f | 1322 | memcpy(b17_array, decimalToBinary(room4[7][2]), sizeof(b17_array)); |
ivanyohuno | 1:42b43fa7362f | 1323 | |
ivanyohuno | 1:42b43fa7362f | 1324 | //send commands to LED Driver |
ivanyohuno | 1:42b43fa7362f | 1325 | //initialize SPI |
ivanyohuno | 1:42b43fa7362f | 1326 | spi_init(); |
ivanyohuno | 0:c350fa2f0c19 | 1327 | //room3 |
ivanyohuno | 0:c350fa2f0c19 | 1328 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 1329 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1330 | spi2.write(g00_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1331 | spi2.write(g00_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1332 | spi2.write(g00_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1333 | spi2.write(g00_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1334 | spi2.write(g00_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1335 | spi2.write(g00_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1336 | spi2.write(g00_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1337 | spi2.write(g00_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1338 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1339 | spi2.write(r00_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1340 | spi2.write(r00_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1341 | spi2.write(r00_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1342 | spi2.write(r00_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1343 | spi2.write(r00_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1344 | spi2.write(r00_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1345 | spi2.write(r00_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1346 | spi2.write(r00_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1347 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1348 | spi2.write(b00_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1349 | spi2.write(b00_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1350 | spi2.write(b00_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1351 | spi2.write(b00_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1352 | spi2.write(b00_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1353 | spi2.write(b00_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1354 | spi2.write(b00_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1355 | spi2.write(b00_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1356 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 1357 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1358 | spi2.write(g01_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1359 | spi2.write(g01_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1360 | spi2.write(g01_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1361 | spi2.write(g01_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1362 | spi2.write(g01_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1363 | spi2.write(g01_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1364 | spi2.write(g01_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1365 | spi2.write(g01_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1366 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1367 | spi2.write(r01_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1368 | spi2.write(r01_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1369 | spi2.write(r01_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1370 | spi2.write(r01_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1371 | spi2.write(r01_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1372 | spi2.write(r01_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1373 | spi2.write(r01_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1374 | spi2.write(r01_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1375 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1376 | spi2.write(b01_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1377 | spi2.write(b01_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1378 | spi2.write(b01_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1379 | spi2.write(b01_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1380 | spi2.write(b01_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1381 | spi2.write(b01_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1382 | spi2.write(b01_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1383 | spi2.write(b01_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1384 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 1385 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1386 | spi2.write(g02_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1387 | spi2.write(g02_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1388 | spi2.write(g02_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1389 | spi2.write(g02_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1390 | spi2.write(g02_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1391 | spi2.write(g02_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1392 | spi2.write(g02_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1393 | spi2.write(g02_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1394 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1395 | spi2.write(r02_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1396 | spi2.write(r02_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1397 | spi2.write(r02_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1398 | spi2.write(r02_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1399 | spi2.write(r02_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1400 | spi2.write(r02_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1401 | spi2.write(r02_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1402 | spi2.write(r02_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1403 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1404 | spi2.write(b02_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1405 | spi2.write(b02_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1406 | spi2.write(b02_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1407 | spi2.write(b02_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1408 | spi2.write(b02_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1409 | spi2.write(b02_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1410 | spi2.write(b02_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1411 | spi2.write(b02_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1412 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 1413 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1414 | spi2.write(g03_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1415 | spi2.write(g03_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1416 | spi2.write(g03_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1417 | spi2.write(g03_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1418 | spi2.write(g03_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1419 | spi2.write(g03_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1420 | spi2.write(g03_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1421 | spi2.write(g03_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1422 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1423 | spi2.write(r03_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1424 | spi2.write(r03_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1425 | spi2.write(r03_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1426 | spi2.write(r03_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1427 | spi2.write(r03_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1428 | spi2.write(r03_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1429 | spi2.write(r03_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1430 | spi2.write(r03_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1431 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1432 | spi2.write(b03_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1433 | spi2.write(b03_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1434 | spi2.write(b03_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1435 | spi2.write(b03_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1436 | spi2.write(b03_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1437 | spi2.write(b03_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1438 | spi2.write(b03_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1439 | spi2.write(b03_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1440 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 1441 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1442 | spi2.write(g04_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1443 | spi2.write(g04_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1444 | spi2.write(g04_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1445 | spi2.write(g04_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1446 | spi2.write(g04_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1447 | spi2.write(g04_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1448 | spi2.write(g04_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1449 | spi2.write(g04_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1450 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1451 | spi2.write(r04_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1452 | spi2.write(r04_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1453 | spi2.write(r04_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1454 | spi2.write(r04_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1455 | spi2.write(r04_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1456 | spi2.write(r04_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1457 | spi2.write(r04_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1458 | spi2.write(r04_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1459 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1460 | spi2.write(b04_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1461 | spi2.write(b04_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1462 | spi2.write(b04_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1463 | spi2.write(b04_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1464 | spi2.write(b04_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1465 | spi2.write(b04_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1466 | spi2.write(b04_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1467 | spi2.write(b04_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1468 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 1469 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1470 | spi2.write(g05_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1471 | spi2.write(g05_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1472 | spi2.write(g05_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1473 | spi2.write(g05_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1474 | spi2.write(g05_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1475 | spi2.write(g05_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1476 | spi2.write(g05_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1477 | spi2.write(g05_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1478 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1479 | spi2.write(r05_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1480 | spi2.write(r05_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1481 | spi2.write(r05_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1482 | spi2.write(r05_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1483 | spi2.write(r05_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1484 | spi2.write(r05_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1485 | spi2.write(r05_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1486 | spi2.write(r05_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1487 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1488 | spi2.write(b05_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1489 | spi2.write(b05_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1490 | spi2.write(b05_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1491 | spi2.write(b05_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1492 | spi2.write(b05_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1493 | spi2.write(b05_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1494 | spi2.write(b05_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1495 | spi2.write(b05_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1496 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 1497 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1498 | spi2.write(g06_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1499 | spi2.write(g06_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1500 | spi2.write(g06_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1501 | spi2.write(g06_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1502 | spi2.write(g06_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1503 | spi2.write(g06_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1504 | spi2.write(g06_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1505 | spi2.write(g06_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1506 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1507 | spi2.write(r06_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1508 | spi2.write(r06_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1509 | spi2.write(r06_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1510 | spi2.write(r06_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1511 | spi2.write(r06_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1512 | spi2.write(r06_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1513 | spi2.write(r06_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1514 | spi2.write(r06_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1515 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1516 | spi2.write(b06_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1517 | spi2.write(b06_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1518 | spi2.write(b06_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1519 | spi2.write(b06_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1520 | spi2.write(b06_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1521 | spi2.write(b06_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1522 | spi2.write(b06_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1523 | spi2.write(b06_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1524 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 1525 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1526 | spi2.write(g07_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1527 | spi2.write(g07_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1528 | spi2.write(g07_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1529 | spi2.write(g07_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1530 | spi2.write(g07_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1531 | spi2.write(g07_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1532 | spi2.write(g07_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1533 | spi2.write(g07_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1534 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1535 | spi2.write(r07_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1536 | spi2.write(r07_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1537 | spi2.write(r07_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1538 | spi2.write(r07_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1539 | spi2.write(r07_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1540 | spi2.write(r07_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1541 | spi2.write(r07_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1542 | spi2.write(r07_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1543 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1544 | spi2.write(b07_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1545 | spi2.write(b07_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1546 | spi2.write(b07_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1547 | spi2.write(b07_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1548 | spi2.write(b07_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1549 | spi2.write(b07_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1550 | spi2.write(b07_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1551 | spi2.write(b07_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1552 | //room4 |
ivanyohuno | 0:c350fa2f0c19 | 1553 | //LED0 |
ivanyohuno | 0:c350fa2f0c19 | 1554 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1555 | spi2.write(g10_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1556 | spi2.write(g10_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1557 | spi2.write(g10_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1558 | spi2.write(g10_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1559 | spi2.write(g10_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1560 | spi2.write(g10_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1561 | spi2.write(g10_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1562 | spi2.write(g10_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1563 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1564 | spi2.write(r10_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1565 | spi2.write(r10_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1566 | spi2.write(r10_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1567 | spi2.write(r10_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1568 | spi2.write(r10_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1569 | spi2.write(r10_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1570 | spi2.write(r10_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1571 | spi2.write(r10_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1572 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1573 | spi2.write(b10_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1574 | spi2.write(b10_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1575 | spi2.write(b10_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1576 | spi2.write(b10_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1577 | spi2.write(b10_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1578 | spi2.write(b10_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1579 | spi2.write(b10_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1580 | spi2.write(b10_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1581 | //LED1 |
ivanyohuno | 0:c350fa2f0c19 | 1582 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1583 | spi2.write(g11_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1584 | spi2.write(g11_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1585 | spi2.write(g11_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1586 | spi2.write(g11_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1587 | spi2.write(g11_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1588 | spi2.write(g11_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1589 | spi2.write(g11_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1590 | spi2.write(g11_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1591 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1592 | spi2.write(r11_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1593 | spi2.write(r11_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1594 | spi2.write(r11_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1595 | spi2.write(r11_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1596 | spi2.write(r11_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1597 | spi2.write(r11_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1598 | spi2.write(r11_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1599 | spi2.write(r11_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1600 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1601 | spi2.write(b11_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1602 | spi2.write(b11_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1603 | spi2.write(b11_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1604 | spi2.write(b11_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1605 | spi2.write(b11_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1606 | spi2.write(b11_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1607 | spi2.write(b11_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1608 | spi2.write(b11_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1609 | //LED2 |
ivanyohuno | 0:c350fa2f0c19 | 1610 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1611 | spi2.write(g12_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1612 | spi2.write(g12_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1613 | spi2.write(g12_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1614 | spi2.write(g12_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1615 | spi2.write(g12_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1616 | spi2.write(g12_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1617 | spi2.write(g12_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1618 | spi2.write(g12_array[0]);//set g0 bit |
ivanyohuno | 2:35fd99de07b3 | 1619 | //s2et red bits |
ivanyohuno | 2:35fd99de07b3 | 1620 | spi2.write(r12_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1621 | spi2.write(r12_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1622 | spi2.write(r12_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1623 | spi2.write(r12_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1624 | spi2.write(r12_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1625 | spi2.write(r12_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1626 | spi2.write(r12_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1627 | spi2.write(r12_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1628 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1629 | spi2.write(b12_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1630 | spi2.write(b12_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1631 | spi2.write(b12_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1632 | spi2.write(b12_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1633 | spi2.write(b12_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1634 | spi2.write(b12_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1635 | spi2.write(b12_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1636 | spi2.write(b12_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1637 | //LED3 |
ivanyohuno | 0:c350fa2f0c19 | 1638 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1639 | spi2.write(g13_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1640 | spi2.write(g13_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1641 | spi2.write(g13_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1642 | spi2.write(g13_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1643 | spi2.write(g13_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1644 | spi2.write(g13_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1645 | spi2.write(g13_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1646 | spi2.write(g13_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1647 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1648 | spi2.write(r13_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1649 | spi2.write(r13_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1650 | spi2.write(r13_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1651 | spi2.write(r13_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1652 | spi2.write(r13_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1653 | spi2.write(r13_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1654 | spi2.write(r13_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1655 | spi2.write(r13_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1656 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1657 | spi2.write(b13_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1658 | spi2.write(b13_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1659 | spi2.write(b13_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1660 | spi2.write(b13_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1661 | spi2.write(b13_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1662 | spi2.write(b13_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1663 | spi2.write(b13_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1664 | spi2.write(b13_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1665 | //LED4 |
ivanyohuno | 0:c350fa2f0c19 | 1666 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1667 | spi2.write(g14_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1668 | spi2.write(g14_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1669 | spi2.write(g14_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1670 | spi2.write(g14_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1671 | spi2.write(g14_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1672 | spi2.write(g14_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1673 | spi2.write(g14_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1674 | spi2.write(g14_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1675 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1676 | spi2.write(r14_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1677 | spi2.write(r14_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1678 | spi2.write(r14_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1679 | spi2.write(r14_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1680 | spi2.write(r14_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1681 | spi2.write(r14_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1682 | spi2.write(r14_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1683 | spi2.write(r14_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1684 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1685 | spi2.write(b14_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1686 | spi2.write(b14_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1687 | spi2.write(b14_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1688 | spi2.write(b14_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1689 | spi2.write(b14_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1690 | spi2.write(b14_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1691 | spi2.write(b14_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1692 | spi2.write(b14_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1693 | //LED5 |
ivanyohuno | 0:c350fa2f0c19 | 1694 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1695 | spi2.write(g15_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1696 | spi2.write(g15_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1697 | spi2.write(g15_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1698 | spi2.write(g15_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1699 | spi2.write(g15_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1700 | spi2.write(g15_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1701 | spi2.write(g15_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1702 | spi2.write(g15_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1703 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1704 | spi2.write(r15_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1705 | spi2.write(r15_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1706 | spi2.write(r15_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1707 | spi2.write(r15_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1708 | spi2.write(r15_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1709 | spi2.write(r15_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1710 | spi2.write(r15_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1711 | spi2.write(r15_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1712 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1713 | spi2.write(b15_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1714 | spi2.write(b15_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1715 | spi2.write(b15_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1716 | spi2.write(b15_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1717 | spi2.write(b15_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1718 | spi2.write(b15_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1719 | spi2.write(b15_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1720 | spi2.write(b15_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1721 | //LED6 |
ivanyohuno | 0:c350fa2f0c19 | 1722 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1723 | spi2.write(g16_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1724 | spi2.write(g16_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1725 | spi2.write(g16_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1726 | spi2.write(g16_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1727 | spi2.write(g16_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1728 | spi2.write(g16_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1729 | spi2.write(g16_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1730 | spi2.write(g16_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1731 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1732 | spi2.write(r16_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1733 | spi2.write(r16_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1734 | spi2.write(r16_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1735 | spi2.write(r16_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1736 | spi2.write(r16_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1737 | spi2.write(r16_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1738 | spi2.write(r16_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1739 | spi2.write(r16_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1740 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1741 | spi2.write(b16_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1742 | spi2.write(b16_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1743 | spi2.write(b16_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1744 | spi2.write(b16_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1745 | spi2.write(b16_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1746 | spi2.write(b16_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1747 | spi2.write(b16_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1748 | spi2.write(b16_array[0]); //set b0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1749 | //LED7 |
ivanyohuno | 0:c350fa2f0c19 | 1750 | //set green bits |
ivanyohuno | 2:35fd99de07b3 | 1751 | spi2.write(g17_array[7]); //set g7 bit |
ivanyohuno | 2:35fd99de07b3 | 1752 | spi2.write(g17_array[6]); //set g6 bit |
ivanyohuno | 2:35fd99de07b3 | 1753 | spi2.write(g17_array[5]); //set g5 bit |
ivanyohuno | 2:35fd99de07b3 | 1754 | spi2.write(g17_array[4]); //set g4 bit |
ivanyohuno | 2:35fd99de07b3 | 1755 | spi2.write(g17_array[3]); //set g3 bit |
ivanyohuno | 2:35fd99de07b3 | 1756 | spi2.write(g17_array[2]); //set g2 bit |
ivanyohuno | 2:35fd99de07b3 | 1757 | spi2.write(g17_array[1]); //set g1 bit |
ivanyohuno | 2:35fd99de07b3 | 1758 | spi2.write(g17_array[0]);//set g0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1759 | //set red bits |
ivanyohuno | 2:35fd99de07b3 | 1760 | spi2.write(r17_array[7]);//set r7 bit |
ivanyohuno | 2:35fd99de07b3 | 1761 | spi2.write(r17_array[6]); //set r6 bit |
ivanyohuno | 2:35fd99de07b3 | 1762 | spi2.write(r17_array[5]); //set r5 bit |
ivanyohuno | 2:35fd99de07b3 | 1763 | spi2.write(r17_array[4]); //set r4 bit |
ivanyohuno | 2:35fd99de07b3 | 1764 | spi2.write(r17_array[3]); //set r3 bit |
ivanyohuno | 2:35fd99de07b3 | 1765 | spi2.write(r17_array[2]); //set r2 bit |
ivanyohuno | 2:35fd99de07b3 | 1766 | spi2.write(r17_array[1]); //set r1 bit |
ivanyohuno | 2:35fd99de07b3 | 1767 | spi2.write(r17_array[0]); //set r0 bit |
ivanyohuno | 0:c350fa2f0c19 | 1768 | //set blue bits |
ivanyohuno | 2:35fd99de07b3 | 1769 | spi2.write(b17_array[7]); //set b7 bit |
ivanyohuno | 2:35fd99de07b3 | 1770 | spi2.write(b17_array[6]); //set b6 bit |
ivanyohuno | 2:35fd99de07b3 | 1771 | spi2.write(b17_array[5]); //set b5 bit |
ivanyohuno | 2:35fd99de07b3 | 1772 | spi2.write(b17_array[4]); //set b4 bit |
ivanyohuno | 2:35fd99de07b3 | 1773 | spi2.write(b17_array[3]); //set b3 bit |
ivanyohuno | 2:35fd99de07b3 | 1774 | spi2.write(b17_array[2]); //set b2 bit |
ivanyohuno | 2:35fd99de07b3 | 1775 | spi2.write(b17_array[1]); //set b1 bit |
ivanyohuno | 2:35fd99de07b3 | 1776 | spi2.write(b17_array[0]); //set b0 bit |
ivanyohuno | 1:42b43fa7362f | 1777 | |
ivanyohuno | 0:c350fa2f0c19 | 1778 | //wait for latch |
ivanyohuno | 0:c350fa2f0c19 | 1779 | wait_us(60); |
ivanyohuno | 0:c350fa2f0c19 | 1780 | } |
ivanyohuno | 0:c350fa2f0c19 | 1781 | |
ivanyohuno | 0:c350fa2f0c19 | 1782 | int * decimalToBinary(int n) // converts decimal value to 8 bit array of 1's (0xFF0) and 0's (0xF00) |
ivanyohuno | 0:c350fa2f0c19 | 1783 | { |
ivanyohuno | 0:c350fa2f0c19 | 1784 | int reminder; |
ivanyohuno | 0:c350fa2f0c19 | 1785 | int i=0; |
ivanyohuno | 0:c350fa2f0c19 | 1786 | int static binary[8]; //initialize to 00000000 |
ivanyohuno | 0:c350fa2f0c19 | 1787 | while (n!=0) |
ivanyohuno | 0:c350fa2f0c19 | 1788 | { |
ivanyohuno | 0:c350fa2f0c19 | 1789 | reminder=n%2; |
ivanyohuno | 0:c350fa2f0c19 | 1790 | if(reminder == 1){ |
ivanyohuno | 0:c350fa2f0c19 | 1791 | binary[i] = 0xFF0; |
ivanyohuno | 0:c350fa2f0c19 | 1792 | } |
ivanyohuno | 0:c350fa2f0c19 | 1793 | if(reminder == 0){ |
ivanyohuno | 0:c350fa2f0c19 | 1794 | binary[i] = 0xF00; |
ivanyohuno | 0:c350fa2f0c19 | 1795 | } |
ivanyohuno | 0:c350fa2f0c19 | 1796 | n = n/2; |
ivanyohuno | 0:c350fa2f0c19 | 1797 | i++; |
ivanyohuno | 0:c350fa2f0c19 | 1798 | } |
ivanyohuno | 0:c350fa2f0c19 | 1799 | //sets the remainder of the digits to 0xF00 if n reaches 0 before i = 7 |
ivanyohuno | 0:c350fa2f0c19 | 1800 | for(;i<8;i++){ |
ivanyohuno | 0:c350fa2f0c19 | 1801 | binary[i] = 0xF00; |
ivanyohuno | 0:c350fa2f0c19 | 1802 | } |
ivanyohuno | 0:c350fa2f0c19 | 1803 | return binary; |
ivanyohuno | 0:c350fa2f0c19 | 1804 | } |
ivanyohuno | 0:c350fa2f0c19 | 1805 | |
ivanyohuno | 0:c350fa2f0c19 | 1806 | void spi_init(){ //initializes spi port to send 0 bit length |
ivanyohuno | 2:35fd99de07b3 | 1807 | spi.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 |
ivanyohuno | 2:35fd99de07b3 | 1808 | spi.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length |
ivanyohuno | 1:42b43fa7362f | 1809 | spi2.format(14, 0); //set spi at 14 bits/byte with clock phase and clock polarity at mode 0 |
ivanyohuno | 1:42b43fa7362f | 1810 | spi2.frequency(10600000); //set frequency of spi clock at 96/9 - 10.6MHz 94.3 ns bit time length |
ivanyohuno | 1:42b43fa7362f | 1811 | |
ivanyohuno | 0:c350fa2f0c19 | 1812 | } |
ivanyohuno | 0:c350fa2f0c19 | 1813 |