From: Cefn Hoile Date: Sat, 24 Feb 2018 21:06:40 +0000 (+0000) Subject: Defined uart and spi hardware availability for esp8266 and stm32. Moved pin functiona... X-Git-Tag: 0.1.0~4^2~45 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/d884bdd356ad2cfaf1c30b6a0d00071f45d60b54?ds=inline Defined uart and spi hardware availability for esp8266 and stm32. Moved pin functionality, yet to be tested --- diff --git a/python/microcontroller/esp8266/__init__.py b/python/microcontroller/esp8266/__init__.py new file mode 100644 index 0000000..d3dce53 --- /dev/null +++ b/python/microcontroller/esp8266/__init__.py @@ -0,0 +1,11 @@ +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ( + (1, 14, 13, 12) +) + +# ordered as uartId, txId, rxId +uartPorts = ( + (0, 1, 3), + # (0, 15, 13) # TODO secondary pins for UART0 configurable from Micropython? + (1, 2, None) +) \ No newline at end of file diff --git a/python/microcontroller/esp8266.py b/python/microcontroller/esp8266/pin.py similarity index 68% rename from python/microcontroller/esp8266.py rename to python/microcontroller/esp8266/pin.py index 4e16571..9f4e0d6 100644 --- a/python/microcontroller/esp8266.py +++ b/python/microcontroller/esp8266/pin.py @@ -1,17 +1,17 @@ -from microcontroller import Pin as pin +from microcontroller import Pin -pin.GPIO0=pin(0) -pin.GPIO1=pin(1) -pin.GPIO2=pin(2) -pin.GPIO3=pin(3) -pin.GPIO4=pin(4) -pin.GPIO5=pin(5) -pin.GPIO12=pin(12) -pin.GPIO13=pin(13) -pin.GPIO14=pin(14) -pin.GPIO15=pin(15) -pin.GPIO16=pin(16) -pin.TOUT=pin("TOUT") +GPIO0=Pin(0) +GPIO1=Pin(1) +GPIO2=Pin(2) +GPIO3=Pin(3) +GPIO4=Pin(4) +GPIO5=Pin(5) +GPIO12=Pin(12) +GPIO13=Pin(13) +GPIO14=Pin(14) +GPIO15=Pin(15) +GPIO16=Pin(16) +TOUT=Pin("TOUT") """ From introspection of microcontroller.pin on Feather Huzzah running CircuitPython diff --git a/python/microcontroller/stm32.py b/python/microcontroller/stm32.py deleted file mode 100644 index 7aaff3e..0000000 --- a/python/microcontroller/stm32.py +++ /dev/null @@ -1,49 +0,0 @@ -from microcontroller import Pin as pin - -pin.A0=pin('A0') -pin.A1=pin('A1') -pin.A2=pin('A2') -pin.A3=pin('A3') -pin.A4=pin('A4') -pin.A5=pin('A5') -pin.A6=pin('A6') -pin.A7=pin('A7') -pin.A8=pin('A8') -pin.A9=pin('A9') -pin.A10=pin('A10') -pin.A11=pin('A11') -pin.A12=pin('A12') -pin.A13=pin('A13') -pin.A14=pin('A14') -pin.A15=pin('A15') -pin.B0=pin('B0') -pin.B1=pin('B1') -pin.B2=pin('B2') -pin.B3=pin('B3') -pin.B4=pin('B4') -pin.B5=pin('B5') -pin.B6=pin('B6') -pin.B7=pin('B7') -pin.B8=pin('B8') -pin.B9=pin('B9') -pin.B10=pin('B10') -pin.B11=pin('B11') -pin.B12=pin('B12') -pin.B13=pin('B13') -pin.B14=pin('B14') -pin.B15=pin('B15') -pin.C0=pin('C0') -pin.C1=pin('C1') -pin.C2=pin('C2') -pin.C3=pin('C3') -pin.C4=pin('C4') -pin.C5=pin('C5') -pin.C6=pin('C6') -pin.C7=pin('C7') -pin.C8=pin('C8') -pin.C9=pin('C9') -pin.C10=pin('C10') -pin.C11=pin('C11') -pin.C12=pin('C12') -pin.C13=pin('C13') -pin.D2=pin('D2') \ No newline at end of file diff --git a/python/microcontroller/stm32/__init__.py b/python/microcontroller/stm32/__init__.py new file mode 100644 index 0000000..28bc6ee --- /dev/null +++ b/python/microcontroller/stm32/__init__.py @@ -0,0 +1,16 @@ +from microcontroller import pin + +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ( + (1, "B13", "B15", "B14"), + (2, "A5", "A6", "A7") +) + +# ordered as uartId, txId, rxId +uartPorts = ( + (1, "B6", "B7"), + (2, "A2", "A3"), + (3, "B10", "B11"), + (4, "A0", "A1"), + (6, "C6", "C7"), +) \ No newline at end of file diff --git a/python/microcontroller/stm32/pin.py b/python/microcontroller/stm32/pin.py new file mode 100644 index 0000000..3b27f65 --- /dev/null +++ b/python/microcontroller/stm32/pin.py @@ -0,0 +1,49 @@ +from microcontroller import Pin + +A0=Pin('A0') +A1=Pin('A1') +A2=Pin('A2') +A3=Pin('A3') +A4=Pin('A4') +A5=Pin('A5') +A6=Pin('A6') +A7=Pin('A7') +A8=Pin('A8') +A9=Pin('A9') +A10=Pin('A10') +A11=Pin('A11') +A12=Pin('A12') +A13=Pin('A13') +A14=Pin('A14') +A15=Pin('A15') +B0=Pin('B0') +B1=Pin('B1') +B2=Pin('B2') +B3=Pin('B3') +B4=Pin('B4') +B5=Pin('B5') +B6=Pin('B6') +B7=Pin('B7') +B8=Pin('B8') +B9=Pin('B9') +B10=Pin('B10') +B11=Pin('B11') +B12=Pin('B12') +B13=Pin('B13') +B14=Pin('B14') +B15=Pin('B15') +C0=Pin('C0') +C1=Pin('C1') +C2=Pin('C2') +C3=Pin('C3') +C4=Pin('C4') +C5=Pin('C5') +C6=Pin('C6') +C7=Pin('C7') +C8=Pin('C8') +C9=Pin('C9') +C10=Pin('C10') +C11=Pin('C11') +C12=Pin('C12') +C13=Pin('C13') +D2=Pin('D2') \ No newline at end of file