Commits

Trammell Hudson committed ca63b69

chaser

Comments (0)

Files changed (1)

 }
 
 
+
 int main(void)
 {
 	// set for 16 MHz clock, and make sure the LED is off
 	latch();
 
 	uint16_t i;
-	//uint32_t pixels[NUM_LEDS];
+	uint8_t pixels[NUM_LEDS][3];
+	for (i = 0 ; i < NUM_LEDS ; i++)
+		pixels[i][0] = pixels[i][1] = pixels[i][2] = 0;
 	uint16_t iter = 0;
+	uint8_t round = 0;
 
 	while (1)
 	{
 		for (i = 0 ; i < NUM_LEDS ; i++)
 		{
-			//uint32_t c = pixels[i];
-			uint32_t c = i == iter ? 0xFFFFFF : 0;
-
-			uint8_t r = c >> 16;
-			uint8_t g = c >>  8;
-			uint8_t b = c >>  0;
+			//uint8_t r = pixels[i][0];
+			//uint8_t g = pixels[i][1];
+			//uint8_t b = pixels[i][2];
+			uint8_t r = i == iter && round & 4 ? 0xFF : 0;
+			uint8_t g = i == iter && round & 2 ? 0xFF : 0;
+			uint8_t b = i == iter && round & 1 ? 0xFF : 0;
+				
 			send_byte(0x80 | (r >> 1));
 			send_byte(0x80 | (g >> 1));
 			send_byte(0x80 | (b >> 1));
 		}
 
+		latch();
+
 		if (++iter == NUM_LEDS)
+		{
+			round++;
 			iter = 0;
+		}
 
-		latch();
+		for (i = 0 ; i < NUM_LEDS ; i++)
+		{
+			pixels[i][0]++;
+			pixels[i][1]++;
+			pixels[i][2]++;
+		}
+
+		for (i = 0 ; i < 32000 ; i++)
+			asm("nop");
 	}
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.