add dip switch reading

This commit is contained in:
Robert 2022-12-06 21:05:18 +01:00
parent ac85394396
commit c800ee85b2
4 changed files with 60 additions and 8 deletions

View file

@ -10,5 +10,13 @@ int main() {
return -1;
}
uint8_t dip = read_dip_switch(instance, NULL, 0);
printf("DIP switch reads: ");
for(uint8_t mask = 1; mask != 0; mask <<= 1) {
printf("%d", (dip & mask) == mask ? 1 : 0);
}
printf("\n");
return 0;
}