mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
corrected the source to exactly match the protocol of the APA 102 LED's
Former-commit-id: 10d097ff4bbcfa3c717c72138ea0cb1d9e629565
This commit is contained in:
parent
57c5c1ecf5
commit
cf359e5182
BIN
dependencies/LightberryHDUSBAPA1021.1.zip
vendored
BIN
dependencies/LightberryHDUSBAPA1021.1.zip
vendored
Binary file not shown.
@ -135,21 +135,19 @@ void setup()
|
|||||||
// green, blue, then off. Once you're confident everything is working
|
// green, blue, then off. Once you're confident everything is working
|
||||||
// end-to-end, it's OK to comment this out and reprogram the Arduino.
|
// end-to-end, it's OK to comment this out and reprogram the Arduino.
|
||||||
uint8_t testcolor[] = { 0, 0, 0, 255, 0, 0 };
|
uint8_t testcolor[] = { 0, 0, 0, 255, 0, 0 };
|
||||||
for(int i=0; i<5; i++){
|
for(int i=0; i<4; i++){ //Start Frame
|
||||||
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); );
|
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); );
|
||||||
}
|
}
|
||||||
for(char n=3; n>=0; n--) {
|
for(char n=3; n>=0; n--) {
|
||||||
for(c=0; c<25000; c++) {
|
for(c=0; c<25000; c++) {
|
||||||
|
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); ); //Brightness byte
|
||||||
for(i=0; i<3; i++) {
|
for(i=0; i<3; i++) {
|
||||||
for(SPDR = testcolor[n + i]; !(SPSR & _BV(SPIF)); );
|
for(SPDR = testcolor[n + i]; !(SPSR & _BV(SPIF)); ); //BGR
|
||||||
}
|
}
|
||||||
for(i=0; i<1; i++) {
|
}
|
||||||
|
for(int i=0; i<4; i++){ //Stop Frame
|
||||||
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); );
|
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for(int i=0; i<16; i++){
|
|
||||||
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); );
|
|
||||||
}
|
|
||||||
delay(1); // One millisecond pause = latch
|
delay(1); // One millisecond pause = latch
|
||||||
digitalWrite(SPI_LED, spi_out_led = !spi_out_led);
|
digitalWrite(SPI_LED, spi_out_led = !spi_out_led);
|
||||||
}
|
}
|
||||||
@ -181,14 +179,18 @@ void setup()
|
|||||||
}
|
}
|
||||||
// If no data received for an extended time, turn off all LEDs.
|
// If no data received for an extended time, turn off all LEDs.
|
||||||
if((t - lastByteTime) > serialTimeout) {
|
if((t - lastByteTime) > serialTimeout) {
|
||||||
for(c=0; c<25000; c++) {
|
for(i=0;i<4;i++) { //Start Frame
|
||||||
for(i=0; i<3; i++) {
|
|
||||||
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); );
|
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); );
|
||||||
}
|
}
|
||||||
for(i=0; i<1; i++) {
|
for(c=0; c<25000; c++) {
|
||||||
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); );
|
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); ); //Brightness Byte
|
||||||
|
for(i=0; i<3; i++) {
|
||||||
|
for(SPDR = 0x00; !(SPSR & _BV(SPIF)); ); //BGR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(i=0;i<4;i++) { //Stop Frame
|
||||||
|
for(SPDR = 0xFF; !(SPSR & _BV(SPIF)); );
|
||||||
|
}
|
||||||
delay(1); // One millisecond pause = latch
|
delay(1); // One millisecond pause = latch
|
||||||
lastByteTime = t; // Reset counter
|
lastByteTime = t; // Reset counter
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user