Display the amount of free RAM
From: https://learn.adafruit.com/welcome-to-circuitpython/frequently-asked-questions
import gc print( gc.mem_free() )
Show microcontroller.pin to board mappings
From https://gist.github.com/anecdata/1c345cb2d137776d76b97a5d5678dc97
import microcontroller import board for pin in dir(microcontroller.pin): if isinstance(getattr(microcontroller.pin, pin), microcontroller.Pin): print("".join(("microcontroller.pin.", pin, "\t")), end=" ") for alias in dir(board): if getattr(board, alias) is getattr(microcontroller.pin, pin): print("".join(("", "board.", alias)), end=" ") print()
import os print(os.uname().machine) 'Adafruit ItsyBitsy M4 Express with samd51g19'
To get the chip family
import os print(os.uname().sysname) 'ESP32S2'
import os board_type = os.uname().machine if 'QT Py M0' in board_type: tft_clk = board.SCK tft_mosi = board.MOSI spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi) elif 'ItsyBitsy M4' in board_type: tft_clk = board.SCK tft_mosi = board.MOSI spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi) elif 'Pico' in board_type: tft_clk = board.GP10 # must be a SPI CLK tft_mosi= board.GP11 # must be a SPI TX spi = busio.SPI(clock=tft_clk, MOSI=tft_mosi) else: print("supported board", board_type)