Driver tweaks

This commit is contained in:
Neale Pickett 2013-07-18 22:46:55 -06:00
parent 671914b4fa
commit 37a9d7c170
2 changed files with 3 additions and 5 deletions

Binary file not shown.

8
main.c
View File

@ -92,20 +92,18 @@ write(uint8_t number)
void void
write_num(uint16_t number, int digits) write_num(uint16_t number, int digits)
{ {
uint16_t divisor = 1;
int i; int i;
for (i = 0; i < digits; i += 1) { for (i = 0; i < digits; i += 1) {
uint16_t n = number / divisor; uint8_t out = seven_segment_digits[number % 10];
uint8_t out = seven_segment_digits[n % 10];
// Overflow indicator // Overflow indicator
if (n > 9) { if ((i == digits - 1) && (number > 9)) {
out ^= 0x80; out ^= 0x80;
} }
write(out); write(out);
divisor *= 10; number /= 10;
} }
} }