|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.CircuitPythonDevices</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.CircuitPythonDevices</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing the device interface class for CircuitPython 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="#CircuitPythonDevice">CircuitPythonDevice</a></td> |
|
39 <td>Class implementing the device for CircuitPython 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="CircuitPythonDevice" ID="CircuitPythonDevice"></a> |
|
50 <h2>CircuitPythonDevice</h2> |
|
51 |
|
52 <p> |
|
53 Class implementing the device for CircuitPython boards. |
|
54 </p> |
|
55 <h3>Derived from</h3> |
|
56 MicroPythonDevice |
|
57 <h3>Class Attributes</h3> |
|
58 |
|
59 <table> |
|
60 <tr><td>DeviceVolumeName</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="#CircuitPythonDevice.__init__">CircuitPythonDevice</a></td> |
|
73 <td>Constructor</td> |
|
74 </tr> |
|
75 <tr> |
|
76 <td><a href="#CircuitPythonDevice.__deviceVolumeMounted">__deviceVolumeMounted</a></td> |
|
77 <td>Private method to check, if the device volume is mounted.</td> |
|
78 </tr> |
|
79 <tr> |
|
80 <td><a href="#CircuitPythonDevice.__findWorkspace">__findWorkspace</a></td> |
|
81 <td>Private method to find the workspace directory.</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#CircuitPythonDevice.__flashCircuitPython">__flashCircuitPython</a></td> |
|
85 <td>Private slot to flash a CircuitPython firmware to the device.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#CircuitPythonDevice.__flashTeensy">__flashTeensy</a></td> |
|
89 <td>Private method to show a message box because Teens does not support the UF2 bootloader yet.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#CircuitPythonDevice.__installLibraryFiles">__installLibraryFiles</a></td> |
|
93 <td>Private slot to install Python files into the onboard library.</td> |
|
94 </tr> |
|
95 <tr> |
|
96 <td><a href="#CircuitPythonDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td> |
|
97 <td>Public method to add device specific entries to the given menu.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#CircuitPythonDevice.canRunScript">canRunScript</a></td> |
|
101 <td>Public method to determine, if a script can be executed.</td> |
|
102 </tr> |
|
103 <tr> |
|
104 <td><a href="#CircuitPythonDevice.canStartFileManager">canStartFileManager</a></td> |
|
105 <td>Public method to determine, if a File Manager can be started.</td> |
|
106 </tr> |
|
107 <tr> |
|
108 <td><a href="#CircuitPythonDevice.canStartPlotter">canStartPlotter</a></td> |
|
109 <td>Public method to determine, if a Plotter can be started.</td> |
|
110 </tr> |
|
111 <tr> |
|
112 <td><a href="#CircuitPythonDevice.canStartRepl">canStartRepl</a></td> |
|
113 <td>Public method to determine, if a REPL can be started.</td> |
|
114 </tr> |
|
115 <tr> |
|
116 <td><a href="#CircuitPythonDevice.deviceName">deviceName</a></td> |
|
117 <td>Public method to get the name of the device.</td> |
|
118 </tr> |
|
119 <tr> |
|
120 <td><a href="#CircuitPythonDevice.forceInterrupt">forceInterrupt</a></td> |
|
121 <td>Public method to determine the need for an interrupt when opening the serial connection.</td> |
|
122 </tr> |
|
123 <tr> |
|
124 <td><a href="#CircuitPythonDevice.getDocumentationUrl">getDocumentationUrl</a></td> |
|
125 <td>Public method to get the device documentation URL.</td> |
|
126 </tr> |
|
127 <tr> |
|
128 <td><a href="#CircuitPythonDevice.getDownloadMenuEntries">getDownloadMenuEntries</a></td> |
|
129 <td>Public method to retrieve the entries for the downloads menu.</td> |
|
130 </tr> |
|
131 <tr> |
|
132 <td><a href="#CircuitPythonDevice.getWorkspace">getWorkspace</a></td> |
|
133 <td>Public method to get the workspace directory.</td> |
|
134 </tr> |
|
135 <tr> |
|
136 <td><a href="#CircuitPythonDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td> |
|
137 <td>Public method to check, if the device has its own flash menu entry.</td> |
|
138 </tr> |
|
139 <tr> |
|
140 <td><a href="#CircuitPythonDevice.runScript">runScript</a></td> |
|
141 <td>Public method to run the given Python script.</td> |
|
142 </tr> |
|
143 <tr> |
|
144 <td><a href="#CircuitPythonDevice.setButtons">setButtons</a></td> |
|
145 <td>Public method to enable the supported action buttons.</td> |
|
146 </tr> |
|
147 <tr> |
|
148 <td><a href="#CircuitPythonDevice.supportsLocalFileAccess">supportsLocalFileAccess</a></td> |
|
149 <td>Public method to indicate file access via a local directory.</td> |
|
150 </tr> |
|
151 </table> |
|
152 <h3>Static Methods</h3> |
|
153 |
|
154 <table> |
|
155 <tr><td>None</td></tr> |
|
156 </table> |
|
157 |
|
158 <a NAME="CircuitPythonDevice.__init__" ID="CircuitPythonDevice.__init__"></a> |
|
159 <h4>CircuitPythonDevice (Constructor)</h4> |
|
160 <b>CircuitPythonDevice</b>(<i>microPythonWidget, deviceType, parent=None</i>) |
|
161 |
|
162 <p> |
|
163 Constructor |
|
164 </p> |
|
165 <dl> |
|
166 |
|
167 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
168 <dd> |
|
169 reference to the main MicroPython widget |
|
170 </dd> |
|
171 <dt><i>deviceType</i> (str)</dt> |
|
172 <dd> |
|
173 device type assigned to this device interface |
|
174 </dd> |
|
175 <dt><i>parent</i> (QObject)</dt> |
|
176 <dd> |
|
177 reference to the parent object |
|
178 </dd> |
|
179 </dl> |
|
180 <a NAME="CircuitPythonDevice.__deviceVolumeMounted" ID="CircuitPythonDevice.__deviceVolumeMounted"></a> |
|
181 <h4>CircuitPythonDevice.__deviceVolumeMounted</h4> |
|
182 <b>__deviceVolumeMounted</b>(<i></i>) |
|
183 |
|
184 <p> |
|
185 Private method to check, if the device volume is mounted. |
|
186 </p> |
|
187 <dl> |
|
188 <dt>Return:</dt> |
|
189 <dd> |
|
190 flag indicated a mounted device |
|
191 </dd> |
|
192 </dl> |
|
193 <dl> |
|
194 <dt>Return Type:</dt> |
|
195 <dd> |
|
196 bool |
|
197 </dd> |
|
198 </dl> |
|
199 <a NAME="CircuitPythonDevice.__findWorkspace" ID="CircuitPythonDevice.__findWorkspace"></a> |
|
200 <h4>CircuitPythonDevice.__findWorkspace</h4> |
|
201 <b>__findWorkspace</b>(<i>silent=False</i>) |
|
202 |
|
203 <p> |
|
204 Private method to find the workspace directory. |
|
205 </p> |
|
206 <dl> |
|
207 |
|
208 <dt><i>silent</i> (bool)</dt> |
|
209 <dd> |
|
210 flag indicating silent operations |
|
211 </dd> |
|
212 </dl> |
|
213 <dl> |
|
214 <dt>Return:</dt> |
|
215 <dd> |
|
216 workspace directory used for saving files |
|
217 </dd> |
|
218 </dl> |
|
219 <dl> |
|
220 <dt>Return Type:</dt> |
|
221 <dd> |
|
222 str |
|
223 </dd> |
|
224 </dl> |
|
225 <a NAME="CircuitPythonDevice.__flashCircuitPython" ID="CircuitPythonDevice.__flashCircuitPython"></a> |
|
226 <h4>CircuitPythonDevice.__flashCircuitPython</h4> |
|
227 <b>__flashCircuitPython</b>(<i></i>) |
|
228 |
|
229 <p> |
|
230 Private slot to flash a CircuitPython firmware to the device. |
|
231 </p> |
|
232 <a NAME="CircuitPythonDevice.__flashTeensy" ID="CircuitPythonDevice.__flashTeensy"></a> |
|
233 <h4>CircuitPythonDevice.__flashTeensy</h4> |
|
234 <b>__flashTeensy</b>(<i></i>) |
|
235 |
|
236 <p> |
|
237 Private method to show a message box because Teens does not support |
|
238 the UF2 bootloader yet. |
|
239 </p> |
|
240 <a NAME="CircuitPythonDevice.__installLibraryFiles" ID="CircuitPythonDevice.__installLibraryFiles"></a> |
|
241 <h4>CircuitPythonDevice.__installLibraryFiles</h4> |
|
242 <b>__installLibraryFiles</b>(<i></i>) |
|
243 |
|
244 <p> |
|
245 Private slot to install Python files into the onboard library. |
|
246 </p> |
|
247 <a NAME="CircuitPythonDevice.addDeviceMenuEntries" ID="CircuitPythonDevice.addDeviceMenuEntries"></a> |
|
248 <h4>CircuitPythonDevice.addDeviceMenuEntries</h4> |
|
249 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
|
250 |
|
251 <p> |
|
252 Public method to add device specific entries to the given menu. |
|
253 </p> |
|
254 <dl> |
|
255 |
|
256 <dt><i>menu</i> (QMenu)</dt> |
|
257 <dd> |
|
258 reference to the context menu |
|
259 </dd> |
|
260 </dl> |
|
261 <a NAME="CircuitPythonDevice.canRunScript" ID="CircuitPythonDevice.canRunScript"></a> |
|
262 <h4>CircuitPythonDevice.canRunScript</h4> |
|
263 <b>canRunScript</b>(<i></i>) |
|
264 |
|
265 <p> |
|
266 Public method to determine, if a script can be executed. |
|
267 </p> |
|
268 <dl> |
|
269 <dt>Return:</dt> |
|
270 <dd> |
|
271 tuple containing a flag indicating it is safe to start a |
|
272 Plotter and a reason why it cannot. |
|
273 </dd> |
|
274 </dl> |
|
275 <dl> |
|
276 <dt>Return Type:</dt> |
|
277 <dd> |
|
278 tuple of (bool, str) |
|
279 </dd> |
|
280 </dl> |
|
281 <a NAME="CircuitPythonDevice.canStartFileManager" ID="CircuitPythonDevice.canStartFileManager"></a> |
|
282 <h4>CircuitPythonDevice.canStartFileManager</h4> |
|
283 <b>canStartFileManager</b>(<i></i>) |
|
284 |
|
285 <p> |
|
286 Public method to determine, if a File Manager can be started. |
|
287 </p> |
|
288 <dl> |
|
289 <dt>Return:</dt> |
|
290 <dd> |
|
291 tuple containing a flag indicating it is safe to start a |
|
292 File Manager and a reason why it cannot. |
|
293 </dd> |
|
294 </dl> |
|
295 <dl> |
|
296 <dt>Return Type:</dt> |
|
297 <dd> |
|
298 tuple of (bool, str) |
|
299 </dd> |
|
300 </dl> |
|
301 <a NAME="CircuitPythonDevice.canStartPlotter" ID="CircuitPythonDevice.canStartPlotter"></a> |
|
302 <h4>CircuitPythonDevice.canStartPlotter</h4> |
|
303 <b>canStartPlotter</b>(<i></i>) |
|
304 |
|
305 <p> |
|
306 Public method to determine, if a Plotter can be started. |
|
307 </p> |
|
308 <dl> |
|
309 <dt>Return:</dt> |
|
310 <dd> |
|
311 tuple containing a flag indicating it is safe to start a |
|
312 Plotter and a reason why it cannot. |
|
313 </dd> |
|
314 </dl> |
|
315 <dl> |
|
316 <dt>Return Type:</dt> |
|
317 <dd> |
|
318 tuple of (bool, str) |
|
319 </dd> |
|
320 </dl> |
|
321 <a NAME="CircuitPythonDevice.canStartRepl" ID="CircuitPythonDevice.canStartRepl"></a> |
|
322 <h4>CircuitPythonDevice.canStartRepl</h4> |
|
323 <b>canStartRepl</b>(<i></i>) |
|
324 |
|
325 <p> |
|
326 Public method to determine, if a REPL can be started. |
|
327 </p> |
|
328 <dl> |
|
329 <dt>Return:</dt> |
|
330 <dd> |
|
331 tuple containing a flag indicating it is safe to start a REPL |
|
332 and a reason why it cannot. |
|
333 </dd> |
|
334 </dl> |
|
335 <dl> |
|
336 <dt>Return Type:</dt> |
|
337 <dd> |
|
338 tuple of (bool, str) |
|
339 </dd> |
|
340 </dl> |
|
341 <a NAME="CircuitPythonDevice.deviceName" ID="CircuitPythonDevice.deviceName"></a> |
|
342 <h4>CircuitPythonDevice.deviceName</h4> |
|
343 <b>deviceName</b>(<i></i>) |
|
344 |
|
345 <p> |
|
346 Public method to get the name of the device. |
|
347 </p> |
|
348 <dl> |
|
349 <dt>Return:</dt> |
|
350 <dd> |
|
351 name of the device |
|
352 </dd> |
|
353 </dl> |
|
354 <dl> |
|
355 <dt>Return Type:</dt> |
|
356 <dd> |
|
357 str |
|
358 </dd> |
|
359 </dl> |
|
360 <a NAME="CircuitPythonDevice.forceInterrupt" ID="CircuitPythonDevice.forceInterrupt"></a> |
|
361 <h4>CircuitPythonDevice.forceInterrupt</h4> |
|
362 <b>forceInterrupt</b>(<i></i>) |
|
363 |
|
364 <p> |
|
365 Public method to determine the need for an interrupt when opening the |
|
366 serial connection. |
|
367 </p> |
|
368 <dl> |
|
369 <dt>Return:</dt> |
|
370 <dd> |
|
371 flag indicating an interrupt is needed |
|
372 </dd> |
|
373 </dl> |
|
374 <dl> |
|
375 <dt>Return Type:</dt> |
|
376 <dd> |
|
377 bool |
|
378 </dd> |
|
379 </dl> |
|
380 <a NAME="CircuitPythonDevice.getDocumentationUrl" ID="CircuitPythonDevice.getDocumentationUrl"></a> |
|
381 <h4>CircuitPythonDevice.getDocumentationUrl</h4> |
|
382 <b>getDocumentationUrl</b>(<i></i>) |
|
383 |
|
384 <p> |
|
385 Public method to get the device documentation URL. |
|
386 </p> |
|
387 <dl> |
|
388 <dt>Return:</dt> |
|
389 <dd> |
|
390 documentation URL of the device |
|
391 </dd> |
|
392 </dl> |
|
393 <dl> |
|
394 <dt>Return Type:</dt> |
|
395 <dd> |
|
396 str |
|
397 </dd> |
|
398 </dl> |
|
399 <a NAME="CircuitPythonDevice.getDownloadMenuEntries" ID="CircuitPythonDevice.getDownloadMenuEntries"></a> |
|
400 <h4>CircuitPythonDevice.getDownloadMenuEntries</h4> |
|
401 <b>getDownloadMenuEntries</b>(<i></i>) |
|
402 |
|
403 <p> |
|
404 Public method to retrieve the entries for the downloads menu. |
|
405 </p> |
|
406 <dl> |
|
407 <dt>Return:</dt> |
|
408 <dd> |
|
409 list of tuples with menu text and URL to be opened for each |
|
410 entry |
|
411 </dd> |
|
412 </dl> |
|
413 <dl> |
|
414 <dt>Return Type:</dt> |
|
415 <dd> |
|
416 list of tuple of (str, str) |
|
417 </dd> |
|
418 </dl> |
|
419 <a NAME="CircuitPythonDevice.getWorkspace" ID="CircuitPythonDevice.getWorkspace"></a> |
|
420 <h4>CircuitPythonDevice.getWorkspace</h4> |
|
421 <b>getWorkspace</b>(<i>silent=False</i>) |
|
422 |
|
423 <p> |
|
424 Public method to get the workspace directory. |
|
425 </p> |
|
426 <dl> |
|
427 |
|
428 <dt><i>silent</i> (bool)</dt> |
|
429 <dd> |
|
430 flag indicating silent operations |
|
431 </dd> |
|
432 </dl> |
|
433 <dl> |
|
434 <dt>Return:</dt> |
|
435 <dd> |
|
436 workspace directory used for saving files |
|
437 </dd> |
|
438 </dl> |
|
439 <dl> |
|
440 <dt>Return Type:</dt> |
|
441 <dd> |
|
442 str |
|
443 </dd> |
|
444 </dl> |
|
445 <a NAME="CircuitPythonDevice.hasFlashMenuEntry" ID="CircuitPythonDevice.hasFlashMenuEntry"></a> |
|
446 <h4>CircuitPythonDevice.hasFlashMenuEntry</h4> |
|
447 <b>hasFlashMenuEntry</b>(<i></i>) |
|
448 |
|
449 <p> |
|
450 Public method to check, if the device has its own flash menu entry. |
|
451 </p> |
|
452 <dl> |
|
453 <dt>Return:</dt> |
|
454 <dd> |
|
455 flag indicating a specific flash menu entry |
|
456 </dd> |
|
457 </dl> |
|
458 <dl> |
|
459 <dt>Return Type:</dt> |
|
460 <dd> |
|
461 bool |
|
462 </dd> |
|
463 </dl> |
|
464 <a NAME="CircuitPythonDevice.runScript" ID="CircuitPythonDevice.runScript"></a> |
|
465 <h4>CircuitPythonDevice.runScript</h4> |
|
466 <b>runScript</b>(<i>script</i>) |
|
467 |
|
468 <p> |
|
469 Public method to run the given Python script. |
|
470 </p> |
|
471 <dl> |
|
472 |
|
473 <dt><i>script</i> (str)</dt> |
|
474 <dd> |
|
475 script to be executed |
|
476 </dd> |
|
477 </dl> |
|
478 <a NAME="CircuitPythonDevice.setButtons" ID="CircuitPythonDevice.setButtons"></a> |
|
479 <h4>CircuitPythonDevice.setButtons</h4> |
|
480 <b>setButtons</b>(<i></i>) |
|
481 |
|
482 <p> |
|
483 Public method to enable the supported action buttons. |
|
484 </p> |
|
485 <a NAME="CircuitPythonDevice.supportsLocalFileAccess" ID="CircuitPythonDevice.supportsLocalFileAccess"></a> |
|
486 <h4>CircuitPythonDevice.supportsLocalFileAccess</h4> |
|
487 <b>supportsLocalFileAccess</b>(<i></i>) |
|
488 |
|
489 <p> |
|
490 Public method to indicate file access via a local directory. |
|
491 </p> |
|
492 <dl> |
|
493 <dt>Return:</dt> |
|
494 <dd> |
|
495 flag indicating file access via local directory |
|
496 </dd> |
|
497 </dl> |
|
498 <dl> |
|
499 <dt>Return Type:</dt> |
|
500 <dd> |
|
501 bool |
|
502 </dd> |
|
503 </dl> |
|
504 <div align="right"><a href="#top">Up</a></div> |
|
505 <hr /> |
|
506 </body></html> |