src/eric7/Documentation/Source/eric7.MicroPython.Devices.CircuitPythonDevices.html

Tue, 21 Feb 2023 10:56:54 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 21 Feb 2023 10:56:54 +0100
branch
eric7
changeset 9785
84684a40187d
parent 9756
9854647c8c5c
child 9840
d41ee69fa69b
permissions
-rw-r--r--

Regenerated source documentation.

<!DOCTYPE html>
<html><head>
<title>eric7.MicroPython.Devices.CircuitPythonDevices</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.MicroPython.Devices.CircuitPythonDevices</h1>

<p>
Module implementing the device interface class for CircuitPython boards.
</p>
<h3>Global Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>

<table>

<tr>
<td><a href="#CircuitPythonDevice">CircuitPythonDevice</a></td>
<td>Class implementing the device for CircuitPython boards.</td>
</tr>
</table>
<h3>Functions</h3>

<table>

<tr>
<td><a href="#createDevice">createDevice</a></td>
<td>Function to instantiate a MicroPython device object.</td>
</tr>
</table>
<hr />
<hr />
<a NAME="CircuitPythonDevice" ID="CircuitPythonDevice"></a>
<h2>CircuitPythonDevice</h2>

<p>
    Class implementing the device for CircuitPython boards.
</p>
<h3>Derived from</h3>
BaseDevice
<h3>Class Attributes</h3>

<table>
<tr><td>DeviceVolumeName</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#CircuitPythonDevice.__init__">CircuitPythonDevice</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__aboutToShowLibraryMenu">__aboutToShowLibraryMenu</a></td>
<td>Private slot to populate the 'Library Management' menu.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__cpyVersionResponse">__cpyVersionResponse</a></td>
<td>Private method handling the response of the latest version request.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__createCPyMenu">__createCPyMenu</a></td>
<td>Private method to create the CircuitPython submenu.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__deviceVolumeMounted">__deviceVolumeMounted</a></td>
<td>Private method to check, if the device volume is mounted.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__findDeviceDirectories">__findDeviceDirectories</a></td>
<td>Private method to find the device directories associated with the current board name.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__findWorkspace">__findWorkspace</a></td>
<td>Private method to find the workspace directory.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__flashCircuitPython">__flashCircuitPython</a></td>
<td>Private slot to flash a CircuitPython firmware to a device supporting UF2.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__installLibraryFiles">__installLibraryFiles</a></td>
<td>Private slot to install Python files into the onboard library.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__showCircuitPythonVersions">__showCircuitPythonVersions</a></td>
<td>Private slot to show the CircuitPython version of a connected device and the latest available one (from Github).</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__showTeensyFlashInstructions">__showTeensyFlashInstructions</a></td>
<td>Private method to show a message box because Teensy does not support the UF2 bootloader yet.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.__startTeensyLoader">__startTeensyLoader</a></td>
<td>Private method to start the 'Teensy Loader' application.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td>
<td>Public method to add device specific entries to the given menu.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.canRunScript">canRunScript</a></td>
<td>Public method to determine, if a script can be executed.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.canStartFileManager">canStartFileManager</a></td>
<td>Public method to determine, if a File Manager can be started.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.canStartPlotter">canStartPlotter</a></td>
<td>Public method to determine, if a Plotter can be started.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.canStartRepl">canStartRepl</a></td>
<td>Public method to determine, if a REPL can be started.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.deviceName">deviceName</a></td>
<td>Public method to get the name of the device.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.forceInterrupt">forceInterrupt</a></td>
<td>Public method to determine the need for an interrupt when opening the serial connection.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.getDocumentationUrl">getDocumentationUrl</a></td>
<td>Public method to get the device documentation URL.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.getDownloadMenuEntries">getDownloadMenuEntries</a></td>
<td>Public method to retrieve the entries for the downloads menu.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.getWorkspace">getWorkspace</a></td>
<td>Public method to get the workspace directory.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td>
<td>Public method to check, if the device has its own flash menu entry.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.runScript">runScript</a></td>
<td>Public method to run the given Python script.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.setButtons">setButtons</a></td>
<td>Public method to enable the supported action buttons.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.setConnected">setConnected</a></td>
<td>Public method to set the connection state.</td>
</tr>
<tr>
<td><a href="#CircuitPythonDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td>
<td>Public method to indicate file access via a local directory.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="CircuitPythonDevice.__init__" ID="CircuitPythonDevice.__init__"></a>
<h4>CircuitPythonDevice (Constructor)</h4>
<b>CircuitPythonDevice</b>(<i>microPythonWidget, deviceType, boardName, parent=None</i>)

