Skip to content

Commit bfd903b

Browse files
authored
Merge pull request #1001 from technobly/for-upstream
Support for Particle Tachyon
2 parents f79764b + 2180cd0 commit bfd903b

File tree

10 files changed

+222
-20
lines changed

10 files changed

+222
-20
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: 2025 Brett Walach for Particle
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""Board definitions from Particle"""
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SPDX-FileCopyrightText: 2025 Brett Walach for Particle
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""Pin definitions for the Tachyon."""
5+
6+
from adafruit_blinka.microcontroller.quectel.qcm6490 import pin
7+
8+
for it in pin.i2cPorts:
9+
globals()["SCL" + str(it[0])] = it[1]
10+
globals()["SDA" + str(it[0])] = it[2]
11+
12+
SCL = pin.i2cPorts[0][1]
13+
SDA = pin.i2cPorts[0][2]
14+
15+
D0 = pin.GPIO_36
16+
D1 = pin.GPIO_37
17+
D2 = pin.GPIO_8
18+
D3 = pin.GPIO_9
19+
D4 = pin.GPIO_61
20+
D5 = pin.GPIO_18
21+
D6 = pin.GPIO_19
22+
D7 = pin.GPIO_62
23+
D8 = pin.GPIO_59
24+
D9 = pin.GPIO_56
25+
D10 = pin.GPIO_57
26+
D11 = pin.GPIO_58
27+
D12 = pin.GPIO_78
28+
D13 = pin.GPIO_106
29+
D14 = pin.GPIO_34
30+
D15 = pin.GPIO_35
31+
D16 = pin.GPIO_32
32+
D17 = pin.GPIO_33
33+
D18 = pin.GPIO_144
34+
D19 = pin.GPIO_145
35+
D20 = pin.GPIO_146
36+
D21 = pin.GPIO_147
37+
D22 = pin.GPIO_158
38+
D23 = pin.GPIO_165
39+
D24 = pin.GPIO_166
40+
D25 = pin.GPIO_24
41+
D26 = pin.GPIO_6
42+
D27 = pin.GPIO_44
43+
44+
CS = D8
45+
MISO = D9
46+
MOSI = D10
47+
SCLK = D11
48+
SCK = SCLK
49+
50+
UART_TX = D14
51+
UART_RX = D15
52+
53+
PWM1 = D13

src/adafruit_blinka/microcontroller/generic_linux/libgpiod/libgpiod_pin_2_x.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,8 @@ def init(self, mode=IN, pull=None):
4848
"""Initialize the Pin"""
4949
# Input,
5050
if not self._line_request:
51-
self._line_request = self._chip.request_lines(
52-
config={int(self._num): None},
53-
consumer=self._CONSUMER,
54-
)
55-
# print("init line: ", self.id, self._line)
56-
57-
if mode is not None:
5851
line_config = gpiod.LineSettings()
52+
5953
if mode == self.IN:
6054
line_config.direction = gpiod.line.Direction.INPUT
6155
if pull is not None:
@@ -68,24 +62,18 @@ def init(self, mode=IN, pull=None):
6862
else:
6963
raise RuntimeError(f"Invalid pull for pin: {self.id}")
7064

71-
self._mode = self.IN
72-
self._line_request.reconfigure_lines(
73-
{
74-
int(self._num): line_config,
75-
}
76-
)
7765
elif mode == self.OUT:
7866
if pull is not None:
7967
raise RuntimeError("Cannot set pull resistor on output")
80-
self._mode = self.OUT
8168
line_config.direction = gpiod.line.Direction.OUTPUT
82-
self._line_request.reconfigure_lines(
83-
{
84-
int(self._num): line_config,
85-
}
86-
)
69+
8770
else:
88-
raise RuntimeError("Invalid mode for pin: %s" % self.id)
71+
raise RuntimeError(f"Invalid mode for pin: {self.id}")
72+
73+
self._line_request = self._chip.request_lines(
74+
{int(self._num): line_config},
75+
consumer=self._CONSUMER,
76+
)
8977

