Commits

Trammell Hudson committed 69f1d6a

White pulse

Comments (0)

Files changed (1)

 #include "usb_debug_only.h"
 #include "print.h"
 
+#include "font-small.c"
+
 
 // Teensy 2.0: LED is active high
 #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__)
 		uint8_t j;
 		for (j = 0 ; j < 3 ; j++)
 		{
-			uint16_t v = (p[j] * (uint16_t) 31) / 32;
+			uint16_t v = (p[j] * (uint16_t) 0) / 4;
 			if (v > 0xFF)
 				v = 0xFF;
 			p[j] = v;
 	}
 }
 
-struct sprite
+
+#define ROWS 10
+#define COLS 15
+
+static void render_char(uint8_t x, char c)
 {
-	int16_t pos;
-	int16_t v;
-	uint8_t r;
-	uint8_t b;
-	uint8_t g;
-};
+	for (uint8_t r = 0 ; r < ROWS ; r++)
+	{
+		uint8_t bits = font_small.bitmap[c + (r << 7)];
+		uint8_t * p = pixels[x + (r * COLS)];
 
+		for (uint8_t i = 0 ; i < 8 ; i++, p += 3, bits >>= 1)
+		{
+			const uint8_t bit = bits & 1;
+			p[0] = bit ? 0xFF : 0;
+			p[1] = bit ? 0xFF : 0;
+			p[2] = bit ? 0xFF : 0;
+		}
+	}
+}
 
 
 int main(void)
 		pixels[i][0] = pixels[i][1] = pixels[i][2] = 0xFF;
 	send_pixels();
 
+	uint8_t x = 0;
+	int dir = 1;
+
+	while (1)
+	{
+		memset(pixels, x, sizeof(pixels));
+		if (dir)
+		{
+			x++;
+			if (x == 0xFF)
+				dir = 0;
+		} else {
+			x--;
+			if (x == 0x10)
+				dir = 1;
+		}
+
+		send_pixels();
+		fade_pixels();
+	}
+
 
 	while (1)
 	{