<p>
        Constructor
</p>
<dl>

<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
<dd>
reference to the main MicroPython widget
</dd>
<dt><i>deviceType</i> (str)</dt>
<dd>
device type assigned to this device interface
</dd>
<dt><i>boardName</i> (str)</dt>
<dd>
name of the board
</dd>
<dt><i>parent</i> (QObject)</dt>
<dd>
reference to the parent object
</dd>
</dl>
<a NAME="CircuitPythonDevice.__aboutToShowLibraryMenu" ID="CircuitPythonDevice.__aboutToShowLibraryMenu"></a>
<h4>CircuitPythonDevice.__aboutToShowLibraryMenu</h4>
<b>__aboutToShowLibraryMenu</b>(<i></i>)

<p>
        Private slot to populate the 'Library Management' menu.
</p>
<a NAME="CircuitPythonDevice.__cpyVersionResponse" ID="CircuitPythonDevice.__cpyVersionResponse"></a>
<h4>CircuitPythonDevice.__cpyVersionResponse</h4>
<b>__cpyVersionResponse</b>(<i>reply</i>)

<p>
        Private method handling the response of the latest version request.
</p>
<dl>

<dt><i>reply</i> (QNetworkReply)</dt>
<dd>
reference to the reply object
</dd>
</dl>
<a NAME="CircuitPythonDevice.__createCPyMenu" ID="CircuitPythonDevice.__createCPyMenu"></a>
<h4>CircuitPythonDevice.__createCPyMenu</h4>
<b>__createCPyMenu</b>(<i></i>)

<p>
        Private method to create the CircuitPython submenu.
</p>
<a NAME="CircuitPythonDevice.__deviceVolumeMounted" ID="CircuitPythonDevice.__deviceVolumeMounted"></a>
<h4>CircuitPythonDevice.__deviceVolumeMounted</h4>
<b>__deviceVolumeMounted</b>(<i></i>)

<p>
        Private method to check, if the device volume is mounted.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicated a mounted device
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CircuitPythonDevice.__findDeviceDirectories" ID="CircuitPythonDevice.__findDeviceDirectories"></a>
<h4>CircuitPythonDevice.__findDeviceDirectories</h4>
<b>__findDeviceDirectories</b>(<i>directories</i>)

<p>
        Private method to find the device directories associated with the
        current board name.
</p>
<dl>

<dt><i>directories</i> (list of str)</dt>
<dd>
list of directories to be checked
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of associated directories
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="CircuitPythonDevice.__findWorkspace" ID="CircuitPythonDevice.__findWorkspace"></a>
<h4>CircuitPythonDevice.__findWorkspace</h4>
<b>__findWorkspace</b>(<i>silent=False</i>)

<p>
        Private method to find the workspace directory.
</p>
<dl>

<dt><i>silent</i> (bool)</dt>
<dd>
flag indicating silent operations
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
workspace directory used for saving files
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CircuitPythonDevice.__flashCircuitPython" ID="CircuitPythonDevice.__flashCircuitPython"></a>
<h4>CircuitPythonDevice.__flashCircuitPython</h4>
<b>__flashCircuitPython</b>(<i></i>)

<p>
        Private slot to flash a CircuitPython firmware to a device supporting UF2.
</p>
<a NAME="CircuitPythonDevice.__installLibraryFiles" ID="CircuitPythonDevice.__installLibraryFiles"></a>
<h4>CircuitPythonDevice.__installLibraryFiles</h4>
<b>__installLibraryFiles</b>(<i>packageMode=False</i>)

<p>
        Private slot to install Python files into the onboard library.
</p>
<dl>

<dt><i>packageMode</i> (bool (optional))</dt>
<dd>
flag indicating to install a library package
            (defaults to False)
</dd>
</dl>
<a NAME="CircuitPythonDevice.__showCircuitPythonVersions" ID="CircuitPythonDevice.__showCircuitPythonVersions"></a>
<h4>CircuitPythonDevice.__showCircuitPythonVersions</h4>
<b>__showCircuitPythonVersions</b>(<i></i>)

<p>
        Private slot to show the CircuitPython version of a connected device and
        the latest available one (from Github).
</p>
<a NAME="CircuitPythonDevice.__showTeensyFlashInstructions" ID="CircuitPythonDevice.__showTeensyFlashInstructions"></a>
<h4>CircuitPythonDevice.__showTeensyFlashInstructions</h4>
<b>__showTeensyFlashInstructions</b>(<i></i>)

<p>
        Private method to show a message box because Teensy does not support
        the UF2 bootloader yet.
</p>
<a NAME="CircuitPythonDevice.__startTeensyLoader" ID="CircuitPythonDevice.__startTeensyLoader"></a>
<h4>CircuitPythonDevice.__startTeensyLoader</h4>
<b>__startTeensyLoader</b>(<i></i>)

<p>
        Private method to start the 'Teensy Loader' application.
</p>
<p>
        Note: The application must be accessible via the application search path.
</p>
<a NAME="CircuitPythonDevice.addDeviceMenuEntries" ID="CircuitPythonDevice.addDeviceMenuEntries"></a>
<h4>CircuitPythonDevice.addDeviceMenuEntries</h4>
<b>addDeviceMenuEntries</b>(<i>menu</i>)

<p>
        Public method to add device specific entries to the given menu.
</p>
<dl>

<dt><i>menu</i> (QMenu)</dt>
<dd>
reference to the context menu
</dd>
</dl>
<a NAME="CircuitPythonDevice.canRunScript" ID="CircuitPythonDevice.canRunScript"></a>
<h4>CircuitPythonDevice.canRunScript</h4>
<b>canRunScript</b>(<i></i>)

<p>
        Public method to determine, if a script can be executed.
</p>
<dl>
<dt>Return:</dt>
<dd>
tuple containing a flag indicating it is safe to start a
            Plotter and a reason why it cannot.
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (bool, str)
</dd>
</dl>
<a NAME="CircuitPythonDevice.canStartFileManager" ID="CircuitPythonDevice.canStartFileManager"></a>
<h4>CircuitPythonDevice.canStartFileManager</h4>
<b>canStartFileManager</b>(<i></i>)

<p>
        Public method to determine, if a File Manager can be started.
</p>
<dl>
<dt>Return:</dt>
<dd>
tuple containing a flag indicating it is safe to start a
            File Manager and a reason why it cannot.
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (bool, str)
</dd>
</dl>
<a NAME="CircuitPythonDevice.canStartPlotter" ID="CircuitPythonDevice.canStartPlotter"></a>
<h4>CircuitPythonDevice.canStartPlotter</h4>
<b>canStartPlotter</b>(<i></i>)

<p>
        Public method to determine, if a Plotter can be started.
</p>
<dl>
<dt>Return:</dt>
<dd>
tuple containing a flag indicating it is safe to start a
            Plotter and a reason why it cannot.
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (bool, str)
</dd>
</dl>
<a NAME="CircuitPythonDevice.canStartRepl" ID="CircuitPythonDevice.canStartRepl"></a>
<h4>CircuitPythonDevice.canStartRepl</h4>
<b>canStartRepl</b>(<i></i>)

<p>
        Public method to determine, if a REPL can be started.
</p>
<dl>
<dt>Return:</dt>
<dd>
tuple containing a flag indicating it is safe to start a REPL
            and a reason why it cannot.
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
tuple of (bool, str)
</dd>
</dl>
<a NAME="CircuitPythonDevice.deviceName" ID="CircuitPythonDevice.deviceName"></a>
<h4>CircuitPythonDevice.deviceName</h4>
<b>deviceName</b>(<i></i>)

<p>
        Public method to get the name of the device.
