|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.Devices.RP2040Devices</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.MicroPython.Devices.RP2040Devices</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the device interface class for RP2040 based boards |
|
13 (e.g. Raspberry Pi Pico). |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 |
|
17 <table> |
|
18 <tr><td>None</td></tr> |
|
19 </table> |
|
20 <h3>Classes</h3> |
|
21 |
|
22 <table> |
|
23 |
|
24 <tr> |
|
25 <td><a href="#RP2040Device">RP2040Device</a></td> |
|
26 <td>Class implementing the device for RP2040 based boards.</td> |
|
27 </tr> |
|
28 </table> |
|
29 <h3>Functions</h3> |
|
30 |
|
31 <table> |
|
32 |
|
33 <tr> |
|
34 <td><a href="#createDevice">createDevice</a></td> |
|
35 <td>Function to instantiate a MicroPython device object.</td> |
|
36 </tr> |
|
37 </table> |
|
38 <hr /> |
|
39 <hr /> |
|
40 <a NAME="RP2040Device" ID="RP2040Device"></a> |
|
41 <h2>RP2040Device</h2> |
|
42 |
|
43 <p> |
|
44 Class implementing the device for RP2040 based boards. |
|
45 </p> |
|
46 <h3>Derived from</h3> |
|
47 BaseDevice |
|
48 <h3>Class Attributes</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 |
|
55 <table> |
|
56 <tr><td>None</td></tr> |
|
57 </table> |
|
58 <h3>Methods</h3> |
|
59 |
|
60 <table> |
|
61 |
|
62 <tr> |
|
63 <td><a href="#RP2040Device.__init__">RP2040Device</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#RP2040Device.__activateBootloader">__activateBootloader</a></td> |
|
68 <td>Private method to switch the board into 'bootloader' mode.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#RP2040Device.__createRP2040Menu">__createRP2040Menu</a></td> |
|
72 <td>Private method to create the RO2040 submenu.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#RP2040Device.__firmwareVersionResponse">__firmwareVersionResponse</a></td> |
|
76 <td>Private method handling the response of the latest version request.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#RP2040Device.__flashPython">__flashPython</a></td> |
|
80 <td>Private slot to flash a MicroPython firmware to the device.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#RP2040Device.__showFirmwareVersions">__showFirmwareVersions</a></td> |
|
84 <td>Private slot to show the firmware version of the connected device and the available firmware version.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#RP2040Device.addDeviceMenuEntries">addDeviceMenuEntries</a></td> |
|
88 <td>Public method to add device specific entries to the given menu.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#RP2040Device.canRunScript">canRunScript</a></td> |
|
92 <td>Public method to determine, if a script can be executed.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#RP2040Device.canStartFileManager">canStartFileManager</a></td> |
|
96 <td>Public method to determine, if a File Manager can be started.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#RP2040Device.canStartPlotter">canStartPlotter</a></td> |
|
100 <td>Public method to determine, if a Plotter can be started.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#RP2040Device.canStartRepl">canStartRepl</a></td> |
|
104 <td>Public method to determine, if a REPL can be started.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#RP2040Device.deviceName">deviceName</a></td> |
|
108 <td>Public method to get the name of the device.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#RP2040Device.forceInterrupt">forceInterrupt</a></td> |
|
112 <td>Public method to determine the need for an interrupt when opening the serial connection.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#RP2040Device.getDocumentationUrl">getDocumentationUrl</a></td> |
|
116 <td>Public method to get the device documentation URL.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#RP2040Device.getDownloadMenuEntries">getDownloadMenuEntries</a></td> |
|
120 <td>Public method to retrieve the entries for the downloads menu.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#RP2040Device.hasFlashMenuEntry">hasFlashMenuEntry</a></td> |
|
124 <td>Public method to check, if the device has its own flash menu entry.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#RP2040Device.runScript">runScript</a></td> |
|
128 <td>Public method to run the given Python script.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#RP2040Device.setButtons">setButtons</a></td> |
|
132 <td>Public method to enable the supported action buttons.</td> |
|
133 </tr> |
|
134 </table> |
|
135 <h3>Static Methods</h3> |
|
136 |
|
137 <table> |
|
138 <tr><td>None</td></tr> |
|
139 </table> |
|
140 |
|
141 <a NAME="RP2040Device.__init__" ID="RP2040Device.__init__"></a> |
|
142 <h4>RP2040Device (Constructor)</h4> |
|
143 <b>RP2040Device</b>(<i>microPythonWidget, deviceType, parent=None</i>) |
|
144 |
|
145 <p> |
|
146 Constructor |
|
147 </p> |
|
148 <dl> |
|
149 |
|
150 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
151 <dd> |
|
152 reference to the main MicroPython widget |
|
153 </dd> |
|
154 <dt><i>deviceType</i> (str)</dt> |
|
155 <dd> |
|
156 device type assigned to this device interface |
|
157 </dd> |
|
158 <dt><i>parent</i> (QObject)</dt> |
|
159 <dd> |
|
160 reference to the parent object |
|
161 </dd> |
|
162 </dl> |
|
163 <a NAME="RP2040Device.__activateBootloader" ID="RP2040Device.__activateBootloader"></a> |
|
164 <h4>RP2040Device.__activateBootloader</h4> |
|
165 <b>__activateBootloader</b>(<i></i>) |
|
166 |
|
167 <p> |
|
168 Private method to switch the board into 'bootloader' mode. |
|
169 </p> |
|
170 <a NAME="RP2040Device.__createRP2040Menu" ID="RP2040Device.__createRP2040Menu"></a> |
|
171 <h4>RP2040Device.__createRP2040Menu</h4> |
|
172 <b>__createRP2040Menu</b>(<i></i>) |
|
173 |
|
174 <p> |
|
175 Private method to create the RO2040 submenu. |
|
176 </p> |
|
177 <a NAME="RP2040Device.__firmwareVersionResponse" ID="RP2040Device.__firmwareVersionResponse"></a> |
|
178 <h4>RP2040Device.__firmwareVersionResponse</h4> |
|
179 <b>__firmwareVersionResponse</b>(<i>reply</i>) |
|
180 |
|
181 <p> |
|
182 Private method handling the response of the latest version request. |
|
183 </p> |
|
184 <dl> |
|
185 |
|
186 <dt><i>reply</i> (QNetworkReply)</dt> |
|
187 <dd> |
|
188 reference to the reply object |
|
189 </dd> |
|
190 </dl> |
|
191 <a NAME="RP2040Device.__flashPython" ID="RP2040Device.__flashPython"></a> |
|
192 <h4>RP2040Device.__flashPython</h4> |
|
193 <b>__flashPython</b>(<i></i>) |
|
194 |
|
195 <p> |
|
196 Private slot to flash a MicroPython firmware to the device. |
|
197 </p> |
|
198 <a NAME="RP2040Device.__showFirmwareVersions" ID="RP2040Device.__showFirmwareVersions"></a> |
|
199 <h4>RP2040Device.__showFirmwareVersions</h4> |
|
200 <b>__showFirmwareVersions</b>(<i></i>) |
|
201 |
|
202 <p> |
|
203 Private slot to show the firmware version of the connected device and the |
|
204 available firmware version. |
|
205 </p> |
|
206 <a NAME="RP2040Device.addDeviceMenuEntries" ID="RP2040Device.addDeviceMenuEntries"></a> |
|
207 <h4>RP2040Device.addDeviceMenuEntries</h4> |
|
208 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
|
209 |
|
210 <p> |
|
211 Public method to add device specific entries to the given menu. |
|
212 </p> |
|
213 <dl> |
|
214 |
|
215 <dt><i>menu</i> (QMenu)</dt> |
|
216 <dd> |
|
217 reference to the context menu |
|
218 </dd> |
|
219 </dl> |
|
220 <a NAME="RP2040Device.canRunScript" ID="RP2040Device.canRunScript"></a> |
|
221 <h4>RP2040Device.canRunScript</h4> |
|
222 <b>canRunScript</b>(<i></i>) |
|
223 |
|
224 <p> |
|
225 Public method to determine, if a script can be executed. |
|
226 </p> |
|
227 <dl> |
|
228 <dt>Return:</dt> |
|
229 <dd> |
|
230 tuple containing a flag indicating it is safe to start a |
|
231 Plotter and a reason why it cannot. |
|
232 </dd> |
|
233 </dl> |
|
234 <dl> |
|
235 <dt>Return Type:</dt> |
|
236 <dd> |
|
237 tuple of (bool, str) |
|
238 </dd> |
|
239 </dl> |
|
240 <a NAME="RP2040Device.canStartFileManager" ID="RP2040Device.canStartFileManager"></a> |
|
241 <h4>RP2040Device.canStartFileManager</h4> |
|
242 <b>canStartFileManager</b>(<i></i>) |
|
243 |
|
244 <p> |
|
245 Public method to determine, if a File Manager can be started. |
|
246 </p> |
|
247 <dl> |
|
248 <dt>Return:</dt> |
|
249 <dd> |
|
250 tuple containing a flag indicating it is safe to start a |
|
251 File Manager and a reason why it cannot. |
|
252 </dd> |
|
253 </dl> |
|
254 <dl> |
|
255 <dt>Return Type:</dt> |
|
256 <dd> |
|
257 tuple of (bool, str) |
|
258 </dd> |
|
259 </dl> |
|
260 <a NAME="RP2040Device.canStartPlotter" ID="RP2040Device.canStartPlotter"></a> |
|
261 <h4>RP2040Device.canStartPlotter</h4> |
|
262 <b>canStartPlotter</b>(<i></i>) |
|
263 |
|
264 <p> |
|
265 Public method to determine, if a Plotter can be started. |
|
266 </p> |
|
267 <dl> |
|
268 <dt>Return:</dt> |
|
269 <dd> |
|
270 tuple containing a flag indicating it is safe to start a |
|
271 Plotter and a reason why it cannot. |
|
272 </dd> |
|
273 </dl> |
|
274 <dl> |
|
275 <dt>Return Type:</dt> |
|
276 <dd> |
|
277 tuple of (bool, str) |
|
278 </dd> |
|
279 </dl> |
|
280 <a NAME="RP2040Device.canStartRepl" ID="RP2040Device.canStartRepl"></a> |
|
281 <h4>RP2040Device.canStartRepl</h4> |
|
282 <b>canStartRepl</b>(<i></i>) |
|
283 |
|
284 <p> |
|
285 Public method to determine, if a REPL can be started. |
|
286 </p> |
|
287 <dl> |
|
288 <dt>Return:</dt> |
|
289 <dd> |
|
290 tuple containing a flag indicating it is safe to start a REPL |
|
291 and a reason why it cannot. |
|
292 </dd> |
|
293 </dl> |
|
294 <dl> |
|
295 <dt>Return Type:</dt> |
|
296 <dd> |
|
297 tuple of (bool, str) |
|
298 </dd> |
|
299 </dl> |
|
300 <a NAME="RP2040Device.deviceName" ID="RP2040Device.deviceName"></a> |
|
301 <h4>RP2040Device.deviceName</h4> |
|
302 <b>deviceName</b>(<i></i>) |
|
303 |
|
304 <p> |
|
305 Public method to get the name of the device. |
|
306 </p> |
|
307 <dl> |
|
308 <dt>Return:</dt> |
|
309 <dd> |
|
310 name of the device |
|
311 </dd> |
|
312 </dl> |
|
313 <dl> |
|
314 <dt>Return Type:</dt> |
|
315 <dd> |
|
316 str |
|
317 </dd> |
|
318 </dl> |
|
319 <a NAME="RP2040Device.forceInterrupt" ID="RP2040Device.forceInterrupt"></a> |
|
320 <h4>RP2040Device.forceInterrupt</h4> |
|
321 <b>forceInterrupt</b>(<i></i>) |
|
322 |
|
323 <p> |
|
324 Public method to determine the need for an interrupt when opening the |
|
325 serial connection. |
|
326 </p> |
|
327 <dl> |
|
328 <dt>Return:</dt> |
|
329 <dd> |
|
330 flag indicating an interrupt is needed |
|
331 </dd> |
|
332 </dl> |
|
333 <dl> |
|
334 <dt>Return Type:</dt> |
|
335 <dd> |
|
336 bool |
|
337 </dd> |
|
338 </dl> |
|
339 <a NAME="RP2040Device.getDocumentationUrl" ID="RP2040Device.getDocumentationUrl"></a> |
|
340 <h4>RP2040Device.getDocumentationUrl</h4> |
|
341 <b>getDocumentationUrl</b>(<i></i>) |
|
342 |
|
343 <p> |
|
344 Public method to get the device documentation URL. |
|
345 </p> |
|
346 <dl> |
|
347 <dt>Return:</dt> |
|
348 <dd> |
|
349 documentation URL of the device |
|
350 </dd> |
|
351 </dl> |
|
352 <dl> |
|
353 <dt>Return Type:</dt> |
|
354 <dd> |
|
355 str |
|
356 </dd> |
|
357 </dl> |
|
358 <a NAME="RP2040Device.getDownloadMenuEntries" ID="RP2040Device.getDownloadMenuEntries"></a> |
|
359 <h4>RP2040Device.getDownloadMenuEntries</h4> |
|
360 <b>getDownloadMenuEntries</b>(<i></i>) |
|
361 |
|
362 <p> |
|
363 Public method to retrieve the entries for the downloads menu. |
|
364 </p> |
|
365 <dl> |
|
366 <dt>Return:</dt> |
|
367 <dd> |
|
368 list of tuples with menu text and URL to be opened for each |
|
369 entry |
|
370 </dd> |
|
371 </dl> |
|
372 <dl> |
|
373 <dt>Return Type:</dt> |
|
374 <dd> |
|
375 list of tuple of (str, str) |
|
376 </dd> |
|
377 </dl> |
|
378 <a NAME="RP2040Device.hasFlashMenuEntry" ID="RP2040Device.hasFlashMenuEntry"></a> |
|
379 <h4>RP2040Device.hasFlashMenuEntry</h4> |
|
380 <b>hasFlashMenuEntry</b>(<i></i>) |
|
381 |
|
382 <p> |
|
383 Public method to check, if the device has its own flash menu entry. |
|
384 </p> |
|
385 <dl> |
|
386 <dt>Return:</dt> |
|
387 <dd> |
|
388 flag indicating a specific flash menu entry |
|
389 </dd> |
|
390 </dl> |
|
391 <dl> |
|
392 <dt>Return Type:</dt> |
|
393 <dd> |
|
394 bool |
|
395 </dd> |
|
396 </dl> |
|
397 <a NAME="RP2040Device.runScript" ID="RP2040Device.runScript"></a> |
|
398 <h4>RP2040Device.runScript</h4> |
|
399 <b>runScript</b>(<i>script</i>) |
|
400 |
|
401 <p> |
|
402 Public method to run the given Python script. |
|
403 </p> |
|
404 <dl> |
|
405 |
|
406 <dt><i>script</i> (str)</dt> |
|
407 <dd> |
|
408 script to be executed |
|
409 </dd> |
|
410 </dl> |
|
411 <a NAME="RP2040Device.setButtons" ID="RP2040Device.setButtons"></a> |
|
412 <h4>RP2040Device.setButtons</h4> |
|
413 <b>setButtons</b>(<i></i>) |
|
414 |
|
415 <p> |
|
416 Public method to enable the supported action buttons. |
|
417 </p> |
|
418 <div align="right"><a href="#top">Up</a></div> |
|
419 <hr /> |
|
420 <hr /> |
|
421 <a NAME="createDevice" ID="createDevice"></a> |
|
422 <h2>createDevice</h2> |
|
423 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>) |
|
424 |
|
425 <p> |
|
426 Function to instantiate a MicroPython device object. |
|
427 </p> |
|
428 <dl> |
|
429 |
|
430 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
431 <dd> |
|
432 reference to the main MicroPython widget |
|
433 </dd> |
|
434 <dt><i>deviceType</i> (str)</dt> |
|
435 <dd> |
|
436 device type assigned to this device interface |
|
437 </dd> |
|
438 <dt><i>vid</i> (int)</dt> |
|
439 <dd> |
|
440 vendor ID |
|
441 </dd> |
|
442 <dt><i>pid</i> (int)</dt> |
|
443 <dd> |
|
444 product ID |
|
445 </dd> |
|
446 <dt><i>boardName</i> (str)</dt> |
|
447 <dd> |
|
448 name of the board |
|
449 </dd> |
|
450 <dt><i>serialNumber</i> (str)</dt> |
|
451 <dd> |
|
452 serial number of the board |
|
453 </dd> |
|
454 </dl> |
|
455 <dl> |
|
456 <dt>Return:</dt> |
|
457 <dd> |
|
458 reference to the instantiated device object |
|
459 </dd> |
|
460 </dl> |
|
461 <dl> |
|
462 <dt>Return Type:</dt> |
|
463 <dd> |
|
464 RP2040Device |
|
465 </dd> |
|
466 </dl> |
|
467 <div align="right"><a href="#top">Up</a></div> |
|
468 <hr /> |
|
469 </body></html> |