9078
def value(self, val=None):
9179
"""Set or return the Pin Value"""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: 2025 Brett Walach for Particle
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""Definition of all Quectel chips"""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-FileCopyrightText: 2025 Brett Walach for Particle
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""Definition for the Quectel QCM6490 chip"""
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# SPDX-FileCopyrightText: 2025 Brett Walach for Particle
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""Quectel QCM6490 pin names"""
5+
6+
from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin
7+
8+
# Use with libgpiod_pin
9+
GPIO_BASE = 0
10+
11+
GPIO_6 = Pin(GPIO_BASE + 6)
12+
UART01_TXD = GPIO_6
13+
PWM1 = GPIO_6
14+
15+
GPIO_8 = Pin(GPIO_BASE + 8)
16+
I2C02_SDA = GPIO_8
17+
SDA = GPIO_8
18+
19+
GPIO_9 = Pin(GPIO_BASE + 9)
20+
I2C02_SCL = GPIO_9
21+
SCL = GPIO_9
22+
23+
GPIO_18 = Pin(GPIO_BASE + 18)
24+
UART04_TXD = GPIO_18
25+
SPI04_CLK = GPIO_18
26+
27+
GPIO_19 = Pin(GPIO_BASE + 19)
28+
UART04_RXD = GPIO_19
29+
SPI04_CS0 = GPIO_19
30+
31+
GPIO_24 = Pin(GPIO_BASE + 24)
32+
33+
GPIO_32 = Pin(GPIO_BASE + 32)
34+
UART10_CTS = GPIO_32
35+
CTS = GPIO_32
36+
37+
GPIO_33 = Pin(GPIO_BASE + 33)
38+
UART10_RTS = GPIO_33
39+
RTS = GPIO_33
40+
41+
GPIO_34 = Pin(GPIO_BASE + 34)
42+
UART10_TXD = GPIO_34
43+
44+
GPIO_35 = Pin(GPIO_BASE + 35)
45+
UART10_RXD = GPIO_35
46+
47+
GPIO_36 = Pin(GPIO_BASE + 36)
48+
UART11_CTS = GPIO_36
49+
SPI11_MISO = GPIO_36
50+
I2C11_SDA = GPIO_36
51+
EEPROM_SDA = GPIO_36
52+
53+
GPIO_37 = Pin(GPIO_BASE + 37)
54+
UART11_RTS = GPIO_37
55+
SPI11_MOSI = GPIO_37
56+
I2C11_SCL = GPIO_37
57+
EEPROM_SCL = GPIO_37
58+
59+
GPIO_40 = Pin(GPIO_BASE + 40)
60+
QWIIC_I2C12_SDA = GPIO_40
61+
62+
GPIO_41 = Pin(GPIO_BASE + 41)
63+
QWIIC_I2C12_SCL = GPIO_41
64+
65+
GPIO_44 = Pin(GPIO_BASE + 44)
66+
67+
GPIO_56 = Pin(GPIO_BASE + 56)
68+
SPI16_MISO = GPIO_56
69+
I2C16_SDA = GPIO_56
70+
UART16_CTS = GPIO_56
71+
MISO = GPIO_56
72+
73+
GPIO_57 = Pin(GPIO_BASE + 57)
74+
SPI16_MOSI = GPIO_57
75+
I2C16_SCL = GPIO_57
76+
UART16_RTS = GPIO_57
77+
MOSI = GPIO_57
78+
79+
GPIO_58 = Pin(GPIO_BASE + 58)
80+
SPI16_CLK = GPIO_58
81+
UART16_TXD = GPIO_58
82+
SCK = GPIO_58
83+
84+
GPIO_59 = Pin(GPIO_BASE + 59)
85+
SPI16_CS0 = GPIO_59
86+
UART16_RXD = GPIO_59
87+
CE0 = GPIO_59
88+
89+
GPIO_61 = Pin(GPIO_BASE + 61)
90+
91+
GPIO_62 = Pin(GPIO_BASE + 62)
92+
SPI16_CS1 = GPIO_62
93+
CE1 = GPIO_62
94+
95+
GPIO_78 = Pin(GPIO_BASE + 78)
96+
PWM0 = GPIO_78
97+
98+
GPIO_106 = Pin(GPIO_BASE + 106)
99+
MI2S1_SCLK = GPIO_106
100+
PWM = GPIO_106
101+
PWM1 = GPIO_106
102+
103+
GPIO_144 = Pin(GPIO_BASE + 144)
104+
LPI_MI2S_SCLK = GPIO_144
105+
106+
GPIO_145 = Pin(GPIO_BASE + 145)
107+
LPI_MI2S_WS = GPIO_145
108+
MISO1 = GPIO_145
109+
110+
GPIO_146 = Pin(GPIO_BASE + 146)
111+
LPI_MI2S_DATA0 = GPIO_146
112+
MOSI1 = GPIO_146
113+
114+
GPIO_147 = Pin(GPIO_BASE + 147)
115+
LPI_MI2S_DATA1 = GPIO_147
116+
SCK1 = GPIO_147
117+
118+
GPIO_158 = Pin(GPIO_BASE + 158)
119+
120+
GPIO_165 = Pin(GPIO_BASE + 165)
121+
122+
GPIO_166 = Pin(GPIO_BASE + 166)
123+
124+
# ordered as i2cId, i2cSclId, i2cSdaId
125+
i2cPorts = (
126+
(1, I2C02_SCL, I2C02_SDA),
127+
(2, QWIIC_I2C12_SCL, QWIIC_I2C12_SDA),
128+
)
129+
130+
# ordered as spiId, sckId, mosiId, misoId
131+
spiPorts = (
132+
(0, SPI16_CLK, SPI16_MOSI, SPI16_MISO),
133+
(1, SPI16_CLK, SPI16_MOSI, SPI16_MISO),
134+
)
135+
136+
# ordered as uartId, txId, rxId
137+
uartPorts = ((10, UART10_TXD, UART10_RXD),)
138+
139+
# ordered as pwmChipId, pwmChannelId, pwmId
140+
pwmOuts = (((0, 0), PWM1),)

src/board.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@
467467
elif board_id == ap_board.RDK_X3:
468468
from adafruit_blinka.board.horizon.rdkx3 import *
469469

470+
elif board_id == ap_board.PARTICLE_TACHYON:
471+
from adafruit_blinka.board.particle.tachyon import *
472+
470473
elif "sphinx" in sys.modules:
471474
pass
472475

src/digitalio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@
151151
from adafruit_blinka.microcontroller.rockchip.rv1103.pin import Pin
152152
elif detector.chip.RV1106:
153153
from adafruit_blinka.microcontroller.rockchip.rv1106.pin import Pin
154+
elif detector.chip.QCM6490:
155+
from adafruit_blinka.microcontroller.quectel.qcm6490.pin import Pin
154156
elif detector.chip.OS_AGNOSTIC:
155157
from adafruit_blinka.microcontroller.generic_agnostic_board.pin import Pin
156158

src/microcontroller/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ def delay_us(delay):
169169
from adafruit_blinka.microcontroller.renesas.rzv2h import *
170170
elif chip_id == ap_chip.SUNRISE_X3:
171171
from adafruit_blinka.microcontroller.horizon.sunrise_x3 import *
172+
elif chip_id == ap_chip.QCM6490:
173+
from adafruit_blinka.microcontroller.quectel.qcm6490 import *
172174
elif chip_id == ap_chip.GENERIC_X86:
173175
print("WARNING: GENERIC_X86 is not fully supported. Some features may not work.")
174176
elif chip_id == ap_chip.OS_AGNOSTIC:

src/microcontroller/pin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@
159159
from adafruit_blinka.microcontroller.rockchip.rv1106.pin import *
160160
elif chip_id == ap_chip.SUNRISE_X3:
161161
from adafruit_blinka.microcontroller.horizon.sunrise_x3.pin import *
162+
elif chip_id == ap_chip.QCM6490:
163+
from adafruit_blinka.microcontroller.quectel.qcm6490.pin import *
162164
elif "sphinx" in sys.modules:
163165
# pylint: disable=unused-import
164166
from adafruit_blinka.microcontroller.generic_micropython import Pin

0 commit comments

Comments
 (0)