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

branch
eric7
changeset 9756
9854647c8c5c
child 9785
84684a40187d
equal deleted inserted replaced
9755:1a09700229e7 9756:9854647c8c5c
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.MicroPython.Devices.CircuitPythonDevices</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.CircuitPythonDevices</h1>
10
11 <p>
12 Module implementing the device interface class for CircuitPython boards.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#CircuitPythonDevice">CircuitPythonDevice</a></td>
25 <td>Class implementing the device for CircuitPython boards.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31
32 <tr>
33 <td><a href="#createDevice">createDevice</a></td>
34 <td>Function to instantiate a MicroPython device object.</td>
35 </tr>
36 </table>
37 <hr />
38 <hr />
39 <a NAME="CircuitPythonDevice" ID="CircuitPythonDevice"></a>
40 <h2>CircuitPythonDevice</h2>
41
42 <p>
43 Class implementing the device for CircuitPython boards.
44 </p>
45 <h3>Derived from</h3>
46 BaseDevice
47 <h3>Class Attributes</h3>
48
49 <table>
50 <tr><td>DeviceVolumeName</td></tr>
51 </table>
52 <h3>Class Methods</h3>
53
54 <table>
55 <tr><td>None</td></tr>
56 </table>
57 <h3>Methods</h3>
58
59 <table>
60
61 <tr>
62 <td><a href="#CircuitPythonDevice.__init__">CircuitPythonDevice</a></td>
63 <td>Constructor</td>
64 </tr>
65 <tr>
66 <td><a href="#CircuitPythonDevice.__aboutToShowLibraryMenu">__aboutToShowLibraryMenu</a></td>
67 <td>Private slot to populate the 'Library Management' menu.</td>
68 </tr>
69 <tr>
70 <td><a href="#CircuitPythonDevice.__cpyVersionResponse">__cpyVersionResponse</a></td>
71 <td>Private method handling the response of the latest version request.</td>
72 </tr>
73 <tr>
74 <td><a href="#CircuitPythonDevice.__createCPyMenu">__createCPyMenu</a></td>
75 <td>Private method to create the CircuitPython submenu.</td>
76 </tr>
77 <tr>
78 <td><a href="#CircuitPythonDevice.__deviceVolumeMounted">__deviceVolumeMounted</a></td>
79 <td>Private method to check, if the device volume is mounted.</td>
80 </tr>
81 <tr>
82 <td><a href="#CircuitPythonDevice.__findDeviceDirectories">__findDeviceDirectories</a></td>
83 <td>Private method to find the device directories associated with the current board name.</td>
84 </tr>
85 <tr>
86 <td><a href="#CircuitPythonDevice.__findWorkspace">__findWorkspace</a></td>
87 <td>Private method to find the workspace directory.</td>
88 </tr>
89 <tr>
90 <td><a href="#CircuitPythonDevice.__flashCircuitPython">__flashCircuitPython</a></td>
91 <td>Private slot to flash a CircuitPython firmware to a device supporting UF2.</td>
92 </tr>
93 <tr>
94 <td><a href="#CircuitPythonDevice.__installLibraryFiles">__installLibraryFiles</a></td>
95 <td>Private slot to install Python files into the onboard library.</td>
96 </tr>
97 <tr>
98 <td><a href="#CircuitPythonDevice.__showCircuitPythonVersions">__showCircuitPythonVersions</a></td>
99 <td>Private slot to show the CircuitPython version of a connected device and the latest available one (from Github).</td>
100 </tr>
101 <tr>
102 <td><a href="#CircuitPythonDevice.__showTeensyFlashInstructions">__showTeensyFlashInstructions</a></td>
103 <td>Private method to show a message box because Teensy does not support the UF2 bootloader yet.</td>
104 </tr>
105 <tr>
106 <td><a href="#CircuitPythonDevice.__startTeensyLoader">__startTeensyLoader</a></td>
107 <td>Private method to start the 'Teensy Loader' application.</td>
108 </tr>
109 <tr>
110 <td><a href="#CircuitPythonDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td>
111 <td>Public method to add device specific entries to the given menu.</td>
112 </tr>
113 <tr>
114 <td><a href="#CircuitPythonDevice.canRunScript">canRunScript</a></td>
115 <td>Public method to determine, if a script can be executed.</td>
116 </tr>
117 <tr>
118 <td><a href="#CircuitPythonDevice.canStartFileManager">canStartFileManager</a></td>
119 <td>Public method to determine, if a File Manager can be started.</td>
120 </tr>
121 <tr>
122 <td><a href="#CircuitPythonDevice.canStartPlotter">canStartPlotter</a></td>
123 <td>Public method to determine, if a Plotter can be started.</td>
124 </tr>
125 <tr>
126 <td><a href="#CircuitPythonDevice.canStartRepl">canStartRepl</a></td>
127 <td>Public method to determine, if a REPL can be started.</td>
128 </tr>
129 <tr>
130 <td><a href="#CircuitPythonDevice.deviceName">deviceName</a></td>
131 <td>Public method to get the name of the device.</td>
132 </tr>
133 <tr>
134 <td><a href="#CircuitPythonDevice.forceInterrupt">forceInterrupt</a></td>
135 <td>Public method to determine the need for an interrupt when opening the serial connection.</td>
136 </tr>
137 <tr>
138 <td><a href="#CircuitPythonDevice.getDocumentationUrl">getDocumentationUrl</a></td>
139 <td>Public method to get the device documentation URL.</td>
140 </tr>
141 <tr>
142 <td><a href="#CircuitPythonDevice.getDownloadMenuEntries">getDownloadMenuEntries</a></td>
143 <td>Public method to retrieve the entries for the downloads menu.</td>
144 </tr>
145 <tr>
146 <td><a href="#CircuitPythonDevice.getWorkspace">getWorkspace</a></td>
147 <td>Public method to get the workspace directory.</td>
148 </tr>
149 <tr>
150 <td><a href="#CircuitPythonDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td>
151 <td>Public method to check, if the device has its own flash menu entry.</td>
152 </tr>
153 <tr>
154 <td><a href="#CircuitPythonDevice.runScript">runScript</a></td>
155 <td>Public method to run the given Python script.</td>
156 </tr>
157 <tr>
158 <td><a href="#CircuitPythonDevice.setButtons">setButtons</a></td>
159 <td>Public method to enable the supported action buttons.</td>
160 </tr>
161 <tr>
162 <td><a href="#CircuitPythonDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td>
163 <td>Public method to indicate file access via a local directory.</td>
164 </tr>
165 </table>
166 <h3>Static Methods</h3>
167
168 <table>
169 <tr><td>None</td></tr>
170 </table>
171
172 <a NAME="CircuitPythonDevice.__init__" ID="CircuitPythonDevice.__init__"></a>
173 <h4>CircuitPythonDevice (Constructor)</h4>
174 <b>CircuitPythonDevice</b>(<i>microPythonWidget, deviceType, boardName, parent=None</i>)
175
176 <p>
177 Constructor
178 </p>
179 <dl>
180
181 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
182 <dd>
183 reference to the main MicroPython widget
184 </dd>
185 <dt><i>deviceType</i> (str)</dt>
186 <dd>
187 device type assigned to this device interface
188 </dd>
189 <dt><i>boardName</i> (str)</dt>
190 <dd>
191 name of the board
192 </dd>
193 <dt><i>parent</i> (QObject)</dt>
194 <dd>
195 reference to the parent object
196 </dd>
197 </dl>
198 <a NAME="CircuitPythonDevice.__aboutToShowLibraryMenu" ID="CircuitPythonDevice.__aboutToShowLibraryMenu"></a>
199 <h4>CircuitPythonDevice.__aboutToShowLibraryMenu</h4>
200 <b>__aboutToShowLibraryMenu</b>(<i></i>)
201
202 <p>
203 Private slot to populate the 'Library Management' menu.
204 </p>
205 <a NAME="CircuitPythonDevice.__cpyVersionResponse" ID="CircuitPythonDevice.__cpyVersionResponse"></a>
206 <h4>CircuitPythonDevice.__cpyVersionResponse</h4>
207 <b>__cpyVersionResponse</b>(<i>reply</i>)
208
209 <p>
210 Private method handling the response of the latest version request.
211 </p>
212 <dl>
213
214 <dt><i>reply</i> (QNetworkReply)</dt>
215 <dd>
216 reference to the reply object
217 </dd>
218 </dl>
219 <a NAME="CircuitPythonDevice.__createCPyMenu" ID="CircuitPythonDevice.__createCPyMenu"></a>
220 <h4>CircuitPythonDevice.__createCPyMenu</h4>
221 <b>__createCPyMenu</b>(<i></i>)
222
223 <p>
224 Private method to create the CircuitPython submenu.
225 </p>
226 <a NAME="CircuitPythonDevice.__deviceVolumeMounted" ID="CircuitPythonDevice.__deviceVolumeMounted"></a>
227 <h4>CircuitPythonDevice.__deviceVolumeMounted</h4>
228 <b>__deviceVolumeMounted</b>(<i></i>)
229
230 <p>
231 Private method to check, if the device volume is mounted.
232 </p>
233 <dl>
234 <dt>Return:</dt>
235 <dd>
236 flag indicated a mounted device
237 </dd>
238 </dl>
239 <dl>
240 <dt>Return Type:</dt>
241 <dd>
242 bool
243 </dd>
244 </dl>
245 <a NAME="CircuitPythonDevice.__findDeviceDirectories" ID="CircuitPythonDevice.__findDeviceDirectories"></a>
246 <h4>CircuitPythonDevice.__findDeviceDirectories</h4>
247 <b>__findDeviceDirectories</b>(<i>directories</i>)
248
249 <p>
250 Private method to find the device directories associated with the
251 current board name.
252 </p>
253 <dl>
254
255 <dt><i>directories</i> (list of str)</dt>
256 <dd>
257 list of directories to be checked
258 </dd>
259 </dl>
260 <dl>
261 <dt>Return:</dt>
262 <dd>
263 list of associated directories
264 </dd>
265 </dl>
266 <dl>
267 <dt>Return Type:</dt>
268 <dd>
269 list of str
270 </dd>
271 </dl>
272 <a NAME="CircuitPythonDevice.__findWorkspace" ID="CircuitPythonDevice.__findWorkspace"></a>
273 <h4>CircuitPythonDevice.__findWorkspace</h4>
274 <b>__findWorkspace</b>(<i>silent=False</i>)
275
276 <p>
277 Private method to find the workspace directory.
278 </p>
279 <dl>
280
281 <dt><i>silent</i> (bool)</dt>
282 <dd>
283 flag indicating silent operations
284 </dd>
285 </dl>
286 <dl>
287 <dt>Return:</dt>
288 <dd>
289 workspace directory used for saving files
290 </dd>
291 </dl>
292 <dl>
293 <dt>Return Type:</dt>
294 <dd>
295 str
296 </dd>
297 </dl>
298 <a NAME="CircuitPythonDevice.__flashCircuitPython" ID="CircuitPythonDevice.__flashCircuitPython"></a>
299 <h4>CircuitPythonDevice.__flashCircuitPython</h4>
300 <b>__flashCircuitPython</b>(<i></i>)
301
302 <p>
303 Private slot to flash a CircuitPython firmware to a device supporting UF2.
304 </p>
305 <a NAME="CircuitPythonDevice.__installLibraryFiles" ID="CircuitPythonDevice.__installLibraryFiles"></a>
306 <h4>CircuitPythonDevice.__installLibraryFiles</h4>
307 <b>__installLibraryFiles</b>(<i>packageMode=False</i>)
308
309 <p>
310 Private slot to install Python files into the onboard library.
311 </p>
312 <dl>
313
314 <dt><i>packageMode</i> (bool (optional))</dt>
315 <dd>
316 flag indicating to install a library package
317 (defaults to False)
318 </dd>
319 </dl>
320 <a NAME="CircuitPythonDevice.__showCircuitPythonVersions" ID="CircuitPythonDevice.__showCircuitPythonVersions"></a>
321 <h4>CircuitPythonDevice.__showCircuitPythonVersions</h4>
322 <b>__showCircuitPythonVersions</b>(<i></i>)
323
324 <p>
325 Private slot to show the CircuitPython version of a connected device and
326 the latest available one (from Github).
327 </p>
328 <a NAME="CircuitPythonDevice.__showTeensyFlashInstructions" ID="CircuitPythonDevice.__showTeensyFlashInstructions"></a>
329 <h4>CircuitPythonDevice.__showTeensyFlashInstructions</h4>
330 <b>__showTeensyFlashInstructions</b>(<i></i>)
331
332 <p>
333 Private method to show a message box because Teensy does not support
334 the UF2 bootloader yet.
335 </p>
336 <a NAME="CircuitPythonDevice.__startTeensyLoader" ID="CircuitPythonDevice.__startTeensyLoader"></a>
337 <h4>CircuitPythonDevice.__startTeensyLoader</h4>
338 <b>__startTeensyLoader</b>(<i></i>)
339
340 <p>
341 Private method to start the 'Teensy Loader' application.
342 </p>
343 <p>
344 Note: The application must be accessible via the application search path.
345 </p>
346 <a NAME="CircuitPythonDevice.addDeviceMenuEntries" ID="CircuitPythonDevice.addDeviceMenuEntries"></a>
347 <h4>CircuitPythonDevice.addDeviceMenuEntries</h4>
348 <b>addDeviceMenuEntries</b>(<i>menu</i>)
349
350 <p>
351 Public method to add device specific entries to the given menu.
352 </p>
353 <dl>
354
355 <dt><i>menu</i> (QMenu)</dt>
356 <dd>
357 reference to the context menu
358 </dd>
359 </dl>
360 <a NAME="CircuitPythonDevice.canRunScript" ID="CircuitPythonDevice.canRunScript"></a>
361 <h4>CircuitPythonDevice.canRunScript</h4>
362 <b>canRunScript</b>(<i></i>)
363
364 <p>
365 Public method to determine, if a script can be executed.
366 </p>
367 <dl>
368 <dt>Return:</dt>
369 <dd>
370 tuple containing a flag indicating it is safe to start a
371 Plotter and a reason why it cannot.
372 </dd>
373 </dl>
374 <dl>
375 <dt>Return Type:</dt>
376 <dd>
377 tuple of (bool, str)
378 </dd>
379 </dl>
380 <a NAME="CircuitPythonDevice.canStartFileManager" ID="CircuitPythonDevice.canStartFileManager"></a>
381 <h4>CircuitPythonDevice.canStartFileManager</h4>
382 <b>canStartFileManager</b>(<i></i>)
383
384 <p>
385 Public method to determine, if a File Manager can be started.
386 </p>
387 <dl>
388 <dt>Return:</dt>
389 <dd>
390 tuple containing a flag indicating it is safe to start a
391 File Manager and a reason why it cannot.
392 </dd>
393 </dl>
394 <dl>
395 <dt>Return Type:</dt>
396 <dd>
397 tuple of (bool, str)
398 </dd>
399 </dl>
400 <a NAME="CircuitPythonDevice.canStartPlotter" ID="CircuitPythonDevice.canStartPlotter"></a>
401 <h4>CircuitPythonDevice.canStartPlotter</h4>
402 <b>canStartPlotter</b>(<i></i>)
403
404 <p>
405 Public method to determine, if a Plotter can be started.
406 </p>
407 <dl>
408 <dt>Return:</dt>
409 <dd>
410 tuple containing a flag indicating it is safe to start a
411 Plotter and a reason why it cannot.
412 </dd>
413 </dl>
414 <dl>
415 <dt>Return Type:</dt>
416 <dd>
417 tuple of (bool, str)
418 </dd>
419 </dl>
420 <a NAME="CircuitPythonDevice.canStartRepl" ID="CircuitPythonDevice.canStartRepl"></a>
421 <h4>CircuitPythonDevice.canStartRepl</h4>
422 <b>canStartRepl</b>(<i></i>)
423
424 <p>
425 Public method to determine, if a REPL can be started.
426 </p>
427 <dl>
428 <dt>Return:</dt>
429 <dd>
430 tuple containing a flag indicating it is safe to start a REPL
431 and a reason why it cannot.
432 </dd>
433 </dl>
434 <dl>
435 <dt>Return Type:</dt>
436 <dd>
437 tuple of (bool, str)
438 </dd>
439 </dl>
440 <a NAME="CircuitPythonDevice.deviceName" ID="CircuitPythonDevice.deviceName"></a>
441 <h4>CircuitPythonDevice.deviceName</h4>
442 <b>deviceName</b>(<i></i>)
443
444 <p>
445 Public method to get the name of the device.
446 </p>
447 <dl>
448 <dt>Return:</dt>
449 <dd>
450 name of the device
451 </dd>
452 </dl>
453 <dl>
454 <dt>Return Type:</dt>
455 <dd>
456 str
457 </dd>
458 </dl>
459 <a NAME="CircuitPythonDevice.forceInterrupt" ID="CircuitPythonDevice.forceInterrupt"></a>
460 <h4>CircuitPythonDevice.forceInterrupt</h4>
461 <b>forceInterrupt</b>(<i></i>)
462
463 <p>
464 Public method to determine the need for an interrupt when opening the
465 serial connection.
466 </p>
467 <dl>
468 <dt>Return:</dt>
469 <dd>
470 flag indicating an interrupt is needed
471 </dd>
472 </dl>
473 <dl>
474 <dt>Return Type:</dt>
475 <dd>
476 bool
477 </dd>
478 </dl>
479 <a NAME="CircuitPythonDevice.getDocumentationUrl" ID="CircuitPythonDevice.getDocumentationUrl"></a>
480 <h4>CircuitPythonDevice.getDocumentationUrl</h4>
481 <b>getDocumentationUrl</b>(<i></i>)
482
483 <p>
484 Public method to get the device documentation URL.
485 </p>
486 <dl>
487 <dt>Return:</dt>
488 <dd>
489 documentation URL of the device
490 </dd>
491 </dl>
492 <dl>
493 <dt>Return Type:</dt>
494 <dd>
495 str
496 </dd>
497 </dl>
498 <a NAME="CircuitPythonDevice.getDownloadMenuEntries" ID="CircuitPythonDevice.getDownloadMenuEntries"></a>
499 <h4>CircuitPythonDevice.getDownloadMenuEntries</h4>
500 <b>getDownloadMenuEntries</b>(<i></i>)
501
502 <p>
503 Public method to retrieve the entries for the downloads menu.
504 </p>
505 <dl>
506 <dt>Return:</dt>
507 <dd>
508 list of tuples with menu text and URL to be opened for each
509 entry
510 </dd>
511 </dl>
512 <dl>
513 <dt>Return Type:</dt>
514 <dd>
515 list of tuple of (str, str)
516 </dd>
517 </dl>
518 <a NAME="CircuitPythonDevice.getWorkspace" ID="CircuitPythonDevice.getWorkspace"></a>
519 <h4>CircuitPythonDevice.getWorkspace</h4>
520 <b>getWorkspace</b>(<i>silent=False</i>)
521
522 <p>
523 Public method to get the workspace directory.
524 </p>
525 <dl>
526
527 <dt><i>silent</i> (bool)</dt>
528 <dd>
529 flag indicating silent operations
530 </dd>
531 </dl>
532 <dl>
533 <dt>Return:</dt>
534 <dd>
535 workspace directory used for saving files
536 </dd>
537 </dl>
538 <dl>
539 <dt>Return Type:</dt>
540 <dd>
541 str
542 </dd>
543 </dl>
544 <a NAME="CircuitPythonDevice.hasFlashMenuEntry" ID="CircuitPythonDevice.hasFlashMenuEntry"></a>
545 <h4>CircuitPythonDevice.hasFlashMenuEntry</h4>
546 <b>hasFlashMenuEntry</b>(<i></i>)
547
548 <p>
549 Public method to check, if the device has its own flash menu entry.
550 </p>
551 <dl>
552 <dt>Return:</dt>
553 <dd>
554 flag indicating a specific flash menu entry
555 </dd>
556 </dl>
557 <dl>
558 <dt>Return Type:</dt>
559 <dd>
560 bool
561 </dd>
562 </dl>
563 <a NAME="CircuitPythonDevice.runScript" ID="CircuitPythonDevice.runScript"></a>
564 <h4>CircuitPythonDevice.runScript</h4>
565 <b>runScript</b>(<i>script</i>)
566
567 <p>
568 Public method to run the given Python script.
569 </p>
570 <dl>
571
572 <dt><i>script</i> (str)</dt>
573 <dd>
574 script to be executed
575 </dd>
576 </dl>
577 <a NAME="CircuitPythonDevice.setButtons" ID="CircuitPythonDevice.setButtons"></a>
578 <h4>CircuitPythonDevice.setButtons</h4>
579 <b>setButtons</b>(<i></i>)
580
581 <p>
582 Public method to enable the supported action buttons.
583 </p>
584 <a NAME="CircuitPythonDevice.supportsLocalFileAccess" ID="CircuitPythonDevice.supportsLocalFileAccess"></a>
585 <h4>CircuitPythonDevice.supportsLocalFileAccess</h4>
586 <b>supportsLocalFileAccess</b>(<i></i>)
587
588 <p>
589 Public method to indicate file access via a local directory.
590 </p>
591 <dl>
592 <dt>Return:</dt>
593 <dd>
594 flag indicating file access via local directory
595 </dd>
596 </dl>
597 <dl>
598 <dt>Return Type:</dt>
599 <dd>
600 bool
601 </dd>
602 </dl>
603 <div align="right"><a href="#top">Up</a></div>
604 <hr />
605 <hr />
606 <a NAME="createDevice" ID="createDevice"></a>
607 <h2>createDevice</h2>
608 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>)
609
610 <p>
611 Function to instantiate a MicroPython device object.
612 </p>
613 <dl>
614
615 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt>
616 <dd>
617 reference to the main MicroPython widget
618 </dd>
619 <dt><i>deviceType</i> (str)</dt>
620 <dd>
621 device type assigned to this device interface
622 </dd>
623 <dt><i>vid</i> (int)</dt>
624 <dd>
625 vendor ID
626 </dd>
627 <dt><i>pid</i> (int)</dt>
628 <dd>
629 product ID
630 </dd>
631 <dt><i>boardName</i> (str)</dt>
632 <dd>
633 name of the board
634 </dd>
635 <dt><i>serialNumber</i> (str)</dt>
636 <dd>
637 serial number of the board
638 </dd>
639 </dl>
640 <dl>
641 <dt>Return:</dt>
642 <dd>
643 reference to the instantiated device object
644 </dd>
645 </dl>
646 <dl>
647 <dt>Return Type:</dt>
648 <dd>
649 CircuitPythonDevice
650 </dd>
651 </dl>
652 <div align="right"><a href="#top">Up</a></div>
653 <hr />
654 </body></html>

eric ide

mercurial