display all digits
This commit is contained in:
parent
cec0a0885a
commit
07219f4873
12
main.c
12
main.c
@ -98,7 +98,7 @@ static void vfd_shift(void)
|
||||
gpio_set(VFD_PORT, VFD_STR); // disable HV output
|
||||
gpio_set(VFD_PORT, VFD_NLE); // latch data
|
||||
gpio_clear(VFD_PORT, VFD_STR); // enable HV output
|
||||
// normally there is minimum time before/after the latch
|
||||
gpio_clear(VFD_PORT, VFD_NLE); // stop latching data
|
||||
}
|
||||
|
||||
/* transmit each digit and dot */
|
||||
@ -410,7 +410,7 @@ int main(void)
|
||||
|
||||
bool vfd_transmit = false;
|
||||
uint8_t digit = 0;
|
||||
uint8_t c = 128;
|
||||
uint8_t c = 0;
|
||||
/* blink the LED with every transmitted character */
|
||||
while (1) {
|
||||
while (usart_received) { // echo every received character
|
||||
@ -424,12 +424,14 @@ int main(void)
|
||||
vfd_transmit = true;
|
||||
}
|
||||
while (vfd_transmit) {
|
||||
vfd_transmit = false;
|
||||
printf("%u:%c\n",digit,c);
|
||||
c = digit+'0';
|
||||
vfd_digit(digit,c);
|
||||
vfd_shift();
|
||||
digit = (digit+1)%10;
|
||||
c++;
|
||||
// let the fluorescence glow up a bit
|
||||
for (uint32_t i = 0; i < 0x2000; i++) {
|
||||
__asm__("nop");
|
||||
}
|
||||
}
|
||||
__WFI(); // go to sleep
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user