Browse Source

Moved ports declarations into microcontroller.pin package, and used pin references in port definitions.

master^2
Cefn Hoile 3 years ago
parent
commit
6eb178d1ac
5 changed files with 40 additions and 29 deletions
  1. +0
    -7
      src/adafruit_blinka/microcontroller/esp8266/__init__.py
  2. +11
    -0
      src/adafruit_blinka/microcontroller/esp8266/pin.py
  3. +0
    -13
      src/adafruit_blinka/microcontroller/stm32/__init__.py
  4. +18
    -0
      src/adafruit_blinka/microcontroller/stm32/pin.py
  5. +11
    -9
      test/src/testing/board/__init__.py

+ 0
- 7
src/adafruit_blinka/microcontroller/esp8266/__init__.py View File

@ -1,8 +1 @@
# 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))

+ 11
- 0
src/adafruit_blinka/microcontroller/esp8266/pin.py View File

@ -25,3 +25,14 @@ class cpu():
from machine import freq
return freq()
"""
# ordered as spiId, sckId, mosiId, misoId
spiPorts = ((1, GPIO14, GPIO13, GPIO12))
# ordered as uartId, txId, rxId
uartPorts = (
(0, GPIO1, GPIO3),
# (0, GPIO15, GPIO13) # TODO secondary pins for UART0 configurable from Micropython? How to flag?
(1, GPIO2, None))
i2cPorts = ()

+ 0
- 13
src/adafruit_blinka/microcontroller/stm32/__init__.py View File

@ -1,13 +0,0 @@
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"),
)

+ 18
- 0
src/adafruit_blinka/microcontroller/stm32/pin.py View File

@ -47,3 +47,21 @@ C11 = Pin('C11')
C12 = Pin('C12')
C13 = Pin('C13')
D2 = Pin('D2')
# 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),
)
i2cPorts = (
(1, B6, B7),
(2, B10, B11),
)

+ 11
- 9
test/src/testing/board/__init__.py View File

@ -1,22 +1,24 @@
"""Configuration of testing fixtures depending on the board layout"""
from adafruit_blinka import agnostic
import board
if agnostic.board == "feather_m0_express":
default_pin = feather_m0_express.D5
led_pin = feather_m0_express.D13
default_pin = board.D5
led_pin = board.D13
led_hardwired = True
led_inverted = False
elif agnostic.board == "feather_huzzah":
from adafruit_blinka.board import feather_huzzah
default_pin = feather_huzzah.GPIO4
led_pin = feather_huzzah.GPIO0 # red led
default_pin = board.GPIO4
led_pin = board.GPIO0 # red led
led_hardwired = True
led_inverted = True
elif agnostic.board == "pyboard":
default_pin = pyboard.X1
led_pin = adafruit_blinka.board.pyboard.LED_BLUE
default_pin = board.X1
led_pin = board.LED_BLUE
led_hardwired = True
led_inverted = False
uartTxId = "B6"
uartRXId = "B7"
else:
raise NotImplementedError("Board not supported")
raise NotImplementedError("Board not supported")

Loading…
Cancel
Save