// Simple DotStar test code by David Selles // Based heavily on (and often copying directly) David Johnson-Davies' code from Technoblogy // http://www.technoblogy.com/show?1Y7J // When talking to DotStar LEDs, // The data consists of: // A start frame of 32 '0' bits. // A 32-bit frame for each LED, specifying the brightness and colour. // An end frame of 32 '1' bits. // The 32-bit frame for each LED consists of: // Three '1' bits. // Five bits specifying the brightness, MSB first. // Eight bits specifying the blue component, MSB first. // Eight bits specifying the green component, MSB first. // Eight bits specifying the red component, MSB first. #include // Pin assignments const int Clk = 7; const int Data = 6; const int Button = 5; // Port Assignments #define LED_port PORTA #define LED_ins PINA #define LED_direction DDRA #define LEDs 4 volatile int ShowDisplay; volatile int Count1 = 0; volatile int Count2 = 0; // Display buffer - sets the brightness and colour of the 4 RGB LEDs // First [LEDs] is # of LEDs, second [4] is for R,G,B, and Brightness uint8_t Display[LEDs][4]; // Software SPI ********************************************** void Write (uint8_t c) { int i=0x80; while (i) { if (c & i) LED_port = LED_port | 1<>1; LED_port = LED_port & ~(1<