Add datasheet references for RP2040/RP2350 I2C pin mapping

This commit is contained in:
J. Nick Koston
2026-03-12 13:21:03 -10:00
parent 0400c2d3a3
commit 75a546bd96
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -94,7 +94,13 @@ def _bus_declare_type(value):
def _rp2040_i2c_controller(pin):
"""Return the I2C controller number (0 or 1) for a given RP2040/RP2350 GPIO pin."""
"""Return the I2C controller number (0 or 1) for a given RP2040/RP2350 GPIO pin.
See RP2040 datasheet Table 2 (section 1.4.3, "GPIO Functions"):
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
See RP2350 datasheet Table 7 (section 9.4, "Function Select"):
https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf
"""
return (pin // 2) % 2
+2 -1
View File
@@ -22,7 +22,8 @@ void ArduinoI2CBus::setup() {
#elif defined(USE_RP2040)
// Select Wire instance based on pin assignment, not definition order.
// RP2040 I2C controller is determined by GPIO: (pin / 2) % 2
// I2C0 SDA: GPIO 0,4,8,12,16,20,24,28 I2C1 SDA: GPIO 2,6,10,14,18,22,26
// See RP2040 datasheet Table 2 (section 1.4.3): https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
// See RP2350 datasheet Table 7 (section 9.4): https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf
if ((this->sda_pin_ / 2) % 2 == 0) {
wire_ = &Wire;
} else {