Sun, 12 Mar 2023 14:56:04 +0100
MicroPython
- Added support for Ethernet enabled boards.
<!DOCTYPE html> <html><head> <title>eric7.MicroPython.Devices.RP2040Devices</title> <meta charset="UTF-8"> <link rel="stylesheet" href="styles.css"> </head> <body> <a NAME="top" ID="top"></a> <h1>eric7.MicroPython.Devices.RP2040Devices</h1> <p> Module implementing the device interface class for RP2040 based boards (e.g. Raspberry Pi Pico). </p> <h3>Global Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Classes</h3> <table> <tr> <td><a href="#RP2040Device">RP2040Device</a></td> <td>Class implementing the device for RP2040 based 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="RP2040Device" ID="RP2040Device"></a> <h2>RP2040Device</h2> <p> Class implementing the device for RP2040 based boards. </p> <h3>Derived from</h3> BaseDevice <h3>Class Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr> <td><a href="#RP2040Device.__init__">RP2040Device</a></td> <td>Constructor</td> </tr> <tr> <td><a href="#RP2040Device.__activateBootloader">__activateBootloader</a></td> <td>Private slot to switch the board into 'bootloader' mode.</td> </tr> <tr> <td><a href="#RP2040Device.__createRP2040Menu">__createRP2040Menu</a></td> <td>Private method to create the RO2040 submenu.</td> </tr> <tr> <td><a href="#RP2040Device.__firmwareVersionResponse">__firmwareVersionResponse</a></td> <td>Private slot handling the response of the latest version request.</td> </tr> <tr> <td><a href="#RP2040Device.__flashPython">__flashPython</a></td> <td>Private slot to flash a MicroPython firmware to the device.</td> </tr> <tr> <td><a href="#RP2040Device.__resetDevice">__resetDevice</a></td> <td>Private slot to reset the connected device.</td> </tr> <tr> <td><a href="#RP2040Device.__setCountry">__setCountry</a></td> <td>Private slot to configure the country of the connected RP2040 device.</td> </tr> <tr> <td><a href="#RP2040Device.__showFirmwareVersions">__showFirmwareVersions</a></td> <td>Private slot to show the firmware version of the connected device and the available firmware version.</td> </tr> <tr> <td><a href="#RP2040Device._getSetTimeCode">_getSetTimeCode</a></td> <td>Protected method to get the device code to set the time.</td> </tr> <tr> <td><a href="#RP2040Device.addDeviceMenuEntries">addDeviceMenuEntries</a></td> <td>Public method to add device specific entries to the given menu.</td> </tr> <tr> <td><a href="#RP2040Device.addDeviceWifiEntries">addDeviceWifiEntries</a></td> <td>Public method to add device specific entries to the given menu.</td> </tr> <tr> <td><a href="#RP2040Device.canRunScript">canRunScript</a></td> <td>Public method to determine, if a script can be executed.</td> </tr> <tr> <td><a href="#RP2040Device.canStartFileManager">canStartFileManager</a></td> <td>Public method to determine, if a File Manager can be started.</td> </tr> <tr> <td><a href="#RP2040Device.canStartPlotter">canStartPlotter</a></td> <td>Public method to determine, if a Plotter can be started.</td> </tr> <tr> <td><a href="#RP2040Device.canStartRepl">canStartRepl</a></td> <td>Public method to determine, if a REPL can be started.</td> </tr> <tr> <td><a href="#RP2040Device.checkInternet">checkInternet</a></td> <td>Public method to check, if the internet can be reached.</td> </tr> <tr> <td><a href="#RP2040Device.checkInternetViaLan">checkInternetViaLan</a></td> <td>Public method to check, if the internet can be reached (LAN variant).</td> </tr> <tr> <td><a href="#RP2040Device.connectToLan">connectToLan</a></td> <td>Public method to connect the connected device to the LAN.</td> </tr> <tr> <td><a href="#RP2040Device.connectWifi">connectWifi</a></td> <td>Public method to connect a device to a WiFi network.</td> </tr> <tr> <td><a href="#RP2040Device.deactivateEthernet">deactivateEthernet</a></td> <td>Public method to deactivate the Ethernet interface of the connected device.</td> </tr> <tr> <td><a href="#RP2040Device.deactivateInterface">deactivateInterface</a></td> <td>Public method to deactivate a given WiFi interface of the connected device.</td> </tr> <tr> <td><a href="#RP2040Device.deviceName">deviceName</a></td> <td>Public method to get the name of the device.</td> </tr> <tr> <td><a href="#RP2040Device.disconnectFromLan">disconnectFromLan</a></td> <td>Public method to disconnect from the LAN.</td> </tr> <tr> <td><a href="#RP2040Device.disconnectWifi">disconnectWifi</a></td> <td>Public method to disconnect a device from the WiFi network.</td> </tr> <tr> <td><a href="#RP2040Device.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="#RP2040Device.getConnectedClients">getConnectedClients</a></td> <td>Public method to get a list of connected clients.</td> </tr> <tr> <td><a href="#RP2040Device.getDocumentationUrl">getDocumentationUrl</a></td> <td>Public method to get the device documentation URL.</td> </tr> <tr> <td><a href="#RP2040Device.getDownloadMenuEntries">getDownloadMenuEntries</a></td> <td>Public method to retrieve the entries for the downloads menu.</td> </tr> <tr> <td><a href="#RP2040Device.getEthernetStatus">getEthernetStatus</a></td> <td>Public method to get Ethernet status data of the connected board.</td> </tr> <tr> <td><a href="#RP2040Device.getWifiData">getWifiData</a></td> <td>Public method to get data related to the current WiFi status.</td> </tr> <tr> <td><a href="#RP2040Device.hasEthernet">hasEthernet</a></td> <td>Public method to check the availability of Ethernet.</td> </tr> <tr> <td><a href="#RP2040Device.hasFlashMenuEntry">hasFlashMenuEntry</a></td> <td>Public method to check, if the device has its own flash menu entry.</td> </tr> <tr> <td><a href="#RP2040Device.hasNetworkTime">hasNetworkTime</a></td> <td>Public method to check the availability of network time functions.</td> </tr> <tr> <td><a href="#RP2040Device.hasWifi">hasWifi</a></td> <td>Public method to check the availability of WiFi.</td> </tr> <tr> <td><a href="#RP2040Device.removeCredentials">removeCredentials</a></td> <td>Public method to remove the saved credentials from the connected device.</td> </tr> <tr> <td><a href="#RP2040Device.removeLanAutoConnect">removeLanAutoConnect</a></td> <td>Public method to remove the saved IPv4 parameters from the connected device.</td> </tr> <tr> <td><a href="#RP2040Device.runScript">runScript</a></td> <td>Public method to run the given Python script.</td> </tr> <tr> <td><a href="#RP2040Device.scanNetworks">scanNetworks</a></td> <td>Public method to scan for available WiFi networks.</td> </tr> <tr> <td><a href="#RP2040Device.setButtons">setButtons</a></td> <td>Public method to enable the supported action buttons.</td> </tr> <tr> <td><a href="#RP2040Device.setNetworkTime">setNetworkTime</a></td> <td>Public method to set the time to the network time retrieved from an NTP server.</td> </tr> <tr> <td><a href="#RP2040Device.startAccessPoint">startAccessPoint</a></td> <td>Public method to start the access point interface.</td> </tr> <tr> <td><a href="#RP2040Device.stopAccessPoint">stopAccessPoint</a></td> <td>Public method to stop the access point interface.</td> </tr> <tr> <td><a href="#RP2040Device.writeCredentials">writeCredentials</a></td> <td>Public method to write the given credentials to the connected device and modify the start script to connect automatically.</td> </tr> <tr> <td><a href="#RP2040Device.writeLanAutoConnect">writeLanAutoConnect</a></td> <td>Public method to generate a script and associated configuration to connect the device to the LAN during boot time.</td> </tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <a NAME="RP2040Device.__init__" ID="RP2040Device.__init__"></a> <h4>RP2040Device (Constructor)</h4> <b>RP2040Device</b>(<i>microPythonWidget, deviceType, 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>parent</i> (QObject)</dt> <dd> reference to the parent object </dd> </dl> <a NAME="RP2040Device.__activateBootloader" ID="RP2040Device.__activateBootloader"></a> <h4>RP2040Device.__activateBootloader</h4> <b>__activateBootloader</b>(<i></i>) <p> Private slot to switch the board into 'bootloader' mode. </p> <a NAME="RP2040Device.__createRP2040Menu" ID="RP2040Device.__createRP2040Menu"></a> <h4>RP2040Device.__createRP2040Menu</h4> <b>__createRP2040Menu</b>(<i></i>) <p> Private method to create the RO2040 submenu. </p> <a NAME="RP2040Device.__firmwareVersionResponse" ID="RP2040Device.__firmwareVersionResponse"></a> <h4>RP2040Device.__firmwareVersionResponse</h4> <b>__firmwareVersionResponse</b>(<i>reply</i>) <p> Private slot 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="RP2040Device.__flashPython" ID="RP2040Device.__flashPython"></a> <h4>RP2040Device.__flashPython</h4> <b>__flashPython</b>(<i></i>) <p> Private slot to flash a MicroPython firmware to the device. </p> <a NAME="RP2040Device.__resetDevice" ID="RP2040Device.__resetDevice"></a> <h4>RP2040Device.__resetDevice</h4> <b>__resetDevice</b>(<i></i>) <p> Private slot to reset the connected device. </p> <a NAME="RP2040Device.__setCountry" ID="RP2040Device.__setCountry"></a> <h4>RP2040Device.__setCountry</h4> <b>__setCountry</b>(<i></i>) <p> Private slot to configure the country of the connected RP2040 device. </p> <p> The country is the two letter country code. </p> <a NAME="RP2040Device.__showFirmwareVersions" ID="RP2040Device.__showFirmwareVersions"></a> <h4>RP2040Device.__showFirmwareVersions</h4> <b>__showFirmwareVersions</b>(<i></i>) <p> Private slot to show the firmware version of the connected device and the available firmware version. </p> <a NAME="RP2040Device._getSetTimeCode" ID="RP2040Device._getSetTimeCode"></a> <h4>RP2040Device._getSetTimeCode</h4> <b>_getSetTimeCode</b>(<i></i>) <p> Protected method to get the device code to set the time. </p> <p> Note: This method must be implemented in the various device specific subclasses. </p> <dl> <dt>Return:</dt> <dd> code to be executed on the connected device to set the time </dd> </dl> <dl> <dt>Return Type:</dt> <dd> str </dd> </dl> <a NAME="RP2040Device.addDeviceMenuEntries" ID="RP2040Device.addDeviceMenuEntries"></a> <h4>RP2040Device.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="RP2040Device.addDeviceWifiEntries" ID="RP2040Device.addDeviceWifiEntries"></a> <h4>RP2040Device.addDeviceWifiEntries</h4> <b>addDeviceWifiEntries</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="RP2040Device.canRunScript" ID="RP2040Device.canRunScript"></a> <h4>RP2040Device.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="RP2040Device.canStartFileManager" ID="RP2040Device.canStartFileManager"></a> <h4>RP2040Device.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="RP2040Device.canStartPlotter" ID="RP2040Device.canStartPlotter"></a> <h4>RP2040Device.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="RP2040Device.canStartRepl" ID="RP2040Device.canStartRepl"></a> <h4>RP2040Device.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="RP2040Device.checkInternet" ID="RP2040Device.checkInternet"></a> <h4>RP2040Device.checkInternet</h4> <b>checkInternet</b>(<i></i>) <p> Public method to check, if the internet can be reached. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating reachability and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.checkInternetViaLan" ID="RP2040Device.checkInternetViaLan"></a> <h4>RP2040Device.checkInternetViaLan</h4> <b>checkInternetViaLan</b>(<i></i>) <p> Public method to check, if the internet can be reached (LAN variant). </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating reachability and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.connectToLan" ID="RP2040Device.connectToLan"></a> <h4>RP2040Device.connectToLan</h4> <b>connectToLan</b>(<i>config</i>) <p> Public method to connect the connected device to the LAN. </p> <dl> <dt><i>config</i> (str or tuple of (str, str, str, str))</dt> <dd> configuration for the connection (either the string 'dhcp' for a dynamic address or a tuple of four strings with the IPv4 parameters. </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.connectWifi" ID="RP2040Device.connectWifi"></a> <h4>RP2040Device.connectWifi</h4> <b>connectWifi</b>(<i>ssid, password</i>) <p> Public method to connect a device to a WiFi network. </p> <dl> <dt><i>ssid</i> (str)</dt> <dd> name (SSID) of the WiFi network </dd> <dt><i>password</i> (str)</dt> <dd> password needed to connect </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing the connection status and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.deactivateEthernet" ID="RP2040Device.deactivateEthernet"></a> <h4>RP2040Device.deactivateEthernet</h4> <b>deactivateEthernet</b>(<i></i>) <p> Public method to deactivate the Ethernet interface of the connected device. </p> <dl> <dt>Return:</dt> <dd> tuple containg a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.deactivateInterface" ID="RP2040Device.deactivateInterface"></a> <h4>RP2040Device.deactivateInterface</h4> <b>deactivateInterface</b>(<i>interface</i>) <p> Public method to deactivate a given WiFi interface of the connected device. </p> <dl> <dt><i>interface</i> (str)</dt> <dd> designation of the interface to be deactivated (one of 'AP' or 'STA') </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containg a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <dl> <dt>Raises <b>ValueError</b>:</dt> <dd> raised to indicate a wrong value for the interface type </dd> </dl> <a NAME="RP2040Device.deviceName" ID="RP2040Device.deviceName"></a> <h4>RP2040Device.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="RP2040Device.disconnectFromLan" ID="RP2040Device.disconnectFromLan"></a> <h4>RP2040Device.disconnectFromLan</h4> <b>disconnectFromLan</b>(<i></i>) <p> Public method to disconnect from the LAN. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.disconnectWifi" ID="RP2040Device.disconnectWifi"></a> <h4>RP2040Device.disconnectWifi</h4> <b>disconnectWifi</b>(<i></i>) <p> Public method to disconnect a device from the WiFi network. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.forceInterrupt" ID="RP2040Device.forceInterrupt"></a> <h4>RP2040Device.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="RP2040Device.getConnectedClients" ID="RP2040Device.getConnectedClients"></a> <h4>RP2040Device.getConnectedClients</h4> <b>getConnectedClients</b>(<i></i>) <p> Public method to get a list of connected clients. </p> <dl> <dt>Return:</dt> <dd> a tuple containing a list of tuples containing the client MAC-Address and the RSSI (if supported and available) and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of ([(bytes, int)], str) </dd> </dl> <a NAME="RP2040Device.getDocumentationUrl" ID="RP2040Device.getDocumentationUrl"></a> <h4>RP2040Device.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="RP2040Device.getDownloadMenuEntries" ID="RP2040Device.getDownloadMenuEntries"></a> <h4>RP2040Device.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="RP2040Device.getEthernetStatus" ID="RP2040Device.getEthernetStatus"></a> <h4>RP2040Device.getEthernetStatus</h4> <b>getEthernetStatus</b>(<i></i>) <p> Public method to get Ethernet status data of the connected board. </p> <dl> <dt>Return:</dt> <dd> list of tuples containing the translated status data label and the associated value </dd> </dl> <dl> <dt>Return Type:</dt> <dd> list of tuples of (str, str) </dd> </dl> <dl> <dt>Raises <b>OSError</b>:</dt> <dd> raised to indicate an issue with the device </dd> </dl> <a NAME="RP2040Device.getWifiData" ID="RP2040Device.getWifiData"></a> <h4>RP2040Device.getWifiData</h4> <b>getWifiData</b>(<i></i>) <p> Public method to get data related to the current WiFi status. </p> <dl> <dt>Return:</dt> <dd> tuple of three dictionaries containing the WiFi status data for the WiFi client, access point and overall data </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (dict, dict, dict) </dd> </dl> <dl> <dt>Raises <b>OSError</b>:</dt> <dd> raised to indicate an issue with the device </dd> </dl> <a NAME="RP2040Device.hasEthernet" ID="RP2040Device.hasEthernet"></a> <h4>RP2040Device.hasEthernet</h4> <b>hasEthernet</b>(<i></i>) <p> Public method to check the availability of Ethernet. </p> <dl> <dt>Return:</dt> <dd> flag indicating the availability of Ethernet </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <dl> <dt>Raises <b>OSError</b>:</dt> <dd> raised to indicate an issue with the device </dd> </dl> <a NAME="RP2040Device.hasFlashMenuEntry" ID="RP2040Device.hasFlashMenuEntry"></a> <h4>RP2040Device.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="RP2040Device.hasNetworkTime" ID="RP2040Device.hasNetworkTime"></a> <h4>RP2040Device.hasNetworkTime</h4> <b>hasNetworkTime</b>(<i></i>) <p> Public method to check the availability of network time functions. </p> <dl> <dt>Return:</dt> <dd> flag indicating the availability of network time functions </dd> </dl> <dl> <dt>Return Type:</dt> <dd> bool </dd> </dl> <dl> <dt>Raises <b>OSError</b>:</dt> <dd> raised to indicate an issue with the device </dd> </dl> <a NAME="RP2040Device.hasWifi" ID="RP2040Device.hasWifi"></a> <h4>RP2040Device.hasWifi</h4> <b>hasWifi</b>(<i></i>) <p> Public method to check the availability of WiFi. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating the availability of WiFi and the WiFi type (picow or picowireless) </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <dl> <dt>Raises <b>OSError</b>:</dt> <dd> raised to indicate an issue with the device </dd> </dl> <a NAME="RP2040Device.removeCredentials" ID="RP2040Device.removeCredentials"></a> <h4>RP2040Device.removeCredentials</h4> <b>removeCredentials</b>(<i></i>) <p> Public method to remove the saved credentials from the connected device. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.removeLanAutoConnect" ID="RP2040Device.removeLanAutoConnect"></a> <h4>RP2040Device.removeLanAutoConnect</h4> <b>removeLanAutoConnect</b>(<i></i>) <p> Public method to remove the saved IPv4 parameters from the connected device. </p> <p> Note: This disables the LAN auto-connect feature. </p> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.runScript" ID="RP2040Device.runScript"></a> <h4>RP2040Device.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="RP2040Device.scanNetworks" ID="RP2040Device.scanNetworks"></a> <h4>RP2040Device.scanNetworks</h4> <b>scanNetworks</b>(<i></i>) <p> Public method to scan for available WiFi networks. </p> <dl> <dt>Return:</dt> <dd> tuple containing the list of available networks as a tuple of 'Name', 'MAC-Address', 'channel', 'RSSI' and 'security' and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (list of tuple of (str, str, int, int, str), str) </dd> </dl> <a NAME="RP2040Device.setButtons" ID="RP2040Device.setButtons"></a> <h4>RP2040Device.setButtons</h4> <b>setButtons</b>(<i></i>) <p> Public method to enable the supported action buttons. </p> <a NAME="RP2040Device.setNetworkTime" ID="RP2040Device.setNetworkTime"></a> <h4>RP2040Device.setNetworkTime</h4> <b>setNetworkTime</b>(<i>server="0.pool.ntp.org", tzOffset=0, timeout=10</i>) <p> Public method to set the time to the network time retrieved from an NTP server. </p> <dl> <dt><i>server</i> (str (optional))</dt> <dd> name of the NTP server to get the network time from (defaults to "0.pool.ntp.org") </dd> <dt><i>tzOffset</i> (int (optional))</dt> <dd> offset with respect to UTC (defaults to 0) </dd> <dt><i>timeout</i> (int)</dt> <dd> maximum time to wait for a server response in seconds (defaults to 10) </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error string </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.startAccessPoint" ID="RP2040Device.startAccessPoint"></a> <h4>RP2040Device.startAccessPoint</h4> <b>startAccessPoint</b>(<i>ssid, security=None, password=None, ifconfig=None</i>) <p> Public method to start the access point interface. </p> <dl> <dt><i>ssid</i> (str)</dt> <dd> SSID of the access point </dd> <dt><i>security</i> (int (optional))</dt> <dd> security method (defaults to None) </dd> <dt><i>password</i> (str (optional))</dt> <dd> password (defaults to None) </dd> <dt><i>ifconfig</i> (tuple of (str, str, str, str))</dt> <dd> IPv4 configuration for the access point if not default (IPv4 address, netmask, gateway address, DNS server address) </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.stopAccessPoint" ID="RP2040Device.stopAccessPoint"></a> <h4>RP2040Device.stopAccessPoint</h4> <b>stopAccessPoint</b>(<i></i>) <p> Public method to stop the access point interface. </p> <dl> <dt>Return:</dt> <dd> tuple containg a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.writeCredentials" ID="RP2040Device.writeCredentials"></a> <h4>RP2040Device.writeCredentials</h4> <b>writeCredentials</b>(<i>ssid, password</i>) <p> Public method to write the given credentials to the connected device and modify the start script to connect automatically. </p> <dl> <dt><i>ssid</i> (str)</dt> <dd> SSID of the network to connect to </dd> <dt><i>password</i> (str)</dt> <dd> password needed to authenticate </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </dd> </dl> <a NAME="RP2040Device.writeLanAutoConnect" ID="RP2040Device.writeLanAutoConnect"></a> <h4>RP2040Device.writeLanAutoConnect</h4> <b>writeLanAutoConnect</b>(<i>config</i>) <p> Public method to generate a script and associated configuration to connect the device to the LAN during boot time. </p> <dl> <dt><i>config</i> (str or tuple of (str, str, str, str))</dt> <dd> configuration for the connection (either the string 'dhcp' for a dynamic address or a tuple of four strings with the IPv4 parameters. </dd> </dl> <dl> <dt>Return:</dt> <dd> tuple containing a flag indicating success and an error message </dd> </dl> <dl> <dt>Return Type:</dt> <dd> tuple of (bool, str) </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> RP2040Device </dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>