Get Pins from SPI
Posted: Sat May 12, 2018 6:33 am
Is it possible to get a Pin object from an SPI object?
I know the MISO pin on my board is B14. Instead of typing this...
I'm hoping to get it from the SPI object. Something like this...
Code: Select all
>>> from machine import Pin, SPI
>>> spi = SPI(2)
>>> spi.init(baudrate=6000000, polarity=0, phase=0)
>>> print(spi)
SPI(2, baudrate=5250000, polarity=0, phase=0, bits=8)
Code: Select all
>>> miso = Pin('B14', Pin.IN)
>>> miso.value()
Code: Select all
>>> spi.miso.value()