Commits

Trammell Hudson committed 048bb25 Draft

countdown mode

Comments (0)

Files changed (1)

         OCR0A = 244;
         sbi(TIFR0, OCF0A); // reset the overflow bit
 
-
+#ifdef CONFIG_USB
 	while (!usb_configured())
 		;
 
 	usb_serial_flush_input();
 
 	send_str(PSTR("seven segment\r\n"));
+#endif
+
 	DDRC = 1 << 7;
 	PORTC = 0;
 
 	outputs[2] = digits[2];
 	outputs[3] = digits[3];
 
+	uint32_t ticks = 0;
+
 	for (uint16_t i = 0 ; i < 64 ; )
 	{
 		draw();
 		i++;
 	}
 
+#ifdef CONFIG_COUNTER
 	uint8_t chase = 0;
 	uint16_t ticks = 0;
 	uint16_t ms = 0;
 		if (count == 0)
 			break;
 	}
+#endif
 	
 	while (1)
 	{
+#ifdef CONFIG_COUNTER
 		int c = usb_serial_getchar();
 		if (c != -1)
 		{
 				minute_count = total_count = 0;
 			}
 		}
+#endif
 
 		if (bit_is_clear(TIFR0, OCF0A))
 		{
 
 		sbi(TIFR0, OCF0A); // reset the bit
 		ticks++;
+
+#ifdef CONFIG_COUNTER
 		if (++ms == 200)
 		{
 			ms = 0;
 		}
 
 		uint16_t o = total_count;
+#endif
+
+		uint16_t o = 9999 - (ticks / 200);
+
 		outputs[3] = digits[o % 10]; o /= 10;
 		outputs[2] = digits[o % 10]; o /= 10;
 		outputs[1] = digits[o % 10]; o /= 10;