eric6/MicroPython/MicroPythonDevices.py

changeset 8038
73ec029d4107
parent 8024
e0eb1d5922a5
child 8051
b78279548993
equal deleted inserted replaced
8037:cf0e5b8cd23a 8038:73ec029d4107
10 10
11 import logging 11 import logging
12 import os 12 import os
13 13
14 from PyQt5.QtCore import pyqtSlot, QObject 14 from PyQt5.QtCore import pyqtSlot, QObject
15
16 from E5Gui.E5Application import e5App
15 17
16 import UI.PixmapCache 18 import UI.PixmapCache
17 import Preferences 19 import Preferences
18 20
19 21
30 (0x0403, 0x6015), # Sparkfun ESP32 32 (0x0403, 0x6015), # Sparkfun ESP32
31 (0x0403, 0x601C), # FT4222H 33 (0x0403, 0x601C), # FT4222H
32 ], 34 ],
33 "description": "ESP8266, ESP32", 35 "description": "ESP8266, ESP32",
34 "icon": "esp32Device", 36 "icon": "esp32Device",
37 "port_description": "",
35 }, 38 },
36 39
37 "circuitpython": { 40 "circuitpython": {
38 "ids": [ 41 "ids": [
39 (0x2B04, 0xC00C), # Particle Argon 42 (0x2B04, 0xC00C), # Particle Argon
65 (0x1209, 0x4DDE), # ODT CP Sapling M0 w/ SPI Flash 68 (0x1209, 0x4DDE), # ODT CP Sapling M0 w/ SPI Flash
66 (0x054C, 0x0BC2), # Spresense 69 (0x054C, 0x0BC2), # Spresense
67 ], 70 ],
68 "description": "CircuitPython Board", 71 "description": "CircuitPython Board",
69 "icon": "circuitPythonDevice", 72 "icon": "circuitPythonDevice",
73 "port_description": "",
70 }, 74 },
71 75
72 "bbc_microbit": { 76 "bbc_microbit": {
73 "ids": [ 77 "ids": [
74 (0x0D28, 0x0204), # micro:bit 78 (0x0D28, 0x0204), # micro:bit
75 ], 79 ],
76 "description": "BBC micro:bit", 80 "description": "BBC micro:bit",
77 "icon": "microbitDevice", 81 "icon": "microbitDevice",
82 "port_description": "BBC micro:bit CMSIS-DAP",
78 }, 83 },
79 84
80 "calliope": { 85 "calliope": {
81 "ids": [ 86 "ids": [
82 (0x0D28, 0x0204), # Calliope mini 87 (0x0D28, 0x0204), # Calliope mini
83 ], 88 ],
84 "description": "Calliope mini", 89 "description": "Calliope mini",
85 "icon": "calliope_mini", 90 "icon": "calliope_mini",
91 "port_description": "DAPLink CMSIS-DAP",
86 }, 92 },
87 93
88 "pyboard": { 94 "pyboard": {
89 "ids": [ 95 "ids": [
90 (0xF055, 0x9800), # Pyboard in CDC mode 96 (0xF055, 0x9800), # Pyboard in CDC mode
91 (0xF055, 0x9801), # Pyboard in CDC+HID mode 97 (0xF055, 0x9801), # Pyboard in CDC+HID mode
92 (0xF055, 0x9802), # Pyboard in CDC+MSC mode 98 (0xF055, 0x9802), # Pyboard in CDC+MSC mode
93 ], 99 ],
94 "description": "PyBoard", 100 "description": "PyBoard",
95 "icon": "micropython48", 101 "icon": "micropython48",
102 "port_description": "",
96 }, 103 },
97 } 104 }
98 105
99 IgnoredBoards = ( 106 IgnoredBoards = (
100 (0x8086, 0x9c3d), 107 (0x8086, 0x9c3d),
137 vid = port.vendorIdentifier() 144 vid = port.vendorIdentifier()
138 pid = port.productIdentifier() 145 pid = port.productIdentifier()
139 for board in SupportedBoards: 146 for board in SupportedBoards:
140 if ((vid, pid) in SupportedBoards[board]["ids"] or 147 if ((vid, pid) in SupportedBoards[board]["ids"] or
141 (vid, None) in SupportedBoards[board]["ids"]): 148 (vid, None) in SupportedBoards[board]["ids"]):
149 if board in ("bbc_microbit", "calliope"):
150 # both boards have the same VID and PID
151 # try to differentiate based on port description
152 if (
153 port.description().strip() !=
154 SupportedBoards[board]["port_description"]
155 ):
156 continue
142 foundDevices.append( 157 foundDevices.append(
143 (board, SupportedBoards[board]["description"], 158 (board, SupportedBoards[board]["description"],
144 port.portName())) 159 port.portName()))
145 supported = True 160 supported = True
146 if not supported: 161 if not supported:
427 442
428 @return firmware download URL of the device 443 @return firmware download URL of the device
429 @rtype str 444 @rtype str
430 """ 445 """
431 return "" 446 return ""
447
448 def downloadFirmware(self):
449 """
450 Public method to download the device firmware.
451 """
452 url = self.getFirmwareUrl()
453 if url:
454 e5App().getObject("UserInterface").launchHelpViewer(url)

eric ide

mercurial