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

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

eric ide

mercurial