eric6/MicroPython/MicroPythonDevices.py

Fri, 12 Feb 2021 16:15:18 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 12 Feb 2021 16:15:18 +0100
changeset 8096
5425a9072300
parent 8092
c0d72dbba8bb
child 8117
aaa5e0eacd4e
permissions
-rw-r--r--

MicroPython
- added a generic dialog for flashing UF2 capable devices (with device detection)

7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7787
diff changeset
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing some utility functions and the MicroPythonDevice base
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 class.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import logging
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
12 import os
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
14 from PyQt5.QtCore import pyqtSlot, QObject, QCoreApplication
8062
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
15 from PyQt5.QtWidgets import QInputDialog
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
17 from E5Gui.E5Application import e5App
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
18
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import UI.PixmapCache
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
20 import Preferences
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 SupportedBoards = {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 "esp": {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 "ids": [
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
26 (0x0403, 0x6001), # M5Stack ESP32 device"),
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
27 (0x0403, 0x6001), # FT232/FT245 (XinaBox CW01, CW02)
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
28 (0x0403, 0x6010), # FT2232C/D/L/HL/Q (ESP-WROVER-KIT)
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
29 (0x0403, 0x6011), # FT4232
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
30 (0x0403, 0x6014), # FT232H
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
31 (0x0403, 0x6015), # Sparkfun ESP32
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
32 (0x0403, 0x601C), # FT4222H
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
33 (0x10C4, 0xEA60), # CP210x
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
34 (0x1A86, 0x7523), # HL-340
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 ],
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
36 "description": "ESP32, ESP8266",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 "icon": "esp32Device",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
38 "port_description": "",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 },
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
41 "circuitpython": {
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 "ids": [
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
43 (0x04D8, 0xEAD1), # BH Dynamics DynOSSAT-EDU-EPS-v1.0
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
44 (0x04D8, 0xEAD2), # BH Dynamics DynOSSAT-EDU-OBC-v1.0
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
45 (0x04D8, 0xEC44), # maholli PyCubed
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
46 (0x04D8, 0xEC63), # Kevin Neubauer CircuitBrains Basic
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
47 (0x04D8, 0xEC64), # Kevin Neubauer CircuitBrains Deluxe
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
48 (0x04D8, 0xEC72), # XinaBox CC03
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
49 (0x04D8, 0xEC75), # XinaBox CS11
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
50 (0x04D8, 0xED5F), # Itaca Innovation uChip CircuitPython
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
51 (0x04D8, 0xED94), # maholli kicksat-sprite
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
52 (0x04D8, 0xEDB3), # Capable Robot Programmable USB Hub
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
53 (0x04D8, 0xEDBE), # maholli SAM32
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
54 (0x04D8, 0xEE8C), # J&J Studios LLC datum-Distance
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
55 (0x04D8, 0xEE8D), # J&J Studios LLC datum-IMU
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
56 (0x04D8, 0xEE8E), # J&J Studios LLC datum-Light
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
57 (0x04D8, 0xEE8F), # J&J Studios LLC datum-Weather
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
58 (0x054C, 0x0BC2), # Sony Spresense
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
59 (0x1209, 0x2017), # Benjamin Shockley Mini SAM M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
60 (0x1209, 0x3252), # Targett Module Clip w/Wroom
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
61 (0x1209, 0x3253), # Targett Module Clip w/Wrover
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
62 (0x1209, 0x4D43), # Robotics Masters Robo HAT MM1 M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
63 (0x1209, 0x4DDD), # ODT CP Sapling
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
64 (0x1209, 0x4DDE), # ODT CP Sapling M0 w/ SPI Flash
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
65 (0x1209, 0x5BF0), # Foosn Fomu
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
66 (0x1209, 0x805A), # Electronic Cats BastBLE
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
67 (0x1209, 0xBAB0), # Electronic Cats Bast WiFi
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
68 (0x1209, 0xBAB1), # Electronic Cats Meow Meow
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
69 (0x1209, 0xBAB2), # Electronic Cats CatWAN USBStick
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
70 (0x1209, 0xBAB3), # Electronic Cats Bast Pro Mini M0
8024
e0eb1d5922a5 MicroPython: added a few device IDs (taken from mu-Editor).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
71 (0x1209, 0xBAB6), # Electronic Cats Escornabot Makech
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
72 (0x1209, 0xBAB8), # Electronic Cats NFC Copy Cat
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
73 (0x1209, 0xC051), # Betrusted Simmel
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
74 (0x1209, 0xE3E3), # StackRduino M0 PRO
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
75 (0x1209, 0xF500), # Silicognition LLC M4-Shim
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
76 (0x1915, 0xB001), # Makerdiary Pitaya Go
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
77 (0x1B4F, 0x0015), # SparkFun RedBoard Turbo Board
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
78 (0x1B4F, 0x0016), # SparkFun SAMD51 Thing+
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
79 (0x1B4F, 0x0017), # SparkFun LUMIDrive Board
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
80 (0x1B4F, 0x5289), # SparkFun SFE_nRF52840_Mini
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
81 (0x1B4F, 0x8D22), # SparkFun SAMD21 Mini Breakout
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
82 (0x1B4F, 0x8D23), # SparkFun SAMD21 Dev Breakout
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
83 (0x1B4F, 0x8D24), # SparkFun Qwiic Micro
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
84 (0x1D50, 0x60E8), # Radomir Dopieralski PewPew M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
85 (0x2341, 0x8053), # Arduino MKR1300
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
86 (0x2341, 0x8057), # Arduino Nano 33 IoT
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
87 (0x2341, 0x805A), # Arduino Arduino_Nano_33_BLE
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
88 (0x2341, 0x824D), # Arduino Zero
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
89 (0x2786, 0x9207), # Switch Sc. BLE-SS dev board Multi Sensor
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
90 (0x2886, 0x002F), # Seeed Seeeduino XIAO
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
91 (0x2886, 0x802D), # Seeed Seeeduino Wio Terminal
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
92 (0x2886, 0xF001), # Makerdiary nRF52840 M.2 Developer Kit
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
93 (0x2886, 0xF002), # Makerdiary M60 Keyboard
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
94 (0x2B04, 0xC00C), # Particle Argon
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
95 (0x2B04, 0xC00D), # Particle Boron
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
96 (0x2B04, 0xC00E), # Particle Xenon
8084
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
97 (0x303A, 0x8007), # LILYGO TTGO T8 ESP32-S2
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
98 (0x3171, 0x0101), # 8086 Consultancy Commander
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
99 (0x31E2, 0x2001), # BDMICRO LLC VINA-D21
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
100 (0x31E2, 0x2011), # BDMICRO LLC VINA-D51
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
101 (0x32BD, 0x3001), # Alorium Tech. AloriumTech Evo M51
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
102 (0x4097, 0x0001), # TG-Boards Datalore IP M4
7742e0b96629 MicroPython: extended the list of known CircuitPython devices by extracting the VID/PID from the CorcuitPython sources.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8082
diff changeset
103
8072
58491f4c99d6 MicroPython: added code to give a hint for CircuitPython devices, that do not support the UF2 bootloader for flashing.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8067
diff changeset
104 (0x239A, None), # Any Adafruit Boards
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 ],
8055
52fdd41517f3 MicroPython: made the value shown in the deveice selection list more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8051
diff changeset
106 "description": "CircuitPython",
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
107 "icon": "circuitPythonDevice",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
108 "port_description": "",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 },
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 "bbc_microbit": {
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 "ids": [
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
113 (0x0D28, 0x0204), # micro:bit
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 ],
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 "description": "BBC micro:bit",
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 "icon": "microbitDevice",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
117 "port_description": "BBC micro:bit CMSIS-DAP",
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 },
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
119
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
120 "calliope": {
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
121 "ids": [
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
122 (0x0D28, 0x0204), # Calliope mini
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
123 ],
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
124 "description": "Calliope mini",
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
125 "icon": "calliope_mini",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
126 "port_description": "DAPLink CMSIS-DAP",
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
127 },
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
128
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
129 "pyboard": {
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
130 "ids": [
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
131 (0xF055, 0x9800), # Pyboard in CDC mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
132 (0xF055, 0x9801), # Pyboard in CDC+HID mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
133 (0xF055, 0x9802), # Pyboard in CDC+MSC mode
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 ],
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
135 "description": "PyBoard",
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
136 "icon": "micropython48",
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
137 "port_description": "",
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
138 },
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
139
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
140 "generic": {
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
141 # only manually configured devices use this
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
142 "ids": [],
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
143 "description": QCoreApplication.translate(
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
144 "MicroPythonDevice", "Generic Board"),
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
145 "icon": "micropython48",
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
146 "port_description": "",
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
147 },
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 }
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149
7787
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
150 IgnoredBoards = (
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
151 (0x8086, 0x9c3d),
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
152 )
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
153
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 def getSupportedDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 Function to get a list of supported MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 @return set of tuples with the board type and description
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @rtype set of tuples of (str, str)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 boards = []
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 boards.append(
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 (board, SupportedBoards[board]["description"]))
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 return boards
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 def getFoundDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 Function to check the serial ports for supported MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
173 @return tuple containing a list of tuples with the board type, the port
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
174 description, a description, the serial port it is connected at, the
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
175 VID and PID for known device types and a list of tuples with VID, PID
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
176 and description for unknown devices
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
177 @rtype tuple of (list of tuples of (str, str, str, str, int, int),
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
178 list of tuples of (int, int, str)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 from PyQt5.QtSerialPort import QSerialPortInfo
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 foundDevices = []
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
183 unknownDevices = []
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
185 manualDevices = {}
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
186 for deviceDict in Preferences.getMicroPython("ManualDevices"):
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
187 manualDevices[(deviceDict["vid"], deviceDict["pid"])] = deviceDict
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
188
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 availablePorts = QSerialPortInfo.availablePorts()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 for port in availablePorts:
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
191 supported = False
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 vid = port.vendorIdentifier()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 pid = port.productIdentifier()
8092
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
194
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
195 if vid == 0 and pid == 0:
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
196 # no device detected at port
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
197 continue
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
198
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 if ((vid, pid) in SupportedBoards[board]["ids"] or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 (vid, None) in SupportedBoards[board]["ids"]):
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
202 if board in ("bbc_microbit", "calliope"):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
203 # both boards have the same VID and PID
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
204 # try to differentiate based on port description
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
205 if (
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
206 port.description().strip() !=
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
207 SupportedBoards[board]["port_description"]
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
208 ):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
209 continue
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
210 foundDevices.append((
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
211 board,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
212 port.description(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
213 SupportedBoards[board]["description"],
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
214 port.portName(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
215 vid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
216 pid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
217 ))
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
218 supported = True
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
219 if not supported:
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
220 # check the locally added ones next
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
221 if (vid, pid) in manualDevices:
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
222 board = manualDevices[(vid, pid)]["type"]
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
223 foundDevices.append((
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
224 board,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
225 port.description(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
226 SupportedBoards[board]["description"],
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
227 port.portName(),
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
228 vid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
229 pid,
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
230 ))
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
231 supported = True
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
232 if not supported:
7787
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
233 if vid and pid and (vid, pid) not in IgnoredBoards:
7592
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
234 unknownDevices.append((vid, pid, port.description()))
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
235 logging.debug("Unknown device: (0x%04x:0x%04x %s)",
f79dc58bdf62 MicroPython: added a dialog zo ignore unknown serial devices and to manage this list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7588
diff changeset
236 vid, pid, port.description())
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
7588
881eebfefd34 MicroPython: added code to report detected non-supported devices to the user asking to report them.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7549
diff changeset
238 return foundDevices, unknownDevices
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 def getDeviceIcon(boardName, iconFormat=True):
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 Function to get the icon for the given board.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 @param boardName name of the board
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 @type str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @param iconFormat flag indicating to get an icon or a pixmap
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 @type bool
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 @return icon for the board (iconFormat == True) or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 a pixmap (iconFormat == False)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 @rtype QIcon or QPixmap
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 if boardName in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 iconName = SupportedBoards[boardName]["icon"]
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 # return a generic MicroPython icon
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 iconName = "micropython48"
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 if iconFormat:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 return UI.PixmapCache.getIcon(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 return UI.PixmapCache.getPixmap(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
265 def getDevice(deviceType, microPythonWidget, vid, pid):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 Public method to instantiate a specific MicroPython device interface.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 @param deviceType type of the device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 @type str
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
271 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
272 @type MicroPythonWidget
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
273 @param vid vendor ID (only used for deviceType 'generic')
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
274 @type int
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
275 @param pid product ID (only used for deviceType 'generic')
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
276 @type int
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 @return instantiated device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 @rtype MicroPythonDevice
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
280 if deviceType == "esp":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
281 from .EspDevices import EspDevice
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
282 return EspDevice(microPythonWidget)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
283 elif deviceType == "circuitpython":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
284 from .CircuitPythonDevices import CircuitPythonDevice
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
285 return CircuitPythonDevice(microPythonWidget)
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
286 elif deviceType in ("bbc_microbit", "calliope"):
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
287 from .MicrobitDevices import MicrobitDevice
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
288 return MicrobitDevice(microPythonWidget, deviceType)
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
289 elif deviceType == "pyboard":
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
290 from .PyBoardDevices import PyBoardDevice
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
291 return PyBoardDevice(microPythonWidget)
8082
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
292 elif deviceType == "generic":
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
293 from .GenericMicroPythonDevices import GenericMicroPythonDevice
2242a6a1d786 MicroPython: added support for a generic MicroPython device where the user can configure the relevant paramaters through the 'Unknown Devices' dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8079
diff changeset
294 return GenericMicroPythonDevice(microPythonWidget, vid, pid)
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
295 else:
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
296 # nothing specific requested
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
297 return MicroPythonDevice(microPythonWidget)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 class MicroPythonDevice(QObject):
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 Base class for the more specific MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
304 def __init__(self, microPythonWidget, parent=None):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 Constructor
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
308 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
309 @type MicroPythonWidget
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 @param parent reference to the parent object
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 @type QObject
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 super(MicroPythonDevice, self).__init__(parent)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
314
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
315 self.microPython = microPythonWidget
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
317 def setButtons(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
319 Public method to enable the supported action buttons.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
321 self.microPython.setActionButtons(
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
322 open=False, save=False,
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
323 run=False, repl=False, files=False, chart=False)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
325 def forceInterrupt(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
327 Public method to determine the need for an interrupt when opening the
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
328 serial connection.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
330 @return flag indicating an interrupt is needed
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
331 @rtype bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
332 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
333 return True
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
334
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
335 def deviceName(self):
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
336 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
337 Public method to get the name of the device.
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
338
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
339 @return name of the device
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
340 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
341 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
342 return self.tr("Unsupported Device")
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
343
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
344 def canStartRepl(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
346 Public method to determine, if a REPL can be started.
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
347
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
348 @return tuple containing a flag indicating it is safe to start a REPL
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
349 and a reason why it cannot.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
350 @rtype tuple of (bool, str)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
351 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
352 return False, self.tr("REPL is not supported by this device.")
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
353
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
354 def setRepl(self, on):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
355 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
356 Public method to set the REPL status and dependent status.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
358 @param on flag indicating the active status
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
359 @type bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
360 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
361 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
362
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
363 def canStartPlotter(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
364 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
365 Public method to determine, if a Plotter can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
366
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
367 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
368 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
369 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
370 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
371 return False, self.tr("Plotter is not supported by this device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
372
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
373 def setPlotter(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
374 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
375 Public method to set the Plotter status and dependent status.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
376
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
377 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
378 @type bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
379 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
380 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
381
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
382 def canRunScript(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
383 """
7091
84d2a73b448a EspDevices, MicroPythonDevices: fixed a wrong source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7082
diff changeset
384 Public method to determine, if a script can be executed.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
385
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
386 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
387 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
388 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
389 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
390 return False, self.tr("Running scripts is not supported by this"
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
391 " device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
392
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
393 def runScript(self, script):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
394 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
395 Public method to run the given Python script.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
396
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
397 @param script script to be executed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
398 @type str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
399 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
400 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
401
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
402 def canStartFileManager(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
403 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
404 Public method to determine, if a File Manager can be started.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
405
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
406 @return tuple containing a flag indicating it is safe to start a
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
407 File Manager and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
408 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
409 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
410 return False, self.tr("File Manager is not supported by this device.")
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
411
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
412 def setFileManager(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
413 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
414 Public method to set the File Manager status and dependent status.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
415
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
416 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
417 @type bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
418 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
419 pass
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
420
7129
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
421 def supportsLocalFileAccess(self):
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
422 """
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
423 Public method to indicate file access via a local directory.
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
424
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
425 @return flag indicating file access via local directory
7145
ceb3e8b242c1 Regenerated source docu after merge with 'micropython' branch.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7134
diff changeset
426 @rtype bool
7129
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
427 """
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
428 return False # default
3cc19aec959a MicroPythonDevicces: added a method to indicate that a device allows access to its file system via a local directory.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7125
diff changeset
429
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
430 def getWorkspace(self):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
431 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
432 Public method to get the workspace directory.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
434 @return workspace directory used for saving files
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 @rtype str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 """
8067
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
437 return (
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
438 Preferences.getMicroPython("MpyWorkspace") or
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
439 Preferences.getMultiProject("Workspace") or
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
440 os.path.expanduser("~")
a467ab075be0 MicroPython: added buttons to go to the 'home' directory (local and on device) to the MicroPython file manager and improved the workspace handling.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8062
diff changeset
441 )
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
442
8062
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
443 def selectDeviceDirectory(self, deviceDirectories):
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
444 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
445 Public method to select the device directory from a list of detected
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
446 ones.
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
447
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
448 @param deviceDirectories list of directories to select from
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
449 @type list of str
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
450 @return selected directory or an empty string
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
451 @rtype str
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
452 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
453 deviceDirectory, ok = QInputDialog.getItem(
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
454 None,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
455 self.tr("Select Device Directory"),
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
456 self.tr("Select the directory for the connected device:"),
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
457 [""] + deviceDirectories,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
458 0, False)
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
459 if ok:
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
460 return deviceDirectory
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
461 else:
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
462 # user cancelled
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
463 return ""
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
464
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
465 def sendCommands(self, commandsList):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
466 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
467 Public method to send a list of commands to the device.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
468
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
469 @param commandsList list of commands to be sent to the device
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
470 @type list of str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
471 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
472 rawOn = [ # sequence of commands to enter raw mode
7068
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
473 b'\x02', # Ctrl-B: exit raw repl (just in case)
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
474 b'\r\x03\x03\x03', # Ctrl-C three times: interrupt any running
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
475 # program
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
476 b'\r\x01', # Ctrl-A: enter raw REPL
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
477 ]
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
478 newLine = [b'print("\\n")\r', ]
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
479 commands = [c.encode("utf-8)") + b'\r' for c in commandsList]
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
480 commands.append(b'\r')
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
481 commands.append(b'\x04')
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
482 rawOff = [b'\x02']
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
483 commandSequence = rawOn + newLine + commands + rawOff
7095
8e10acb1cd85 Refactored and improved the MicroPython code to be able to show the file manager and the REPL simultaneously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7091
diff changeset
484 self.microPython.commandsInterface().executeAsync(commandSequence)
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
485
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
486 @pyqtSlot()
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
487 def handleDataFlood(self):
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
488 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
489 Public slot handling a data floof from the device.
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
490 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
491 pass
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
492
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7095
diff changeset
493 def addDeviceMenuEntries(self, menu):
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
494 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
495 Public method to add device specific entries to the given menu.
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
496
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
497 @param menu reference to the context menu
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
498 @type QMenu
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
499 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
500 pass
7123
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
501
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
502 def hasFlashMenuEntry(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
503 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
504 Public method to check, if the device has its own flash menu entry.
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
505
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
506 @return flag indicating a specific flash menu entry
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
507 @rtype bool
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
508 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
509 return False
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
510
7123
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
511 def hasTimeCommands(self):
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
512 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
513 Public method to check, if the device supports time commands.
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
514
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
515 The default returns True.
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
516
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
517 @return flag indicating support for time commands
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
518 @rtype bool
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
519 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
520 return True
7161
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
521
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
522 def hasDocumentationUrl(self):
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
523 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
524 Public method to check, if the device has a configured documentation
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
525 URL.
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
526
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
527 @return flag indicating a configured documentation URL
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
528 @rtype bool
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
529 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
530 return bool(self.getDocumentationUrl())
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
531
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
532 def getDocumentationUrl(self):
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
533 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
534 Public method to get the device documentation URL.
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
535
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
536 @return documentation URL of the device
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
537 @rtype str
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
538 """
728018c32b09 MicroPythonWidget: added actions to show the device documentation and to open the configuration page to the hamburger menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7145
diff changeset
539 return ""
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
540
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
541 def hasFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
542 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
543 Public method to check, if the device has a configured firmware
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
544 download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
545
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
546 @return flag indicating a configured firmware download URL
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
547 @rtype bool
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
548 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
549 return bool(self.getFirmwareUrl())
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
550
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
551 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
552 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
553 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
554
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
555 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
556 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
557 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
558 return ""
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
559
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
560 def downloadFirmware(self):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
561 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
562 Public method to download the device firmware.
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
563 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
564 url = self.getFirmwareUrl()
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
565 if url:
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
566 e5App().getObject("UserInterface").launchHelpViewer(url)
8051
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
567
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
568 def getDownloadMenuEntries(self):
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
569 """
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
570 Public method to retrieve the entries for the downloads menu.
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
571
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
572 @return list of tuples with menu text and URL to be opened for each
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
573 entry
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
574 @rtype list of tuple of (str, str)
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
575 """
b78279548993 MicroPython: changed the handling of the download stuff and corrected/extended the Calliope mini path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8038
diff changeset
576 return []

eric ide

mercurial