7 seg : adding hex letters

This commit is contained in:
tth 2019-01-28 16:07:48 +01:00
parent a320d37960
commit 1dcbc6746c
2 changed files with 11 additions and 1 deletions

View File

@ -86,6 +86,8 @@ fprintf(stderr, ">>> %s ( %p %d %d '%c' )\n", __func__,
win, lig, col, digit);
#endif
if (isxdigit(digit)) digit = toupper(digit);
switch (digit) {
case '0': bits = 0x3f; break;
case '1': bits = 0x06; break;
@ -98,6 +100,14 @@ switch (digit) {
case '8': bits = 0x7f; break;
case '9': bits = 0x6f; break;
/* hexadecimal letters */
case 'A': bits = 0x77; break;
case 'B': bits = 0x7c; break;
case 'C': bits = 0x39; break;
case 'D': bits = 0x5e; break;
case 'E': bits = 0x79; break;
case 'F': bits = 0x71; break;
case ' ': bits = 0; break;
case '.': bits = 0x80; break;

View File

@ -18,7 +18,7 @@ char ligne[100];
for (loop=0; loop<nbl; loop++) {
sprintf(ligne, "%5d", loop);
sprintf(ligne, "%04x", loop);
mvaddstr(2, 1, ligne);
for (idx=0; idx<strlen(ligne); idx++) {
aff7segs_digit(stdscr, 3, 10+(idx*9), ligne[idx]);