X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/c4fe2662f97a9dc36185701032870dc3ac0d7851..c2bc4a90827f28abb6b51eae659a1f80a65c0497:/src/adafruit_blinka/microcontroller/starfive/JH7110/pin.py?ds=sidebyside diff --git a/src/adafruit_blinka/microcontroller/starfive/JH7110/pin.py b/src/adafruit_blinka/microcontroller/starfive/JH7110/pin.py index f272a36..023a40e 100644 --- a/src/adafruit_blinka/microcontroller/starfive/JH7110/pin.py +++ b/src/adafruit_blinka/microcontroller/starfive/JH7110/pin.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 Vladimir Shtarev +# SPDX-FileCopyrightText: 2024 Vladimir Shtarev, Jetbrains Research # # SPDX-License-Identifier: MIT """A Pin class for use with StarFive JH7110.""" @@ -23,8 +23,8 @@ class Pin: _value = LOW _mode = IN - def __init__(self, bcm_number): - self.id = bcm_number + def __init__(self, number): + self.id = number def __repr__(self): return str(self.id) @@ -34,6 +34,7 @@ class Pin: def init(self, mode=IN, pull=None): """Initialize the Pin""" + print(self.id) if mode is not None: if mode == self.IN: self._mode = self.IN @@ -68,52 +69,47 @@ class Pin: return GPIO.input(self.id) -D3 = Pin(3) -D5 = Pin(5) D7 = Pin(7) -D8 = Pin(9) -D10 = Pin(10) D11 = Pin(11) D12 = Pin(12) D13 = Pin(13) D15 = Pin(15) D16 = Pin(16) D18 = Pin(18) -D19 = Pin(19) -D21 = Pin(21) D22 = Pin(22) -D23 = Pin(23) D24 = Pin(24) D26 = Pin(26) D27 = Pin(27) D28 = Pin(28) D29 = Pin(29) D31 = Pin(31) -D32 = Pin(32) -D33 = Pin(33) D35 = Pin(35) D36 = Pin(36) D37 = Pin(37) D38 = Pin(38) D40 = Pin(40) # I2C -SDA = D3 -SCL = D5 +I2C_SDA = Pin(3) +I2C_SCL = Pin(5) # SPI -MISO = D21 -MOSI = D19 -SCLK = D23 +SPI_MISO = Pin(21) +SPI_MOSI = Pin(19) +SPI_SCLK = Pin(23) # UART -UART_TX = D8 -UART_RX = D10 +UART_TX = Pin(8) +UART_RX = Pin(10) + +# PWM, does not support pwmio +PWM1 = Pin(32) +PWM2 = Pin(33) # ordered as i2cId, SCL, SDA -i2cPorts = ((0, SCL, SDA),) +i2cPorts = ((0, I2C_SCL, I2C_SDA),) # ordered as spiId, sckId, mosiId, misoId -spiPorts = ((0, SCLK, MOSI, MISO),) +spiPorts = ((0, SPI_SCLK, SPI_MOSI, SPI_MISO),) # ordered as uartId, txId, rxId uartPorts = ((0, UART_TX, UART_RX),)