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_STR); // disable HV output
|
||||||
gpio_set(VFD_PORT, VFD_NLE); // latch data
|
gpio_set(VFD_PORT, VFD_NLE); // latch data
|
||||||
gpio_clear(VFD_PORT, VFD_STR); // enable HV output
|
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 */
|
/* transmit each digit and dot */
|
||||||
|
@ -410,7 +410,7 @@ int main(void)
|
||||||
|
|
||||||
bool vfd_transmit = false;
|
bool vfd_transmit = false;
|
||||||
uint8_t digit = 0;
|
uint8_t digit = 0;
|
||||||
uint8_t c = 128;
|
uint8_t c = 0;
|
||||||
/* blink the LED with every transmitted character */
|
/* blink the LED with every transmitted character */
|
||||||
while (1) {
|
while (1) {
|
||||||
while (usart_received) { // echo every received character
|
while (usart_received) { // echo every received character
|
||||||
|
@ -424,12 +424,14 @@ int main(void)
|
||||||
vfd_transmit = true;
|
vfd_transmit = true;
|
||||||
}
|
}
|
||||||
while (vfd_transmit) {
|
while (vfd_transmit) {
|
||||||
vfd_transmit = false;
|
c = digit+'0';
|
||||||
printf("%u:%c\n",digit,c);
|
|
||||||
vfd_digit(digit,c);
|
vfd_digit(digit,c);
|
||||||
vfd_shift();
|
vfd_shift();
|
||||||
digit = (digit+1)%10;
|
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
|
__WFI(); // go to sleep
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue