eric7.MicroPython.Devices.RP2040Devices

Module implementing the device interface class for RP2040 based boards (e.g. Raspberry Pi Pico).

Global Attributes

None

Classes

RP2040Device Class implementing the device for RP2040 based boards.

Functions

createDevice Function to instantiate a MicroPython device object.


RP2040Device

Class implementing the device for RP2040 based boards.

Derived from

BaseDevice

Class Attributes

None

Class Methods

None

Methods

RP2040Device Constructor
__activateBootloader Private method to switch the board into 'bootloader' mode.
__createRP2040Menu Private method to create the RO2040 submenu.
__firmwareVersionResponse Private method handling the response of the latest version request.
__flashPython Private slot to flash a MicroPython firmware to the device.
__showFirmwareVersions Private slot to show the firmware version of the connected device and the available firmware version.
_getSetTimeCode Protected method to get the device code to set the time.
addDeviceMenuEntries Public method to add device specific entries to the given menu.
canRunScript Public method to determine, if a script can be executed.
canStartFileManager Public method to determine, if a File Manager can be started.
canStartPlotter Public method to determine, if a Plotter can be started.
canStartRepl Public method to determine, if a REPL can be started.
deviceName Public method to get the name of the device.
forceInterrupt Public method to determine the need for an interrupt when opening the serial connection.
getDocumentationUrl Public method to get the device documentation URL.
getDownloadMenuEntries Public method to retrieve the entries for the downloads menu.
hasFlashMenuEntry Public method to check, if the device has its own flash menu entry.
runScript Public method to run the given Python script.
setButtons Public method to enable the supported action buttons.

Static Methods

None

RP2040Device (Constructor)

RP2040Device(microPythonWidget, deviceType, parent=None)

Constructor

microPythonWidget (MicroPythonWidget)
reference to the main MicroPython widget
deviceType (str)
device type assigned to this device interface
parent (QObject)
reference to the parent object

RP2040Device.__activateBootloader

__activateBootloader()

Private method to switch the board into 'bootloader' mode.

RP2040Device.__createRP2040Menu

__createRP2040Menu()

Private method to create the RO2040 submenu.

RP2040Device.__firmwareVersionResponse

__firmwareVersionResponse(reply)

Private method handling the response of the latest version request.

reply (QNetworkReply)
reference to the reply object

RP2040Device.__flashPython

__flashPython()

Private slot to flash a MicroPython firmware to the device.

RP2040Device.__showFirmwareVersions

__showFirmwareVersions()

Private slot to show the firmware version of the connected device and the available firmware version.

RP2040Device._getSetTimeCode

_getSetTimeCode()

Protected method to get the device code to set the time.

Note: This method must be implemented in the various device specific subclasses.

Return:
code to be executed on the connected device to set the time
Return Type:
str

RP2040Device.addDeviceMenuEntries

addDeviceMenuEntries(menu)

Public method to add device specific entries to the given menu.

menu (QMenu)
reference to the context menu

RP2040Device.canRunScript

canRunScript()

Public method to determine, if a script can be executed.

Return:
tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.
Return Type:
tuple of (bool, str)

RP2040Device.canStartFileManager

canStartFileManager()

Public method to determine, if a File Manager can be started.

Return:
tuple containing a flag indicating it is safe to start a File Manager and a reason why it cannot.
Return Type:
tuple of (bool, str)

RP2040Device.canStartPlotter

canStartPlotter()

Public method to determine, if a Plotter can be started.

Return:
tuple containing a flag indicating it is safe to start a Plotter and a reason why it cannot.
Return Type:
tuple of (bool, str)

RP2040Device.canStartRepl

canStartRepl()

Public method to determine, if a REPL can be started.

Return:
tuple containing a flag indicating it is safe to start a REPL and a reason why it cannot.
Return Type:
tuple of (bool, str)

RP2040Device.deviceName

deviceName()

Public method to get the name of the device.

Return:
name of the device
Return Type:
str

RP2040Device.forceInterrupt

forceInterrupt()

Public method to determine the need for an interrupt when opening the serial connection.

Return:
flag indicating an interrupt is needed
Return Type:
bool

RP2040Device.getDocumentationUrl

getDocumentationUrl()

Public method to get the device documentation URL.

Return:
documentation URL of the device
Return Type:
str

RP2040Device.getDownloadMenuEntries

getDownloadMenuEntries()

Public method to retrieve the entries for the downloads menu.

Return:
list of tuples with menu text and URL to be opened for each entry
Return Type:
list of tuple of (str, str)

RP2040Device.hasFlashMenuEntry

hasFlashMenuEntry()

Public method to check, if the device has its own flash menu entry.

Return:
flag indicating a specific flash menu entry
Return Type:
bool

RP2040Device.runScript

runScript(script)

Public method to run the given Python script.

script (str)
script to be executed

RP2040Device.setButtons

setButtons()

Public method to enable the supported action buttons.

Up


createDevice

createDevice(microPythonWidget, deviceType, vid, pid, boardName, serialNumber)

Function to instantiate a MicroPython device object.

microPythonWidget (MicroPythonWidget)
reference to the main MicroPython widget
deviceType (str)
device type assigned to this device interface
vid (int)
vendor ID
pid (int)
product ID
boardName (str)
name of the board
serialNumber (str)
serial number of the board
Return:
reference to the instantiated device object
Return Type:
RP2040Device
Up