uint32_t *port_regsp[] = {(uint32_t*)&IMXRT_GPIO6, (uint32_t*)&IMXRT_GPIO7, (uint32_t*)&IMXRT_GPIO8, (uint32_t*)&IMXRT_GPIO9};
uint8_t pin_numbers[4][32];
void setup() {
memset(pin_numbers, 0xff, sizeof(pin_numbers));
// put your setup code here, to run once:
for (uint8_t pin = 0; pin < CORE_NUM_TOTAL_PINS; pin++) {
uint32_t *port = digital_pin_to_info_PGM[pin].reg;
uint8_t port_pin = __builtin_ctz(digital_pin_to_info_PGM[pin].mask);
for (uint8_t i = 0; i < 4; i++) {
if (port == port_regsp[i]) {
pin_numbers[i][port_pin] = pin;
break;
}
}
}
while (!Serial) ; // wait for serial.
Serial.println("\n 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00");
for (int i = 0; i < 4; i++) {
Serial.printf("GPIO%d:", i + 6);
for (int j = 31; j >= 0; j--) {
if (pin_numbers[i][j] != 0xff) Serial.printf(" %02u", pin_numbers[i][j]);
else Serial.print(" --");
}
Serial.println();
}
}
void loop() {
// put your main code here, to run repeatedly:
}