1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-23 22:30:37 +02:00

ubbctl/ubbctl.c (show_pins): also show level seen at pin

This commit is contained in:
Werner Almesberger 2013-01-06 10:00:52 -03:00
parent 33085cee44
commit 77fd696067

View File

@ -37,15 +37,22 @@ static struct pin {
static void show_pins(void) static void show_pins(void)
{ {
const struct pin *p; const struct pin *p;
int pin, set;
for (p = pins; p->name; p++) { for (p = pins; p->name; p++) {
printf("%s%s=", p == pins ? "" : " ", p->name); printf("%s%s=", p == pins ? "" : " ", p->name);
if (PDFUN & p->mask) pin = PIN(p->mask);
if (PDFUN & p->mask) {
printf("FN"); printf("FN");
else if (PDDIR & p->mask) } else if (PDDIR & p->mask) {
printf("%d", !!(PDDAT & p->mask)); set = !!(PDDAT & p->mask);
else if (pin != set)
printf("%d!", set);
} else {
putchar(PDPULL & p->mask ? 'Z' : 'R'); putchar(PDPULL & p->mask ? 'Z' : 'R');
}
printf("%d", pin);
} }
printf("\n"); printf("\n");
} }