Skip to content

Commit c76a406

Browse files
committed
Log GPIO Config for RP2040
1 parent dc4f84a commit c76a406

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/components/digitalIO/Wippersnapper_DigitalGPIO.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ Wippersnapper_DigitalGPIO::~Wippersnapper_DigitalGPIO() {
4545
delete _digital_input_pins;
4646
}
4747

48+
49+
#ifdef ARDUINO_ARCH_RP2040
50+
void rp2040_dump_gpio_config(void) {
51+
WS_PRINTER.printf("GPIO | FUNC | DIR | OUT | IN | PULL-UP | PULL-DOWN | SLEW\n");
52+
WS_PRINTER.printf("-----+------+-----+-----+-----+---------+-----------+-----\n");
53+
54+
for (int gpio = 0; gpio < NUM_BANK0_GPIOS; gpio++) {
55+
WS_PRINTER.printf(" %2d | %2d | %s | %d | %d | %d | %d | %d\n",
56+
gpio,
57+
gpio_get_function(gpio),
58+
gpio_get_dir(gpio) ? "OUT" : "IN ",
59+
gpio_get_out_level(gpio),
60+
gpio_get(gpio),
61+
gpio_is_pulled_up(gpio),
62+
gpio_is_pulled_down(gpio),
63+
gpio_get_slew_rate(gpio));
64+
}
65+
}
66+
#endif
67+
4868
/*******************************************************************************************************************************/
4969
/*!
5070
@brief Configures a digital pin to behave as an input or an output.
@@ -140,6 +160,10 @@ void Wippersnapper_DigitalGPIO::initDigitalPin(
140160
}
141161
}
142162

163+
#ifdef ARDUINO_ARCH_RP2040
164+
rp2040_dump_gpio_config();
165+
#endif
166+
143167
} else {
144168
WS_DEBUG_PRINTLN("ERROR: Invalid digital pin direction!");
145169
}
@@ -183,6 +207,10 @@ void Wippersnapper_DigitalGPIO::deinitDigitalPin(
183207
itoa(pinName, cstr, 10);
184208
pinMode(pinName, INPUT); // hi-z
185209

210+
#ifdef ARDUINO_ARCH_RP2040
211+
rp2040_dump_gpio_config();
212+
#endif
213+
186214
// if prv. in-use by DIO, release pin back to application
187215
#ifdef STATUS_LED_PIN
188216
if (pinName == STATUS_LED_PIN)

0 commit comments

Comments
 (0)