Deserves a bit more testing but this seems to work to differentiate between the three models of the Inky Frame. I’d prefer it was in a library and reviewed to ensure it’s safe wrt raising what might be the select line on the PSRAM.
### Do a pull down test of I2C_INT / PSRAM_CS (GP3)
i2c_int_psram_cs_input = Pin(IF_I2C_INT_PSRAM_CS_PIN, Pin.IN, pull=Pin.PULL_DOWN)
i2c_int_psram_cs_state = i2c_int_psram_cs_input.value()
### Reset the pin to input for I2C_INT or to output for PSRAM_CS
if i2c_int_psram_cs_state:
_ = Pin(IF_I2C_INT_PSRAM_CS_PIN, Pin.IN, pull=None)
else:
_ = Pin(IF_I2C_INT_PSRAM_CS_PIN, Pin.OUT, value=0)
### Do a pull down test of SR_LATCH (GP9)
sr_latch_input = Pin(inky_frame.SR_LATCH, Pin.IN, pull=Pin.PULL_DOWN)
sr_latch_state = sr_latch_input.value()
### Reset the pin state to a low output
_ = Pin(inky_frame.SR_LATCH, Pin.OUT, value=0)
if sr_latch_state:
from picographics import DISPLAY_INKY_FRAME_4 as DISPLAY ### 4.0"
elif not i2c_int_psram_cs_state:
from picographics import DISPLAY_INKY_FRAME_7 as DISPLAY ### 7.3"
else:
from picographics import DISPLAY_INKY_FRAME as DISPLAY ### 5.7"