X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/40b64d58a1a537ccc55e1c45fe6804b495c6e055..f74cf67e1721985cb93bc503cbdeda3f3dbc732b:/src/adafruit_blinka/microcontroller/am335x/pin.py diff --git a/src/adafruit_blinka/microcontroller/am335x/pin.py b/src/adafruit_blinka/microcontroller/am335x/pin.py index 24ae0c1..d3e4d94 100644 --- a/src/adafruit_blinka/microcontroller/am335x/pin.py +++ b/src/adafruit_blinka/microcontroller/am335x/pin.py @@ -9,11 +9,11 @@ class Pin: PULL_NONE = 0 PULL_UP = 1 PULL_DOWN = 2 - + id = None _value = LOW _mode = IN - + def __init__(self, pin_name): self.id = pin_name @@ -41,7 +41,7 @@ class Pin: elif pull == self.PULL_DOWN: GPIO.setup(self.id, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) else: - raise RuntimeError("Invalid pull for pin: %s" % self.id) + raise RuntimeError("Invalid pull for pin: %s" % self.id) def value(self, val=None): if val != None: @@ -56,6 +56,87 @@ class Pin: else: return GPIO.input(self.id) + +# PocketBeagle +# P1_1 = SYS VIN +P1_2 = Pin('P1_2') +P1_3 = Pin('P1_3') +P1_4 = Pin('P1_4') +# P1_5 = USB VBUS +P1_6 = Pin('P1_6') +# P1_7 = USB VIN +P1_8 = Pin('P1_8') +# P1_9 = USB DN +P1_10 = Pin('P1_10') +# P1_11 = USB DP +P1_12 = Pin('P1_12') +# P1_13 = USB ID +# P1_14 = SYS 3.3V +# P1_15 = SYS GND +# P1_16 = SYS GND +# P1_17 = AIN 1.8V REF- +# P1_18 = AIN 1.8V REF+ +P1_19 = Pin('P1_19') +P1_20 = Pin('P1_20') +P1_21 = Pin('P1_21') +# P1_22 = SYS GND +P1_23 = Pin('P1_23') +# P1_22 = SYS VOUT +P1_25 = Pin('P1_25') +P1_26 = Pin('P1_26') +P1_27 = Pin('P1_27') +P1_28 = Pin('P1_28') +P1_29 = Pin('P1_29') +P1_30 = Pin('P1_30') +P1_31 = Pin('P1_31') +P1_32 = Pin('P1_32') +P1_33 = Pin('P1_33') +P1_34 = Pin('P1_34') +P1_35 = Pin('P1_35') +P1_36 = Pin('P1_36') + + +P2_1 = Pin('P2_1') +P2_2 = Pin('P2_2') +P2_3 = Pin('P2_3') +P2_4 = Pin('P2_4') +P2_5 = Pin('P2_5') +P2_6 = Pin('P2_6') +P2_7 = Pin('P2_7') +P2_8 = Pin('P2_8') +P2_9 = Pin('P2_9') +P2_10 = Pin('P2_10') +P2_11 = Pin('P2_11') +# P2_12 = SYS PWR BTN +# P2_13 = SYS VOUT +# P2_14 = BAT VIN +# P2_15 = SYS GND +# P2_16 = BAT TEMP +P2_17 = Pin('P2_17') +P2_18 = Pin('P2_18') +P2_19 = Pin('P2_19') +P2_20 = Pin('P2_20') +# P2_21 = SYS GND +P2_22 = Pin('P2_22') +# P2_23 = SYS 3.3V +P2_24 = Pin('P2_24') +P2_25 = Pin('P2_25') +# P2_26 = SYS NRST +P2_27 = Pin('P2_27') +P2_28 = Pin('P2_28') +P2_29 = Pin('P2_29') +P2_30 = Pin('P2_30') +P2_31 = Pin('P2_31') +P2_32 = Pin('P2_32') +P2_33 = Pin('P2_33') +P2_34 = Pin('P2_34') +P2_35 = Pin('P2_35') +P2_36 = Pin('P2_36') + + +# BeagleBone Black +# P8_1 = ? +# P8_2 = ? P8_3 = Pin('P8_3') P8_4 = Pin('P8_4') P8_5 = Pin('P8_5') @@ -100,6 +181,17 @@ P8_43 = Pin('P8_43') P8_44 = Pin('P8_44') P8_45 = Pin('P8_45') P8_46 = Pin('P8_46') + +# P9_1 = ? +# P9_2 = ? +# P9_3 = ? +# P9_4 = ? +# P9_5 = ? +# P9_6 = ? +# P9_7 = ? +# P9_8 = ? +# P9_9 = ? +# P9_10 = ? P9_11 = Pin('P9_11') P9_12 = Pin('P9_12') P9_13 = Pin('P9_13') @@ -121,78 +213,42 @@ P9_28 = Pin('P9_28') P9_29 = Pin('P9_29') P9_30 = Pin('P9_30') P9_31 = Pin('P9_31') +# P9_32 = ? +# P9_33 = ? +# P9_34 = ? +# P9_35 = ? +# P9_36 = ? +# P9_37 = ? +# P9_38 = ? +# P9_39 = ? +# P9_40 = ? P9_41 = Pin('P9_41') P9_42 = Pin('P9_42') +# P9_43 = ? +# P9_44 = ? +# P9_45 = ? +# P9_46 = ? +# common to all beagles USR0 = Pin('USR0') USR1 = Pin('USR1') USR2 = Pin('USR2') USR3 = Pin('USR3') -SCL = Pin('P9_19') -SDA = Pin('P9_20') +# all special functions (SPI / I2C) are moved to +# src/adafruit_blinka/board/beaglebone_black.py -# Refer to header default pin modes -# http://beagleboard.org/static/images/cape-headers.png +# # ordered as spiId, sckId, mosiId, misoId +# spiPorts = ( +# (0, SCLK, MOSI, MISO), +# (1, SCLK_1, MOSI_1, MISO_1) +# ) # -# P9_17 (SPI0_CSO => CE0) enables peripheral device -# P9_18 (SPI0_D1 => MOSI) outputs data to peripheral device -# P9_21 (SPIO_DO => MISO) receives data from peripheral device -# P9_22 (SPI0_SCLK => SCLK) outputs clock signal -# -# Use config-pin to set pin mode for SPI pins -# https://github.com/beagleboard/bb.org-overlays/tree/master/tools/beaglebone-universal-io -# config-pin p9.17 spi_cs -# config-pin p9.18 spi -# config-pin p9.21 spi -# config-pin p9.22 spi_sclk +# # ordered as uartId, txId, rxId +# uartPorts = ( +# (), +# ) # -CE0 = Pin('P9_17') -MOSI = Pin('P9_18') -MISO = Pin('P9_21') -SCLK = Pin('P9_22') -#CircuitPython naming convention for SPI Clock -SCK = Pin('P9_22') - -# Pins for SPI1 -# refer to: -# http://beagleboard.org/static/images/cape-headers-spi.png -# -# CE1 P9.28 SPI1_CS0 -# MISO_1 P9.29 SPI1_D0 -# MOSI_1 P9.30 SPI1_D1 -# SCLK_1 P9.31 SPI_SCLK -# -# SPI1 conflicts with HDMI Audio (McASP) -# -# Refer to: -# https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays -# -# To Disable HDMI AUDIO, uncomment this line in /boot/uEnv.txt: -# disable_uboot_overlay_audio=1 -# -# Set pin modes for SPI1 with: -# -# config-pin p9.28 spi1_cs -# config-pin p9.29 spi1 -# config-pin p9.30 spi1 -# config-pin p9.31 spi_sclk -CE1 = Pin('P9_28') -MOSI_1 = Pin('P9_29') -MISO_1 = Pin('P9_30') -SCLK_1 = Pin('P9_31') -#CircuitPython naming convention for SPI Clock -SCK_1 = Pin('P9_31') - -# ordered as spiId, sckId, mosiId, misoId -spiPorts = ((0, SCLK, MOSI, MISO), (1, SCLK_1, MOSI_1, MISO_1)) - -# ordered as uartId, txId, rxId -uartPorts = ( - (), -) - -i2cPorts = ( - (2, SCL, SDA), -) - +# i2cPorts = ( +# (2, SCL, SDA), +# )