</p>
<dl>
<dt>Return:</dt>
<dd>
name of the device
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CircuitPythonDevice.forceInterrupt" ID="CircuitPythonDevice.forceInterrupt"></a>
<h4>CircuitPythonDevice.forceInterrupt</h4>
<b>forceInterrupt</b>(<i></i>)

<p>
        Public method to determine the need for an interrupt when opening the
        serial connection.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating an interrupt is needed
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CircuitPythonDevice.getDocumentationUrl" ID="CircuitPythonDevice.getDocumentationUrl"></a>
<h4>CircuitPythonDevice.getDocumentationUrl</h4>
<b>getDocumentationUrl</b>(<i></i>)

<p>
        Public method to get the device documentation URL.
</p>
<dl>
<dt>Return:</dt>
<dd>
documentation URL of the device
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CircuitPythonDevice.getDownloadMenuEntries" ID="CircuitPythonDevice.getDownloadMenuEntries"></a>
<h4>CircuitPythonDevice.getDownloadMenuEntries</h4>
<b>getDownloadMenuEntries</b>(<i></i>)

<p>
        Public method to retrieve the entries for the downloads menu.
</p>
<dl>
<dt>Return:</dt>
<dd>
list of tuples with menu text and URL to be opened for each
            entry
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of tuple of (str, str)
</dd>
</dl>
<a NAME="CircuitPythonDevice.getWorkspace" ID="CircuitPythonDevice.getWorkspace"></a>
<h4>CircuitPythonDevice.getWorkspace</h4>
<b>getWorkspace</b>(<i>silent=False</i>)

<p>
        Public method to get the workspace directory.
</p>
<dl>

<dt><i>silent</i> (bool)</dt>
<dd>
flag indicating silent operations
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
workspace directory used for saving files
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="CircuitPythonDevice.hasFlashMenuEntry" ID="CircuitPythonDevice.hasFlashMenuEntry"></a>
<h4>CircuitPythonDevice.hasFlashMenuEntry</h4>
<b>hasFlashMenuEntry</b>(<i></i>)

<p>
        Public method to check, if the device has its own flash menu entry.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating a specific flash menu entry
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="CircuitPythonDevice.runScript" ID="CircuitPythonDevice.runScript"></a>
<h4>CircuitPythonDevice.runScript</h4>
<b>runScript</b>(<i>script</i>)

<p>
        Public method to run the given Python script.
</p>
<dl>

<dt><i>script</i> (str)</dt>
<dd>
script to be executed
</dd>
</dl>
<a NAME="CircuitPythonDevice.setButtons" ID="CircuitPythonDevice.setButtons"></a>
<h4>CircuitPythonDevice.setButtons</h4>
<b>setButtons</b>(<i></i>)

<p>
        Public method to enable the supported action buttons.
</p>
<a NAME="CircuitPythonDevice.setConnected" ID="CircuitPythonDevice.setConnected"></a>
<h4>CircuitPythonDevice.setConnected</h4>
<b>setConnected</b>(<i>connected</i>)

<p>
        Public method to set the connection state.
</p>
<dl>

<dt><i>connected</i> (bool)</dt>
<dd>
connection state
</dd>
</dl>
<a NAME="CircuitPythonDevice.supportsLocalFileAccess" ID="CircuitPythonDevice.supportsLocalFileAccess"></a>
<h4>CircuitPythonDevice.supportsLocalFileAccess</h4>
<b>supportsLocalFileAccess</b>(<i></i>)

<p>
        Public method to indicate file access via a local directory.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating file access via local directory
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="createDevice" ID="createDevice"></a>
<h2>createDevice</h2>
<b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>)

<p>
    Function to instantiate a MicroPython device object.
</p>
<dl>

<dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
<dd>
reference to the main MicroPython widget
</dd>
<dt><i>deviceType</i> (str)</dt>
<dd>
device type assigned to this device interface
</dd>
<dt><i>vid</i> (int)</dt>
<dd>
vendor ID
</dd>
<dt><i>pid</i> (int)</dt>
<dd>
product ID
</dd>
<dt><i>boardName</i> (str)</dt>
<dd>
name of the board
</dd>
<dt><i>serialNumber</i> (str)</dt>
<dd>
serial number of the board
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
reference to the instantiated device object
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
CircuitPythonDevice
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial