Driver tweaks
This commit is contained in:
parent
671914b4fa
commit
37a9d7c170
BIN
driver.fzz
BIN
driver.fzz
Binary file not shown.
8
main.c
8
main.c
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue