add dip switch reading
This commit is contained in:
parent
ac85394396
commit
c800ee85b2
4 changed files with 60 additions and 8 deletions
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue