Improve GPIO debug
This commit is contained in:
parent
a4c4c34ff9
commit
24e407551e
@ -101,21 +101,37 @@ void gpio_init() {
|
|||||||
GPCRJ7 = 0x80;
|
GPCRJ7 = 0x80;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_debug_bank(char bank, unsigned char data) {
|
void gpio_debug_bank(
|
||||||
|
char * bank,
|
||||||
|
uint8_t data,
|
||||||
|
uint8_t mirror,
|
||||||
|
uint8_t pot,
|
||||||
|
volatile uint8_t * control
|
||||||
|
) {
|
||||||
for(char i = 0; i < 8; i++) {
|
for(char i = 0; i < 8; i++) {
|
||||||
printf("%c%d = %d\n", bank, i, (data >> i) & 1);
|
printf(
|
||||||
|
"%s%d data %d mirror %d pot %d control %02X\n",
|
||||||
|
bank,
|
||||||
|
i,
|
||||||
|
(data >> i) & 1,
|
||||||
|
(mirror >> i) & 1,
|
||||||
|
(pot >> i) & 1,
|
||||||
|
*(control + i)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gpio_debug(void) {
|
void gpio_debug(void) {
|
||||||
gpio_debug_bank('A', GPDRA);
|
#define bank(BANK) gpio_debug_bank(#BANK, GPDR ## BANK, GPDMR ## BANK, GPOT ## BANK, &GPCRA0)
|
||||||
gpio_debug_bank('B', GPDRB);
|
bank(A);
|
||||||
gpio_debug_bank('C', GPDRC);
|
bank(B);
|
||||||
gpio_debug_bank('D', GPDRD);
|
bank(C);
|
||||||
gpio_debug_bank('E', GPDRE);
|
bank(D);
|
||||||
gpio_debug_bank('F', GPDRF);
|
bank(E);
|
||||||
gpio_debug_bank('G', GPDRG);
|
bank(F);
|
||||||
gpio_debug_bank('H', GPDRH);
|
bank(G);
|
||||||
gpio_debug_bank('I', GPDRI);
|
bank(H);
|
||||||
gpio_debug_bank('J', GPDRJ);
|
bank(I);
|
||||||
|
bank(J);
|
||||||
|
#undef bank
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user