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