Commits

Trammell Hudson committed 1f2cdb9 Draft

Add brightness control

Comments (0)

Files changed (1)

 	{
 		if (min != 0)
 		{
-			strcat(scroll_output, numbers[min]);
+			if (min == 15)
+				strcat(scroll_output, "a quarter");
+			else
+				strcat(scroll_output, numbers[min]);
 			strcat(scroll_output, " past ");
 		}
 
 		else
 			strcat(scroll_output, numbers[hour]);
 	} else {
-		strcat(scroll_output, numbers[60-min]);
+		if (min == 45)
+			strcat(scroll_output, "a quarter");
+		else
+			strcat(scroll_output, numbers[60-min]);
 		strcat(scroll_output, " before ");
 		if (hour == 11)
 			strcat(scroll_output, "noon");
 	_delay_ms(10);
 	out(RESET, 1);
 
+	uint8_t bright = 0;
+
 	// We should be good to go
-	lcd_write(0x20, 0x00); // normal operation
+	//lcd_write(0x20, 0x00); // normal operation
+	lcd_write(0x10, 0x00 | bright); // normal operation
 
 	lcd_write(CHAR_RAM | 0, 'A');
 	lcd_write(CHAR_RAM | 1, 'l');
 		if (c != -1)
 		{
 			usb_serial_putchar(c);
+
+			if (c == '-')
+			{
+				if (bright < 7)
+					bright++;
+			} else
+			if (c == '+')
+			{
+				if (bright > 0)
+					bright--;
+			}
+
 			if (c == '\r')
 			{
 				hour = (line[0] - '0') * 10 + (line[1] - '0');
 			} else {
 				line[line_offset++] = c;
 			}
+
+			lcd_write(0x10, 0x00 | bright); // normal operation
 		}
 
 		if (bit_is_clear(TIFR0, OCF0A))