eric6/MicroPython/MicroPythonDevices.py

Sat, 20 Feb 2021 14:28:14 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 20 Feb 2021 14:28:14 +0100
changeset 8122
eb85ced7844c
parent 8117
aaa5e0eacd4e
child 8133
4d1d1c248f79
permissions
-rw-r--r--

MicroPython
- added support for "Raspberry Pi Pico" (i.e. RP2040 based boards)

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
8122
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
140 "rp2040": {
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
141 "ids": [
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
142 (0x2E8A, 0x0005), # Raspberry Pi Pico
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
143 ],
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
144 "description": QCoreApplication.translate(
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
145 "MicroPythonDevice", "RP2040 based"),
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
146 "icon": "rp2040Device",
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
147 "port_description": "",
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
148 },
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
149
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
150 "generic": {
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
151 # 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
152 "ids": [],
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
153 "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
154 "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
155 "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
156 "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
157 },
7054
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
7787
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
160 IgnoredBoards = (
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
161 (0x8086, 0x9c3d),
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
162 )
9ede0dcfc2ac MicroPythonDevices: added a list of device to be ignored by default.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
163
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 def getSupportedDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 Function to get a list of supported MicroPython devices.
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 @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
170 @rtype set of tuples of (str, str)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 boards = []
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 boards.append(
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 (board, SupportedBoards[board]["description"]))
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 return boards
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 def getFoundDevices():
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 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
182
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
183 @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
184 description, a description, the serial port it is connected at, the
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
185 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
186 and description for unknown devices
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
187 @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
188 list of tuples of (int, int, str)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 from PyQt5.QtSerialPort import QSerialPortInfo
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 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
193 unknownDevices = []
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
195 manualDevices = {}
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
196 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
197 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
198
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 availablePorts = QSerialPortInfo.availablePorts()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 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
201 supported = False
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 vid = port.vendorIdentifier()
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 pid = port.productIdentifier()
8092
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
204
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
205 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
206 # no device detected at port
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
207 continue
c0d72dbba8bb MicroPythonDevices: added an optimisation when scanning for devices.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8084
diff changeset
208
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 for board in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 if ((vid, pid) in SupportedBoards[board]["ids"] or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 (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
212 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
213 # 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
214 # 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
215 if (
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
216 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
217 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
218 ):
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
219 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
220 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
221 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
222 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
223 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
224 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
225 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
226 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
227 ))
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
228 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
229 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
230 # 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
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240 ))
8079
331e717c458e MicroPython: added capability to manually configure devices not yet known by eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8072
diff changeset
241 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
242 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
243 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
244 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
245 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
246 vid, pid, port.description())
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
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
248 return foundDevices, unknownDevices
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 def getDeviceIcon(boardName, iconFormat=True):
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 Function to get the icon for the given board.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 @param boardName name of the board
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 @type str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 @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
258 @type bool
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 @return icon for the board (iconFormat == True) or
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 a pixmap (iconFormat == False)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 @rtype QIcon or QPixmap
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 if boardName in SupportedBoards:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 iconName = SupportedBoards[boardName]["icon"]
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 # return a generic MicroPython icon
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 iconName = "micropython48"
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 if iconFormat:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 return UI.PixmapCache.getIcon(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 else:
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 return UI.PixmapCache.getPixmap(iconName)
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274
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
275 def getDevice(deviceType, microPythonWidget, vid, pid):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 Public method to instantiate a specific MicroPython device interface.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 @param deviceType type of the device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 @type str
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
281 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
282 @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
283 @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
284 @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
285 @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
286 @type int
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 @return instantiated device interface
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 @rtype MicroPythonDevice
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
290 if deviceType == "esp":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
291 from .EspDevices import EspDevice
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
292 return EspDevice(microPythonWidget, deviceType)
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
293 elif deviceType == "circuitpython":
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
294 from .CircuitPythonDevices import CircuitPythonDevice
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
295 return CircuitPythonDevice(microPythonWidget, deviceType)
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
296 elif deviceType in ("bbc_microbit", "calliope"):
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
297 from .MicrobitDevices import MicrobitDevice
7549
fcfbb9e94471 MicroPython: continued implementing support for the "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
298 return MicrobitDevice(microPythonWidget, deviceType)
7295
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
299 elif deviceType == "pyboard":
cf50045a7c0f MicroPython: added support for PyBoard.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
300 from .PyBoardDevices import PyBoardDevice
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
301 return PyBoardDevice(microPythonWidget, deviceType)
8122
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
302 elif deviceType == "rp2040":
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
303 from .RP2040Devices import RP2040Device
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
304 return RP2040Device(microPythonWidget, deviceType)
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
305 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
306 from .GenericMicroPythonDevices import GenericMicroPythonDevice
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
307 return GenericMicroPythonDevice(microPythonWidget, deviceType,
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
308 vid, pid)
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
309 else:
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
310 # nothing specific requested
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
311 return MicroPythonDevice(microPythonWidget, deviceType)
7054
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
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 class MicroPythonDevice(QObject):
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 Base class for the more specific MicroPython devices.
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 """
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
318 def __init__(self, microPythonWidget, deviceType, parent=None):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 Constructor
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
322 @param microPythonWidget reference to the main MicroPython widget
7134
21d23ca51680 Renamed "MicroPythonReplWidget" to "MicroPythonWidget".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7129
diff changeset
323 @type MicroPythonWidget
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
324 @param deviceType device type assigned to this device interface
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
325 @type str
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 @param parent reference to the parent object
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 @type QObject
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 """
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 super(MicroPythonDevice, self).__init__(parent)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
330
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
331 self._deviceType = deviceType
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
332 self.microPython = microPythonWidget
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
8117
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
334 def getDeviceType(self):
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
335 """
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
336 Public method to get the device type.
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
337
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
338 @return type of the device
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
339 @rtype str
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
340 """
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
341 return self._deviceType
aaa5e0eacd4e MicroPython: changed the logic to synchronize the time because some devices don't implement long integer and failed defining the 'set_time()' function.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8096
diff changeset
342
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
343 def setButtons(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
345 Public method to enable the supported action buttons.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
347 self.microPython.setActionButtons(
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
348 open=False, save=False,
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
349 run=False, repl=False, files=False, chart=False)
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
351 def forceInterrupt(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
353 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
354 serial connection.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
356 @return flag indicating an interrupt is needed
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
357 @rtype bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
358 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
359 return True
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
360
7125
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
361 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
362 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
363 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
364
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
365 @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
366 @rtype str
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
367 """
2028553ee58c CircuitPythonDevices, EspDevices, MicroPythonDevices: added a method to get the device name.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7123
diff changeset
368 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
369
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
370 def canStartRepl(self):
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
372 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
373
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
374 @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
375 and a reason why it cannot.
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
376 @rtype tuple of (bool, str)
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
377 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
378 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
379
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
380 def setRepl(self, on):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
381 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
382 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
383
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
384 @param on flag indicating the active status
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
385 @type bool
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
386 """
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
387 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
388
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
389 def canStartPlotter(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
390 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
391 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
392
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
393 @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
394 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
395 @rtype tuple of (bool, str)
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 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
398
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
399 def setPlotter(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
400 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
401 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
402
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
403 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
404 @type bool
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 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
407
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
408 def canRunScript(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
409 """
7091
84d2a73b448a EspDevices, MicroPythonDevices: fixed a wrong source docu string.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7082
diff changeset
410 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
411
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
412 @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
413 Plotter and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
414 @rtype tuple of (bool, str)
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 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
417 " device.")
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 def runScript(self, script):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
420 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
421 Public method to run the given Python script.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
422
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
423 @param script script to be executed
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
424 @type str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
425 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
426 pass
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
427
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
428 def canStartFileManager(self):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
429 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
430 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
431
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
432 @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
433 File Manager and a reason why it cannot.
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
434 @rtype tuple of (bool, str)
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
435 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
436 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
437
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
438 def setFileManager(self, on):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
439 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
440 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
441
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
442 @param on flag indicating the active status
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
443 @type bool
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
444 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
445 pass
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
446
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
447 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
448 """
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
449 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
450
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
451 @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
452 @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
453 """
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
454 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
455
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
456 def getWorkspace(self):
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
457 """
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
458 Public method to get the workspace directory.
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
460 @return workspace directory used for saving files
7054
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 @rtype str
fb84d8489bc1 Started implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 """
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
463 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
464 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
465 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
466 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
467 )
7058
bdd583f96e96 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7054
diff changeset
468
8062
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
469 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
470 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
471 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
472 ones.
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
473
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
474 @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
475 @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
476 @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
477 @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
478 """
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
479 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
480 None,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
481 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
482 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
483 [""] + deviceDirectories,
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
484 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
485 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
486 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
487 else:
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
488 # 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
489 return ""
8dc5acb30a8b MicroPython: implemented code to deal with multiple devices attached to the computer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8055
diff changeset
490
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
491 def sendCommands(self, commandsList):
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
492 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
493 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
494
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
495 @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
496 @type list of str
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
497 """
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
498 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
499 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
500 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
501 # program
e3200e4dfa63 MicroPythonDevices: modifie the rawOn sequence slightly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7065
diff changeset
502 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
503 ]
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
504 newLine = [b'print("\\n")\r', ]
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
505 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
506 commands.append(b'\r')
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
507 commands.append(b'\x04')
8122
eb85ced7844c MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8117
diff changeset
508 rawOff = [b'\x02', b'\x02']
7059
a8fad276cbd5 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7058
diff changeset
509 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
510 self.microPython.commandsInterface().executeAsync(commandSequence)
7065
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
511
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
512 @pyqtSlot()
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
513 def handleDataFlood(self):
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
514 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
515 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
516 """
e3d04faced34 Continued implementing the MicroPython support.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7061
diff changeset
517 pass
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
518
7108
4f6133a01c6a Started rearranging menu structure and testing and fixing on CircuitPython.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7095
diff changeset
519 def addDeviceMenuEntries(self, menu):
7082
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
520 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
521 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
522
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
523 @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
524 @type QMenu
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
525 """
ec199ef0cfc6 MicroPython: continued implementing the file manager widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7068
diff changeset
526 pass
7123
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
527
8096
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
528 def hasFlashMenuEntry(self):
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
529 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
530 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
531
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
532 @return flag indicating a specific flash menu entry
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
533 @rtype bool
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
534 """
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
535 return False
5425a9072300 MicroPython
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8092
diff changeset
536
7123
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
537 def hasTimeCommands(self):
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
538 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
539 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
540
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
541 The default returns True.
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
542
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
543 @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
544 @rtype bool
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
545 """
94948e2aa0a5 Implemented the support for the 'BBC micro:bit' device.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7108
diff changeset
546 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
547
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
548 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
549 """
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
550 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
551 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
552
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
553 @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
554 @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
555 """
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
556 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
557
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
558 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
559 """
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
560 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
561
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
562 @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
563 @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
564 """
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
565 return ""
7328
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
566
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
567 def hasFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
568 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
569 Public method to check, if the device has a configured firmware
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
570 download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
571
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
572 @return flag indicating a configured firmware download URL
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
573 @rtype bool
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
574 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
575 return bool(self.getFirmwareUrl())
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
576
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
577 def getFirmwareUrl(self):
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
578 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
579 Public method to get the device firmware download URL.
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
580
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
581 @return firmware download URL of the device
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
582 @rtype str
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
583 """
e2d85ef3fadb MicroPython:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7295
diff changeset
584 return ""
8038
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
585
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
586 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
587 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
588 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
589 """
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
590 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
591 if url:
73ec029d4107 MicroPython: improved the support for "BBC micro:bit" and "Calliope mini".
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8024
diff changeset
592 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
593
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
594 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
595 """
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
596 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
597
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
598 @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
599 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
600 @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
601 """
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
602 return []

eric ide

mercurial