eric6/MicroPython/MicroPythonDevices.py

changeset 8122
eb85ced7844c
parent 8117
aaa5e0eacd4e
child 8133
4d1d1c248f79
equal deleted inserted replaced
8121:9a2aa5353a32 8122:eb85ced7844c
135 "description": "PyBoard", 135 "description": "PyBoard",
136 "icon": "micropython48", 136 "icon": "micropython48",
137 "port_description": "", 137 "port_description": "",
138 }, 138 },
139 139
140 # TODO: add RP2040 boards (VID: 0x2e8a, PID: 0x0005) 140 "rp2040": {
141 "ids": [
142 (0x2E8A, 0x0005), # Raspberry Pi Pico
143 ],
144 "description": QCoreApplication.translate(
145 "MicroPythonDevice", "RP2040 based"),
146 "icon": "rp2040Device",
147 "port_description": "",
148 },
149
141 "generic": { 150 "generic": {
142 # only manually configured devices use this 151 # only manually configured devices use this
143 "ids": [], 152 "ids": [],
144 "description": QCoreApplication.translate( 153 "description": QCoreApplication.translate(
145 "MicroPythonDevice", "Generic Board"), 154 "MicroPythonDevice", "Generic Board"),
288 from .MicrobitDevices import MicrobitDevice 297 from .MicrobitDevices import MicrobitDevice
289 return MicrobitDevice(microPythonWidget, deviceType) 298 return MicrobitDevice(microPythonWidget, deviceType)
290 elif deviceType == "pyboard": 299 elif deviceType == "pyboard":
291 from .PyBoardDevices import PyBoardDevice 300 from .PyBoardDevices import PyBoardDevice
292 return PyBoardDevice(microPythonWidget, deviceType) 301 return PyBoardDevice(microPythonWidget, deviceType)
293 # TODO: add RP2040 boards (VID: 0x2e8a, PID: 0x0005) 302 elif deviceType == "rp2040":
303 from .RP2040Devices import RP2040Device
304 return RP2040Device(microPythonWidget, deviceType)
294 elif deviceType == "generic": 305 elif deviceType == "generic":
295 from .GenericMicroPythonDevices import GenericMicroPythonDevice 306 from .GenericMicroPythonDevices import GenericMicroPythonDevice
296 return GenericMicroPythonDevice(microPythonWidget, deviceType, 307 return GenericMicroPythonDevice(microPythonWidget, deviceType,
297 vid, pid) 308 vid, pid)
298 else: 309 else:
492 ] 503 ]
493 newLine = [b'print("\\n")\r', ] 504 newLine = [b'print("\\n")\r', ]
494 commands = [c.encode("utf-8)") + b'\r' for c in commandsList] 505 commands = [c.encode("utf-8)") + b'\r' for c in commandsList]
495 commands.append(b'\r') 506 commands.append(b'\r')
496 commands.append(b'\x04') 507 commands.append(b'\x04')
497 rawOff = [b'\x02'] 508 rawOff = [b'\x02', b'\x02']
498 commandSequence = rawOn + newLine + commands + rawOff 509 commandSequence = rawOn + newLine + commands + rawOff
499 self.microPython.commandsInterface().executeAsync(commandSequence) 510 self.microPython.commandsInterface().executeAsync(commandSequence)
500 511
501 @pyqtSlot() 512 @pyqtSlot()
502 def handleDataFlood(self): 513 def handleDataFlood(self):

eric ide

mercurial