adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.09k stars 1.21k forks source link

Stemma i2c pin name aliases, or improvement on naming conventions #9558

Open migs35323 opened 1 month ago

migs35323 commented 1 month ago

I was trying to use the stemma pins on some feather or qt py adafruit boards without using i2c (using other interfaces or simply the underlying gpios) and i noticed that there is no easy way to identify these pins without consulting code, datasheets or other resources...

while one can use board.STEMMA_i2C to create the i2c interface, i believe there should be a way to use these pins with other interfaces.

example1:

import board
import digitalio
led1 = digitalio.DigitalInOut(board.STEMMA_SDA)
led2 = digitalio.DigitalInOut(board.STEMMA_SCL)

example 2, a class/object named STEMMA to make it more clear:

import board
import digitalio
led1 = digitalio.DigitalInOut(board.STEMMA.SDA)
led2 = digitalio.DigitalInOut(board.STEMMA.SCL)

Currently the naming is something like "SDA", "SDA1" which is OK, but there could be aliases, or a better naming system for these pins so one can easily reference those as stemma pins and not look up which sda interface that pin is connected to

another example that i noticed is in the esp32-c6, the stemma 3 volt line is actually gpio20 (IIRC) which is currently named as neopixel power, however this doesn't make it clear that this "neopixel power" is also the stemma VCC pin.

tannewt commented 1 month ago

Example 1 makes sense to me. Example 2 is harder because of the nested object.