|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.PyBoardDevices</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.PyBoardDevices</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the device interface class for PyBoard 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="#PyBoardDevice">PyBoardDevice</a></td> |
|
25 <td>Class implementing the device for PyBoard boards.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="PyBoardDevice" ID="PyBoardDevice"></a> |
|
36 <h2>PyBoardDevice</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing the device for PyBoard boards. |
|
40 </p> |
|
41 <h3>Derived from</h3> |
|
42 MicroPythonDevice |
|
43 <h3>Class Attributes</h3> |
|
44 |
|
45 <table> |
|
46 <tr><td>DeviceVolumeName</td></tr><tr><td>FlashInstructionsURL</td></tr> |
|
47 </table> |
|
48 <h3>Class Methods</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>None</td></tr> |
|
52 </table> |
|
53 <h3>Methods</h3> |
|
54 |
|
55 <table> |
|
56 |
|
57 <tr> |
|
58 <td><a href="#PyBoardDevice.__init__">PyBoardDevice</a></td> |
|
59 <td>Constructor</td> |
|
60 </tr> |
|
61 <tr> |
|
62 <td><a href="#PyBoardDevice.__activateBootloader">__activateBootloader</a></td> |
|
63 <td>Private slot to activate the bootloader and disconnect.</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#PyBoardDevice.__deviceVolumeMounted">__deviceVolumeMounted</a></td> |
|
67 <td>Private method to check, if the device volume is mounted.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#PyBoardDevice.__dfuUtilAvailable">__dfuUtilAvailable</a></td> |
|
71 <td>Private method to check the availability of dfu-util.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#PyBoardDevice.__findWorkspace">__findWorkspace</a></td> |
|
75 <td>Private method to find the workspace directory.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#PyBoardDevice.__flashMicroPython">__flashMicroPython</a></td> |
|
79 <td>Private slot to flash a MicroPython firmware.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#PyBoardDevice.__listDfuCapableDevices">__listDfuCapableDevices</a></td> |
|
83 <td>Private slot to list all DFU-capable devices.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#PyBoardDevice.__showDfuDisableInstructions">__showDfuDisableInstructions</a></td> |
|
87 <td>Private method to show some instructions to disable the DFU mode.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#PyBoardDevice.__showDfuEnableInstructions">__showDfuEnableInstructions</a></td> |
|
91 <td>Private method to show some instructions to enable the DFU mode.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#PyBoardDevice.__showFlashInstructions">__showFlashInstructions</a></td> |
|
95 <td>Private slot to open the URL containing instructions for installing MicroPython on the pyboard.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#PyBoardDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td> |
|
99 <td>Public method to add device specific entries to the given menu.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#PyBoardDevice.canRunScript">canRunScript</a></td> |
|
103 <td>Public method to determine, if a script can be executed.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#PyBoardDevice.canStartFileManager">canStartFileManager</a></td> |
|
107 <td>Public method to determine, if a File Manager can be started.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#PyBoardDevice.canStartPlotter">canStartPlotter</a></td> |
|
111 <td>Public method to determine, if a Plotter can be started.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#PyBoardDevice.canStartRepl">canStartRepl</a></td> |
|
115 <td>Public method to determine, if a REPL can be started.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#PyBoardDevice.deviceName">deviceName</a></td> |
|
119 <td>Public method to get the name of the device.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#PyBoardDevice.forceInterrupt">forceInterrupt</a></td> |
|
123 <td>Public method to determine the need for an interrupt when opening the serial connection.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#PyBoardDevice.getDocumentationUrl">getDocumentationUrl</a></td> |
|
127 <td>Public method to get the device documentation URL.</td> |
|
128 </tr> |
|
129 <tr> |
|
130 <td><a href="#PyBoardDevice.getFirmwareUrl">getFirmwareUrl</a></td> |
|
131 <td>Public method to get the device firmware download URL.</td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td><a href="#PyBoardDevice.getWorkspace">getWorkspace</a></td> |
|
135 <td>Public method to get the workspace directory.</td> |
|
136 </tr> |
|
137 <tr> |
|
138 <td><a href="#PyBoardDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td> |
|
139 <td>Public method to check, if the device has its own flash menu entry.</td> |
|
140 </tr> |
|
141 <tr> |
|
142 <td><a href="#PyBoardDevice.runScript">runScript</a></td> |
|
143 <td>Public method to run the given Python script.</td> |
|
144 </tr> |
|
145 <tr> |
|
146 <td><a href="#PyBoardDevice.setButtons">setButtons</a></td> |
|
147 <td>Public method to enable the supported action buttons.</td> |
|
148 </tr> |
|
149 <tr> |
|
150 <td><a href="#PyBoardDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td> |
|
151 <td>Public method to indicate file access via a local directory.</td> |
|
152 </tr> |
|
153 </table> |
|
154 <h3>Static Methods</h3> |
|
155 |
|
156 <table> |
|
157 <tr><td>None</td></tr> |
|
158 </table> |
|
159 |
|
160 <a NAME="PyBoardDevice.__init__" ID="PyBoardDevice.__init__"></a> |
|
161 <h4>PyBoardDevice (Constructor)</h4> |
|
162 <b>PyBoardDevice</b>(<i>microPythonWidget, deviceType, parent=None</i>) |
|
163 |
|
164 <p> |
|
165 Constructor |
|
166 </p> |
|
167 <dl> |
|
168 |
|
169 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
170 <dd> |
|
171 reference to the main MicroPython widget |
|
172 </dd> |
|
173 <dt><i>deviceType</i> (str)</dt> |
|
174 <dd> |
|
175 device type assigned to this device interface |
|
176 </dd> |
|
177 <dt><i>parent</i> (QObject)</dt> |
|
178 <dd> |
|
179 reference to the parent object |
|
180 </dd> |
|
181 </dl> |
|
182 <a NAME="PyBoardDevice.__activateBootloader" ID="PyBoardDevice.__activateBootloader"></a> |
|
183 <h4>PyBoardDevice.__activateBootloader</h4> |
|
184 <b>__activateBootloader</b>(<i></i>) |
|
185 |
|
186 <p> |
|
187 Private slot to activate the bootloader and disconnect. |
|
188 </p> |
|
189 <a NAME="PyBoardDevice.__deviceVolumeMounted" ID="PyBoardDevice.__deviceVolumeMounted"></a> |
|
190 <h4>PyBoardDevice.__deviceVolumeMounted</h4> |
|
191 <b>__deviceVolumeMounted</b>(<i></i>) |
|
192 |
|
193 <p> |
|
194 Private method to check, if the device volume is mounted. |
|
195 </p> |
|
196 <dl> |
|
197 <dt>Return:</dt> |
|
198 <dd> |
|
199 flag indicated a mounted device |
|
200 </dd> |
|
201 </dl> |
|
202 <dl> |
|
203 <dt>Return Type:</dt> |
|
204 <dd> |
|
205 bool |
|
206 </dd> |
|
207 </dl> |
|
208 <a NAME="PyBoardDevice.__dfuUtilAvailable" ID="PyBoardDevice.__dfuUtilAvailable"></a> |
|
209 <h4>PyBoardDevice.__dfuUtilAvailable</h4> |
|
210 <b>__dfuUtilAvailable</b>(<i></i>) |
|
211 |
|
212 <p> |
|
213 Private method to check the availability of dfu-util. |
|
214 </p> |
|
215 <dl> |
|
216 <dt>Return:</dt> |
|
217 <dd> |
|
218 flag indicating the availability of dfu-util |
|
219 </dd> |
|
220 </dl> |
|
221 <dl> |
|
222 <dt>Return Type:</dt> |
|
223 <dd> |
|
224 bool |
|
225 </dd> |
|
226 </dl> |
|
227 <a NAME="PyBoardDevice.__findWorkspace" ID="PyBoardDevice.__findWorkspace"></a> |
|
228 <h4>PyBoardDevice.__findWorkspace</h4> |
|
229 <b>__findWorkspace</b>(<i>silent=False</i>) |
|
230 |
|
231 <p> |
|
232 Private method to find the workspace directory. |
|
233 </p> |
|
234 <dl> |
|
235 |
|
236 <dt><i>silent</i> (bool)</dt> |
|
237 <dd> |
|
238 flag indicating silent operations |
|
239 </dd> |
|
240 </dl> |
|
241 <dl> |
|
242 <dt>Return:</dt> |
|
243 <dd> |
|
244 workspace directory used for saving files |
|
245 </dd> |
|
246 </dl> |
|
247 <dl> |
|
248 <dt>Return Type:</dt> |
|
249 <dd> |
|
250 str |
|
251 </dd> |
|
252 </dl> |
|
253 <a NAME="PyBoardDevice.__flashMicroPython" ID="PyBoardDevice.__flashMicroPython"></a> |
|
254 <h4>PyBoardDevice.__flashMicroPython</h4> |
|
255 <b>__flashMicroPython</b>(<i></i>) |
|
256 |
|
257 <p> |
|
258 Private slot to flash a MicroPython firmware. |
|
259 </p> |
|
260 <a NAME="PyBoardDevice.__listDfuCapableDevices" ID="PyBoardDevice.__listDfuCapableDevices"></a> |
|
261 <h4>PyBoardDevice.__listDfuCapableDevices</h4> |
|
262 <b>__listDfuCapableDevices</b>(<i></i>) |
|
263 |
|
264 <p> |
|
265 Private slot to list all DFU-capable devices. |
|
266 </p> |
|
267 <a NAME="PyBoardDevice.__showDfuDisableInstructions" ID="PyBoardDevice.__showDfuDisableInstructions"></a> |
|
268 <h4>PyBoardDevice.__showDfuDisableInstructions</h4> |
|
269 <b>__showDfuDisableInstructions</b>(<i></i>) |
|
270 |
|
271 <p> |
|
272 Private method to show some instructions to disable the DFU mode. |
|
273 </p> |
|
274 <a NAME="PyBoardDevice.__showDfuEnableInstructions" ID="PyBoardDevice.__showDfuEnableInstructions"></a> |
|
275 <h4>PyBoardDevice.__showDfuEnableInstructions</h4> |
|
276 <b>__showDfuEnableInstructions</b>(<i>flash=True</i>) |
|
277 |
|
278 <p> |
|
279 Private method to show some instructions to enable the DFU mode. |
|
280 </p> |
|
281 <dl> |
|
282 |
|
283 <dt><i>flash</i> (bool)</dt> |
|
284 <dd> |
|
285 flag indicating to show a warning message for flashing |
|
286 </dd> |
|
287 </dl> |
|
288 <dl> |
|
289 <dt>Return:</dt> |
|
290 <dd> |
|
291 flag indicating OK to continue or abort |
|
292 </dd> |
|
293 </dl> |
|
294 <dl> |
|
295 <dt>Return Type:</dt> |
|
296 <dd> |
|
297 bool |
|
298 </dd> |
|
299 </dl> |
|
300 <a NAME="PyBoardDevice.__showFlashInstructions" ID="PyBoardDevice.__showFlashInstructions"></a> |
|
301 <h4>PyBoardDevice.__showFlashInstructions</h4> |
|
302 <b>__showFlashInstructions</b>(<i></i>) |
|
303 |
|
304 <p> |
|
305 Private slot to open the URL containing instructions for installing |
|
306 MicroPython on the pyboard. |
|
307 </p> |
|
308 <a NAME="PyBoardDevice.addDeviceMenuEntries" ID="PyBoardDevice.addDeviceMenuEntries"></a> |
|
309 <h4>PyBoardDevice.addDeviceMenuEntries</h4> |
|
310 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
|
311 |
|
312 <p> |
|
313 Public method to add device specific entries to the given menu. |
|
314 </p> |
|
315 <dl> |
|
316 |
|
317 <dt><i>menu</i> (QMenu)</dt> |
|
318 <dd> |
|
319 reference to the context menu |
|
320 </dd> |
|
321 </dl> |
|
322 <a NAME="PyBoardDevice.canRunScript" ID="PyBoardDevice.canRunScript"></a> |
|
323 <h4>PyBoardDevice.canRunScript</h4> |
|
324 <b>canRunScript</b>(<i></i>) |
|
325 |
|
326 <p> |
|
327 Public method to determine, if a script can be executed. |
|
328 </p> |
|
329 <dl> |
|
330 <dt>Return:</dt> |
|
331 <dd> |
|
332 tuple containing a flag indicating it is safe to start a |
|
333 Plotter and a reason why it cannot. |
|
334 </dd> |
|
335 </dl> |
|
336 <dl> |
|
337 <dt>Return Type:</dt> |
|
338 <dd> |
|
339 tuple of (bool, str) |
|
340 </dd> |
|
341 </dl> |
|
342 <a NAME="PyBoardDevice.canStartFileManager" ID="PyBoardDevice.canStartFileManager"></a> |
|
343 <h4>PyBoardDevice.canStartFileManager</h4> |
|
344 <b>canStartFileManager</b>(<i></i>) |
|
345 |
|
346 <p> |
|
347 Public method to determine, if a File Manager can be started. |
|
348 </p> |
|
349 <dl> |
|
350 <dt>Return:</dt> |
|
351 <dd> |
|
352 tuple containing a flag indicating it is safe to start a |
|
353 File Manager and a reason why it cannot. |
|
354 </dd> |
|
355 </dl> |
|
356 <dl> |
|
357 <dt>Return Type:</dt> |
|
358 <dd> |
|
359 tuple of (bool, str) |
|
360 </dd> |
|
361 </dl> |
|
362 <a NAME="PyBoardDevice.canStartPlotter" ID="PyBoardDevice.canStartPlotter"></a> |
|
363 <h4>PyBoardDevice.canStartPlotter</h4> |
|
364 <b>canStartPlotter</b>(<i></i>) |
|
365 |
|
366 <p> |
|
367 Public method to determine, if a Plotter can be started. |
|
368 </p> |
|
369 <dl> |
|
370 <dt>Return:</dt> |
|
371 <dd> |
|
372 tuple containing a flag indicating it is safe to start a |
|
373 Plotter and a reason why it cannot. |
|
374 </dd> |
|
375 </dl> |
|
376 <dl> |
|
377 <dt>Return Type:</dt> |
|
378 <dd> |
|
379 tuple of (bool, str) |
|
380 </dd> |
|
381 </dl> |
|
382 <a NAME="PyBoardDevice.canStartRepl" ID="PyBoardDevice.canStartRepl"></a> |
|
383 <h4>PyBoardDevice.canStartRepl</h4> |
|
384 <b>canStartRepl</b>(<i></i>) |
|
385 |
|
386 <p> |
|
387 Public method to determine, if a REPL can be started. |
|
388 </p> |
|
389 <dl> |
|
390 <dt>Return:</dt> |
|
391 <dd> |
|
392 tuple containing a flag indicating it is safe to start a REPL |
|
393 and a reason why it cannot. |
|
394 </dd> |
|
395 </dl> |
|
396 <dl> |
|
397 <dt>Return Type:</dt> |
|
398 <dd> |
|
399 tuple of (bool, str) |
|
400 </dd> |
|
401 </dl> |
|
402 <a NAME="PyBoardDevice.deviceName" ID="PyBoardDevice.deviceName"></a> |
|
403 <h4>PyBoardDevice.deviceName</h4> |
|
404 <b>deviceName</b>(<i></i>) |
|
405 |
|
406 <p> |
|
407 Public method to get the name of the device. |
|
408 </p> |
|
409 <dl> |
|
410 <dt>Return:</dt> |
|
411 <dd> |
|
412 name of the device |
|
413 </dd> |
|
414 </dl> |
|
415 <dl> |
|
416 <dt>Return Type:</dt> |
|
417 <dd> |
|
418 str |
|
419 </dd> |
|
420 </dl> |
|
421 <a NAME="PyBoardDevice.forceInterrupt" ID="PyBoardDevice.forceInterrupt"></a> |
|
422 <h4>PyBoardDevice.forceInterrupt</h4> |
|
423 <b>forceInterrupt</b>(<i></i>) |
|
424 |
|
425 <p> |
|
426 Public method to determine the need for an interrupt when opening the |
|
427 serial connection. |
|
428 </p> |
|
429 <dl> |
|
430 <dt>Return:</dt> |
|
431 <dd> |
|
432 flag indicating an interrupt is needed |
|
433 </dd> |
|
434 </dl> |
|
435 <dl> |
|
436 <dt>Return Type:</dt> |
|
437 <dd> |
|
438 bool |
|
439 </dd> |
|
440 </dl> |
|
441 <a NAME="PyBoardDevice.getDocumentationUrl" ID="PyBoardDevice.getDocumentationUrl"></a> |
|
442 <h4>PyBoardDevice.getDocumentationUrl</h4> |
|
443 <b>getDocumentationUrl</b>(<i></i>) |
|
444 |
|
445 <p> |
|
446 Public method to get the device documentation URL. |
|
447 </p> |
|
448 <dl> |
|
449 <dt>Return:</dt> |
|
450 <dd> |
|
451 documentation URL of the device |
|
452 </dd> |
|
453 </dl> |
|
454 <dl> |
|
455 <dt>Return Type:</dt> |
|
456 <dd> |
|
457 str |
|
458 </dd> |
|
459 </dl> |
|
460 <a NAME="PyBoardDevice.getFirmwareUrl" ID="PyBoardDevice.getFirmwareUrl"></a> |
|
461 <h4>PyBoardDevice.getFirmwareUrl</h4> |
|
462 <b>getFirmwareUrl</b>(<i></i>) |
|
463 |
|
464 <p> |
|
465 Public method to get the device firmware download URL. |
|
466 </p> |
|
467 <dl> |
|
468 <dt>Return:</dt> |
|
469 <dd> |
|
470 firmware download URL of the device |
|
471 </dd> |
|
472 </dl> |
|
473 <dl> |
|
474 <dt>Return Type:</dt> |
|
475 <dd> |
|
476 str |
|
477 </dd> |
|
478 </dl> |
|
479 <a NAME="PyBoardDevice.getWorkspace" ID="PyBoardDevice.getWorkspace"></a> |
|
480 <h4>PyBoardDevice.getWorkspace</h4> |
|
481 <b>getWorkspace</b>(<i>silent=False</i>) |
|
482 |
|
483 <p> |
|
484 Public method to get the workspace directory. |
|
485 </p> |
|
486 <dl> |
|
487 |
|
488 <dt><i>silent</i> (bool)</dt> |
|
489 <dd> |
|
490 flag indicating silent operations |
|
491 </dd> |
|
492 </dl> |
|
493 <dl> |
|
494 <dt>Return:</dt> |
|
495 <dd> |
|
496 workspace directory used for saving files |
|
497 </dd> |
|
498 </dl> |
|
499 <dl> |
|
500 <dt>Return Type:</dt> |
|
501 <dd> |
|
502 str |
|
503 </dd> |
|
504 </dl> |
|
505 <a NAME="PyBoardDevice.hasFlashMenuEntry" ID="PyBoardDevice.hasFlashMenuEntry"></a> |
|
506 <h4>PyBoardDevice.hasFlashMenuEntry</h4> |
|
507 <b>hasFlashMenuEntry</b>(<i></i>) |
|
508 |
|
509 <p> |
|
510 Public method to check, if the device has its own flash menu entry. |
|
511 </p> |
|
512 <dl> |
|
513 <dt>Return:</dt> |
|
514 <dd> |
|
515 flag indicating a specific flash menu entry |
|
516 </dd> |
|
517 </dl> |
|
518 <dl> |
|
519 <dt>Return Type:</dt> |
|
520 <dd> |
|
521 bool |
|
522 </dd> |
|
523 </dl> |
|
524 <a NAME="PyBoardDevice.runScript" ID="PyBoardDevice.runScript"></a> |
|
525 <h4>PyBoardDevice.runScript</h4> |
|
526 <b>runScript</b>(<i>script</i>) |
|
527 |
|
528 <p> |
|
529 Public method to run the given Python script. |
|
530 </p> |
|
531 <dl> |
|
532 |
|
533 <dt><i>script</i> (str)</dt> |
|
534 <dd> |
|
535 script to be executed |
|
536 </dd> |
|
537 </dl> |
|
538 <a NAME="PyBoardDevice.setButtons" ID="PyBoardDevice.setButtons"></a> |
|
539 <h4>PyBoardDevice.setButtons</h4> |
|
540 <b>setButtons</b>(<i></i>) |
|
541 |
|
542 <p> |
|
543 Public method to enable the supported action buttons. |
|
544 </p> |
|
545 <a NAME="PyBoardDevice.supportsLocalFileAccess" ID="PyBoardDevice.supportsLocalFileAccess"></a> |
|
546 <h4>PyBoardDevice.supportsLocalFileAccess</h4> |
|
547 <b>supportsLocalFileAccess</b>(<i></i>) |
|
548 |
|
549 <p> |
|
550 Public method to indicate file access via a local directory. |
|
551 </p> |
|
552 <dl> |
|
553 <dt>Return:</dt> |
|
554 <dd> |
|
555 flag indicating file access via local directory |
|
556 </dd> |
|
557 </dl> |
|
558 <dl> |
|
559 <dt>Return Type:</dt> |
|
560 <dd> |
|
561 bool |
|
562 </dd> |
|
563 </dl> |
|
564 <div align="right"><a href="#top">Up</a></div> |
|
565 <hr /> |
|
566 </body></html> |