Subversion Repositories Code-Repo

Rev

Rev 281 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 281 Rev 282
Line 43... Line 43...
43
    for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
43
    for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
44
        neopixel_data.values[i] = 0x0;
44
        neopixel_data.values[i] = 0x0;
45
    }
45
    }
46
}
46
}
47
 
47
 
48
void NeoPixel_Set(uint8_t index, uint8_t R, uint8_t G, uint8_t B) {
48
void NeoPixel_Set(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier) {
49
    uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
49
    uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
50
    
50
    
-
 
51
    if (G == 0)
51
    neopixel_data.values[(i * 3) + 0] = G;
52
        neopixel_data.values[(i * 3) + 0] = 0;
-
 
53
    else
-
 
54
        neopixel_data.values[(i * 3) + 0] = (G * multiplier) - 1;
-
 
55
    if (R == 0)
52
    neopixel_data.values[(i * 3) + 1] = R;
56
        neopixel_data.values[(i * 3) + 1] = 0;
-
 
57
    else
-
 
58
        neopixel_data.values[(i * 3) + 1] = (R * multiplier) - 1;
-
 
59
    if (B == 0)
53
    neopixel_data.values[(i * 3) + 2] = B;
60
        neopixel_data.values[(i * 3) + 2] = 0;
-
 
61
    else
-
 
62
        neopixel_data.values[(i * 3) + 2] = (B * multiplier) - 1;
54
}
63
}
55
 
64
 
56
void NeoPixel_Or(uint8_t index, uint8_t R, uint8_t G, uint8_t B) {
65
void NeoPixel_Or(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier) {
57
    uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
66
    uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
58
 
67
 
-
 
68
    if (G != 0)
59
    neopixel_data.values[(i * 3) + 0] |= G;
69
        neopixel_data.values[(i * 3) + 0] |= (G * multiplier) - 1;
-
 
70
    if (R != 0)
60
    neopixel_data.values[(i * 3) + 1] |= R;
71
        neopixel_data.values[(i * 3) + 1] |= (R * multiplier) - 1;
-
 
72
    if (B != 0)
61
    neopixel_data.values[(i * 3) + 2] |= B;
73
        neopixel_data.values[(i * 3) + 2] |= (B * multiplier) - 1;
62
}
74
}
63
 
75
 
64
void NeoPixel_Write_All(void) {
76
void NeoPixel_Write_All(void) {
65
    for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
77
    for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
66
        NeoPixel_Write_One(neopixel_data.values[i]);
78
        NeoPixel_Write_One(neopixel_data.values[i]);