|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.Devices.EspDevices</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.EspDevices</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the device interface class for ESP32 and ESP8266 based |
|
13 boards. |
|
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="#EspDevice">EspDevice</a></td> |
|
26 <td>Class implementing the device for ESP32 and ESP8266 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="EspDevice" ID="EspDevice"></a> |
|
41 <h2>EspDevice</h2> |
|
42 |
|
43 <p> |
|
44 Class implementing the device for ESP32 and ESP8266 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="#EspDevice.__init__">EspDevice</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#EspDevice.__backupFlash">__backupFlash</a></td> |
|
68 <td>Private slot to backup the currently flashed firmware.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#EspDevice.__createEsp32Submenu">__createEsp32Submenu</a></td> |
|
72 <td>Private method to create the ESP32 submenu.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#EspDevice.__eraseFlash">__eraseFlash</a></td> |
|
76 <td>Private slot to erase the device flash memory.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#EspDevice.__firmwareVersionResponse">__firmwareVersionResponse</a></td> |
|
80 <td>Private method handling the response of the latest version request.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#EspDevice.__flashAddons">__flashAddons</a></td> |
|
84 <td>Private slot to flash some additional firmware images.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#EspDevice.__flashMicroPython">__flashMicroPython</a></td> |
|
88 <td>Private slot to flash a MicroPython firmware to the device.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#EspDevice.__installEspTool">__installEspTool</a></td> |
|
92 <td>Private slot to install the esptool package via pip.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#EspDevice.__resetDevice">__resetDevice</a></td> |
|
96 <td>Private slot to reset the connected device.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#EspDevice.__restoreFlash">__restoreFlash</a></td> |
|
100 <td>Private slot to restore a previously saved firmware.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#EspDevice.__showChipID">__showChipID</a></td> |
|
104 <td>Private slot to show the ID of the ESP chip.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#EspDevice.__showFirmwareVersions">__showFirmwareVersions</a></td> |
|
108 <td>Private slot to show the firmware version of the connected device and the available firmware version.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#EspDevice.__showFlashID">__showFlashID</a></td> |
|
112 <td>Private slot to show the ID of the ESP flash chip.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#EspDevice.__showMACAddress">__showMACAddress</a></td> |
|
116 <td>Private slot to show the MAC address of the ESP chip.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#EspDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td> |
|
120 <td>Public method to add device specific entries to the given menu.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#EspDevice.canRunScript">canRunScript</a></td> |
|
124 <td>Public method to determine, if a script can be executed.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#EspDevice.canStartFileManager">canStartFileManager</a></td> |
|
128 <td>Public method to determine, if a File Manager can be started.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#EspDevice.canStartPlotter">canStartPlotter</a></td> |
|
132 <td>Public method to determine, if a Plotter can be started.</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#EspDevice.canStartRepl">canStartRepl</a></td> |
|
136 <td>Public method to determine, if a REPL can be started.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <td><a href="#EspDevice.deviceName">deviceName</a></td> |
|
140 <td>Public method to get the name of the device.</td> |
|
141 </tr> |
|
142 <tr> |
|
143 <td><a href="#EspDevice.forceInterrupt">forceInterrupt</a></td> |
|
144 <td>Public method to determine the need for an interrupt when opening the serial connection.</td> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#EspDevice.getDocumentationUrl">getDocumentationUrl</a></td> |
|
148 <td>Public method to get the device documentation URL.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#EspDevice.getFirmwareUrl">getFirmwareUrl</a></td> |
|
152 <td>Public method to get the device firmware download URL.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#EspDevice.hasFlashMenuEntry">hasFlashMenuEntry</a></td> |
|
156 <td>Public method to check, if the device has its own flash menu entry.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#EspDevice.runScript">runScript</a></td> |
|
160 <td>Public method to run the given Python script.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#EspDevice.setButtons">setButtons</a></td> |
|
164 <td>Public method to enable the supported action buttons.</td> |
|
165 </tr> |
|
166 </table> |
|
167 <h3>Static Methods</h3> |
|
168 |
|
169 <table> |
|
170 <tr><td>None</td></tr> |
|
171 </table> |
|
172 |
|
173 <a NAME="EspDevice.__init__" ID="EspDevice.__init__"></a> |
|
174 <h4>EspDevice (Constructor)</h4> |
|
175 <b>EspDevice</b>(<i>microPythonWidget, deviceType, parent=None</i>) |
|
176 |
|
177 <p> |
|
178 Constructor |
|
179 </p> |
|
180 <dl> |
|
181 |
|
182 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
183 <dd> |
|
184 reference to the main MicroPython widget |
|
185 </dd> |
|
186 <dt><i>deviceType</i> (str)</dt> |
|
187 <dd> |
|
188 device type assigned to this device interface |
|
189 </dd> |
|
190 <dt><i>parent</i> (QObject)</dt> |
|
191 <dd> |
|
192 reference to the parent object |
|
193 </dd> |
|
194 </dl> |
|
195 <a NAME="EspDevice.__backupFlash" ID="EspDevice.__backupFlash"></a> |
|
196 <h4>EspDevice.__backupFlash</h4> |
|
197 <b>__backupFlash</b>(<i></i>) |
|
198 |
|
199 <p> |
|
200 Private slot to backup the currently flashed firmware. |
|
201 </p> |
|
202 <a NAME="EspDevice.__createEsp32Submenu" ID="EspDevice.__createEsp32Submenu"></a> |
|
203 <h4>EspDevice.__createEsp32Submenu</h4> |
|
204 <b>__createEsp32Submenu</b>(<i></i>) |
|
205 |
|
206 <p> |
|
207 Private method to create the ESP32 submenu. |
|
208 </p> |
|
209 <a NAME="EspDevice.__eraseFlash" ID="EspDevice.__eraseFlash"></a> |
|
210 <h4>EspDevice.__eraseFlash</h4> |
|
211 <b>__eraseFlash</b>(<i></i>) |
|
212 |
|
213 <p> |
|
214 Private slot to erase the device flash memory. |
|
215 </p> |
|
216 <a NAME="EspDevice.__firmwareVersionResponse" ID="EspDevice.__firmwareVersionResponse"></a> |
|
217 <h4>EspDevice.__firmwareVersionResponse</h4> |
|
218 <b>__firmwareVersionResponse</b>(<i>reply</i>) |
|
219 |
|
220 <p> |
|
221 Private method handling the response of the latest version request. |
|
222 </p> |
|
223 <dl> |
|
224 |
|
225 <dt><i>reply</i> (QNetworkReply)</dt> |
|
226 <dd> |
|
227 reference to the reply object |
|
228 </dd> |
|
229 </dl> |
|
230 <a NAME="EspDevice.__flashAddons" ID="EspDevice.__flashAddons"></a> |
|
231 <h4>EspDevice.__flashAddons</h4> |
|
232 <b>__flashAddons</b>(<i></i>) |
|
233 |
|
234 <p> |
|
235 Private slot to flash some additional firmware images. |
|
236 </p> |
|
237 <a NAME="EspDevice.__flashMicroPython" ID="EspDevice.__flashMicroPython"></a> |
|
238 <h4>EspDevice.__flashMicroPython</h4> |
|
239 <b>__flashMicroPython</b>(<i></i>) |
|
240 |
|
241 <p> |
|
242 Private slot to flash a MicroPython firmware to the device. |
|
243 </p> |
|
244 <a NAME="EspDevice.__installEspTool" ID="EspDevice.__installEspTool"></a> |
|
245 <h4>EspDevice.__installEspTool</h4> |
|
246 <b>__installEspTool</b>(<i></i>) |
|
247 |
|
248 <p> |
|
249 Private slot to install the esptool package via pip. |
|
250 </p> |
|
251 <a NAME="EspDevice.__resetDevice" ID="EspDevice.__resetDevice"></a> |
|
252 <h4>EspDevice.__resetDevice</h4> |
|
253 <b>__resetDevice</b>(<i></i>) |
|
254 |
|
255 <p> |
|
256 Private slot to reset the connected device. |
|
257 </p> |
|
258 <a NAME="EspDevice.__restoreFlash" ID="EspDevice.__restoreFlash"></a> |
|
259 <h4>EspDevice.__restoreFlash</h4> |
|
260 <b>__restoreFlash</b>(<i></i>) |
|
261 |
|
262 <p> |
|
263 Private slot to restore a previously saved firmware. |
|
264 </p> |
|
265 <a NAME="EspDevice.__showChipID" ID="EspDevice.__showChipID"></a> |
|
266 <h4>EspDevice.__showChipID</h4> |
|
267 <b>__showChipID</b>(<i></i>) |
|
268 |
|
269 <p> |
|
270 Private slot to show the ID of the ESP chip. |
|
271 </p> |
|
272 <a NAME="EspDevice.__showFirmwareVersions" ID="EspDevice.__showFirmwareVersions"></a> |
|
273 <h4>EspDevice.__showFirmwareVersions</h4> |
|
274 <b>__showFirmwareVersions</b>(<i></i>) |
|
275 |
|
276 <p> |
|
277 Private slot to show the firmware version of the connected device and the |
|
278 available firmware version. |
|
279 </p> |
|
280 <a NAME="EspDevice.__showFlashID" ID="EspDevice.__showFlashID"></a> |
|
281 <h4>EspDevice.__showFlashID</h4> |
|
282 <b>__showFlashID</b>(<i></i>) |
|
283 |
|
284 <p> |
|
285 Private slot to show the ID of the ESP flash chip. |
|
286 </p> |
|
287 <a NAME="EspDevice.__showMACAddress" ID="EspDevice.__showMACAddress"></a> |
|
288 <h4>EspDevice.__showMACAddress</h4> |
|
289 <b>__showMACAddress</b>(<i></i>) |
|
290 |
|
291 <p> |
|
292 Private slot to show the MAC address of the ESP chip. |
|
293 </p> |
|
294 <a NAME="EspDevice.addDeviceMenuEntries" ID="EspDevice.addDeviceMenuEntries"></a> |
|
295 <h4>EspDevice.addDeviceMenuEntries</h4> |
|
296 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
|
297 |
|
298 <p> |
|
299 Public method to add device specific entries to the given menu. |
|
300 </p> |
|
301 <dl> |
|
302 |
|
303 <dt><i>menu</i> (QMenu)</dt> |
|
304 <dd> |
|
305 reference to the context menu |
|
306 </dd> |
|
307 </dl> |
|
308 <a NAME="EspDevice.canRunScript" ID="EspDevice.canRunScript"></a> |
|
309 <h4>EspDevice.canRunScript</h4> |
|
310 <b>canRunScript</b>(<i></i>) |
|
311 |
|
312 <p> |
|
313 Public method to determine, if a script can be executed. |
|
314 </p> |
|
315 <dl> |
|
316 <dt>Return:</dt> |
|
317 <dd> |
|
318 tuple containing a flag indicating it is safe to start a |
|
319 Plotter and a reason why it cannot. |
|
320 </dd> |
|
321 </dl> |
|
322 <dl> |
|
323 <dt>Return Type:</dt> |
|
324 <dd> |
|
325 tuple of (bool, str) |
|
326 </dd> |
|
327 </dl> |
|
328 <a NAME="EspDevice.canStartFileManager" ID="EspDevice.canStartFileManager"></a> |
|
329 <h4>EspDevice.canStartFileManager</h4> |
|
330 <b>canStartFileManager</b>(<i></i>) |
|
331 |
|
332 <p> |
|
333 Public method to determine, if a File Manager can be started. |
|
334 </p> |
|
335 <dl> |
|
336 <dt>Return:</dt> |
|
337 <dd> |
|
338 tuple containing a flag indicating it is safe to start a |
|
339 File Manager and a reason why it cannot. |
|
340 </dd> |
|
341 </dl> |
|
342 <dl> |
|
343 <dt>Return Type:</dt> |
|
344 <dd> |
|
345 tuple of (bool, str) |
|
346 </dd> |
|
347 </dl> |
|
348 <a NAME="EspDevice.canStartPlotter" ID="EspDevice.canStartPlotter"></a> |
|
349 <h4>EspDevice.canStartPlotter</h4> |
|
350 <b>canStartPlotter</b>(<i></i>) |
|
351 |
|
352 <p> |
|
353 Public method to determine, if a Plotter can be started. |
|
354 </p> |
|
355 <dl> |
|
356 <dt>Return:</dt> |
|
357 <dd> |
|
358 tuple containing a flag indicating it is safe to start a |
|
359 Plotter and a reason why it cannot. |
|
360 </dd> |
|
361 </dl> |
|
362 <dl> |
|
363 <dt>Return Type:</dt> |
|
364 <dd> |
|
365 tuple of (bool, str) |
|
366 </dd> |
|
367 </dl> |
|
368 <a NAME="EspDevice.canStartRepl" ID="EspDevice.canStartRepl"></a> |
|
369 <h4>EspDevice.canStartRepl</h4> |
|
370 <b>canStartRepl</b>(<i></i>) |
|
371 |
|
372 <p> |
|
373 Public method to determine, if a REPL can be started. |
|
374 </p> |
|
375 <dl> |
|
376 <dt>Return:</dt> |
|
377 <dd> |
|
378 tuple containing a flag indicating it is safe to start a REPL |
|
379 and a reason why it cannot. |
|
380 </dd> |
|
381 </dl> |
|
382 <dl> |
|
383 <dt>Return Type:</dt> |
|
384 <dd> |
|
385 tuple of (bool, str) |
|
386 </dd> |
|
387 </dl> |
|
388 <a NAME="EspDevice.deviceName" ID="EspDevice.deviceName"></a> |
|
389 <h4>EspDevice.deviceName</h4> |
|
390 <b>deviceName</b>(<i></i>) |
|
391 |
|
392 <p> |
|
393 Public method to get the name of the device. |
|
394 </p> |
|
395 <dl> |
|
396 <dt>Return:</dt> |
|
397 <dd> |
|
398 name of the device |
|
399 </dd> |
|
400 </dl> |
|
401 <dl> |
|
402 <dt>Return Type:</dt> |
|
403 <dd> |
|
404 str |
|
405 </dd> |
|
406 </dl> |
|
407 <a NAME="EspDevice.forceInterrupt" ID="EspDevice.forceInterrupt"></a> |
|
408 <h4>EspDevice.forceInterrupt</h4> |
|
409 <b>forceInterrupt</b>(<i></i>) |
|
410 |
|
411 <p> |
|
412 Public method to determine the need for an interrupt when opening the |
|
413 serial connection. |
|
414 </p> |
|
415 <dl> |
|
416 <dt>Return:</dt> |
|
417 <dd> |
|
418 flag indicating an interrupt is needed |
|
419 </dd> |
|
420 </dl> |
|
421 <dl> |
|
422 <dt>Return Type:</dt> |
|
423 <dd> |
|
424 bool |
|
425 </dd> |
|
426 </dl> |
|
427 <a NAME="EspDevice.getDocumentationUrl" ID="EspDevice.getDocumentationUrl"></a> |
|
428 <h4>EspDevice.getDocumentationUrl</h4> |
|
429 <b>getDocumentationUrl</b>(<i></i>) |
|
430 |
|
431 <p> |
|
432 Public method to get the device documentation URL. |
|
433 </p> |
|
434 <dl> |
|
435 <dt>Return:</dt> |
|
436 <dd> |
|
437 documentation URL of the device |
|
438 </dd> |
|
439 </dl> |
|
440 <dl> |
|
441 <dt>Return Type:</dt> |
|
442 <dd> |
|
443 str |
|
444 </dd> |
|
445 </dl> |
|
446 <a NAME="EspDevice.getFirmwareUrl" ID="EspDevice.getFirmwareUrl"></a> |
|
447 <h4>EspDevice.getFirmwareUrl</h4> |
|
448 <b>getFirmwareUrl</b>(<i></i>) |
|
449 |
|
450 <p> |
|
451 Public method to get the device firmware download URL. |
|
452 </p> |
|
453 <dl> |
|
454 <dt>Return:</dt> |
|
455 <dd> |
|
456 firmware download URL of the device |
|
457 </dd> |
|
458 </dl> |
|
459 <dl> |
|
460 <dt>Return Type:</dt> |
|
461 <dd> |
|
462 str |
|
463 </dd> |
|
464 </dl> |
|
465 <a NAME="EspDevice.hasFlashMenuEntry" ID="EspDevice.hasFlashMenuEntry"></a> |
|
466 <h4>EspDevice.hasFlashMenuEntry</h4> |
|
467 <b>hasFlashMenuEntry</b>(<i></i>) |
|
468 |
|
469 <p> |
|
470 Public method to check, if the device has its own flash menu entry. |
|
471 </p> |
|
472 <dl> |
|
473 <dt>Return:</dt> |
|
474 <dd> |
|
475 flag indicating a specific flash menu entry |
|
476 </dd> |
|
477 </dl> |
|
478 <dl> |
|
479 <dt>Return Type:</dt> |
|
480 <dd> |
|
481 bool |
|
482 </dd> |
|
483 </dl> |
|
484 <a NAME="EspDevice.runScript" ID="EspDevice.runScript"></a> |
|
485 <h4>EspDevice.runScript</h4> |
|
486 <b>runScript</b>(<i>script</i>) |
|
487 |
|
488 <p> |
|
489 Public method to run the given Python script. |
|
490 </p> |
|
491 <dl> |
|
492 |
|
493 <dt><i>script</i> (str)</dt> |
|
494 <dd> |
|
495 script to be executed |
|
496 </dd> |
|
497 </dl> |
|
498 <a NAME="EspDevice.setButtons" ID="EspDevice.setButtons"></a> |
|
499 <h4>EspDevice.setButtons</h4> |
|
500 <b>setButtons</b>(<i></i>) |
|
501 |
|
502 <p> |
|
503 Public method to enable the supported action buttons. |
|
504 </p> |
|
505 <div align="right"><a href="#top">Up</a></div> |
|
506 <hr /> |
|
507 <hr /> |
|
508 <a NAME="createDevice" ID="createDevice"></a> |
|
509 <h2>createDevice</h2> |
|
510 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>) |
|
511 |
|
512 <p> |
|
513 Function to instantiate a MicroPython device object. |
|
514 </p> |
|
515 <dl> |
|
516 |
|
517 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
518 <dd> |
|
519 reference to the main MicroPython widget |
|
520 </dd> |
|
521 <dt><i>deviceType</i> (str)</dt> |
|
522 <dd> |
|
523 device type assigned to this device interface |
|
524 </dd> |
|
525 <dt><i>vid</i> (int)</dt> |
|
526 <dd> |
|
527 vendor ID |
|
528 </dd> |
|
529 <dt><i>pid</i> (int)</dt> |
|
530 <dd> |
|
531 product ID |
|
532 </dd> |
|
533 <dt><i>boardName</i> (str)</dt> |
|
534 <dd> |
|
535 name of the board |
|
536 </dd> |
|
537 <dt><i>serialNumber</i> (str)</dt> |
|
538 <dd> |
|
539 serial number of the board |
|
540 </dd> |
|
541 </dl> |
|
542 <dl> |
|
543 <dt>Return:</dt> |
|
544 <dd> |
|
545 reference to the instantiated device object |
|
546 </dd> |
|
547 </dl> |
|
548 <dl> |
|
549 <dt>Return Type:</dt> |
|
550 <dd> |
|
551 EspDevice |
|
552 </dd> |
|
553 </dl> |
|
554 <div align="right"><a href="#top">Up</a></div> |
|
555 <hr /> |
|
556 </body></html> |