--- a/eric6/MicroPython/MicroPythonDevices.py Fri Feb 19 17:34:33 2021 +0100 +++ b/eric6/MicroPython/MicroPythonDevices.py Sat Feb 20 11:52:49 2021 +0100 @@ -137,6 +137,7 @@ "port_description": "", }, + # TODO: add RP2040 boards (VID: 0x2e8a, PID: 0x0005) "generic": { # only manually configured devices use this "ids": [], @@ -279,41 +280,55 @@ """ if deviceType == "esp": from .EspDevices import EspDevice - return EspDevice(microPythonWidget) + return EspDevice(microPythonWidget, deviceType) elif deviceType == "circuitpython": from .CircuitPythonDevices import CircuitPythonDevice - return CircuitPythonDevice(microPythonWidget) + return CircuitPythonDevice(microPythonWidget, deviceType) elif deviceType in ("bbc_microbit", "calliope"): from .MicrobitDevices import MicrobitDevice return MicrobitDevice(microPythonWidget, deviceType) elif deviceType == "pyboard": from .PyBoardDevices import PyBoardDevice - return PyBoardDevice(microPythonWidget) + return PyBoardDevice(microPythonWidget, deviceType) + # TODO: add RP2040 boards (VID: 0x2e8a, PID: 0x0005) elif deviceType == "generic": from .GenericMicroPythonDevices import GenericMicroPythonDevice - return GenericMicroPythonDevice(microPythonWidget, vid, pid) + return GenericMicroPythonDevice(microPythonWidget, deviceType, + vid, pid) else: # nothing specific requested - return MicroPythonDevice(microPythonWidget) + return MicroPythonDevice(microPythonWidget, deviceType) class MicroPythonDevice(QObject): """ Base class for the more specific MicroPython devices. """ - def __init__(self, microPythonWidget, parent=None): + def __init__(self, microPythonWidget, deviceType, parent=None): """ Constructor @param microPythonWidget reference to the main MicroPython widget @type MicroPythonWidget + @param deviceType device type assigned to this device interface + @type str @param parent reference to the parent object @type QObject """ super(MicroPythonDevice, self).__init__(parent) + self._deviceType = deviceType self.microPython = microPythonWidget + def getDeviceType(self): + """ + Public method to get the device type. + + @return type of the device + @rtype str + """ + return self._deviceType + def setButtons(self): """ Public method to enable the supported action buttons.