5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.MicroPython.Devices.MicrobitDevices</h1> |
9 <h1>eric7.MicroPython.Devices.MicrobitDevices</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing the device interface class for BBC micro:bit and |
11 Module implementing the device interface class for BBC micro:bit and |
13 Calliope mini boards. |
12 Calliope mini boards. |
14 </p> |
13 </p> |
|
14 |
15 <h3>Global Attributes</h3> |
15 <h3>Global Attributes</h3> |
16 |
|
17 <table> |
16 <table> |
18 <tr><td>None</td></tr> |
17 <tr><td>None</td></tr> |
19 </table> |
18 </table> |
|
19 |
20 <h3>Classes</h3> |
20 <h3>Classes</h3> |
21 |
|
22 <table> |
21 <table> |
23 |
|
24 <tr> |
22 <tr> |
25 <td><a href="#MicrobitDevice">MicrobitDevice</a></td> |
23 <td><a href="#MicrobitDevice">MicrobitDevice</a></td> |
26 <td>Class implementing the device for BBC micro:bit and Calliope mini boards.</td> |
24 <td>Class implementing the device for BBC micro:bit and Calliope mini boards.</td> |
27 </tr> |
25 </tr> |
28 </table> |
26 </table> |
|
27 |
29 <h3>Functions</h3> |
28 <h3>Functions</h3> |
30 |
|
31 <table> |
29 <table> |
32 |
|
33 <tr> |
30 <tr> |
34 <td><a href="#createDevice">createDevice</a></td> |
31 <td><a href="#createDevice">createDevice</a></td> |
35 <td>Function to instantiate a MicroPython device object.</td> |
32 <td>Function to instantiate a MicroPython device object.</td> |
36 </tr> |
33 </tr> |
37 </table> |
34 </table> |
|
35 |
38 <hr /> |
36 <hr /> |
39 <hr /> |
37 <hr /> |
40 <a NAME="MicrobitDevice" ID="MicrobitDevice"></a> |
38 <a NAME="MicrobitDevice" ID="MicrobitDevice"></a> |
41 <h2>MicrobitDevice</h2> |
39 <h2>MicrobitDevice</h2> |
42 |
|
43 <p> |
40 <p> |
44 Class implementing the device for BBC micro:bit and Calliope mini boards. |
41 Class implementing the device for BBC micro:bit and Calliope mini boards. |
45 </p> |
42 </p> |
|
43 |
46 <h3>Derived from</h3> |
44 <h3>Derived from</h3> |
47 BaseDevice |
45 BaseDevice |
48 <h3>Class Attributes</h3> |
46 <h3>Class Attributes</h3> |
49 |
|
50 <table> |
47 <table> |
51 <tr><td>None</td></tr> |
48 <tr><td>None</td></tr> |
52 </table> |
49 </table> |
|
50 |
53 <h3>Class Methods</h3> |
51 <h3>Class Methods</h3> |
54 |
|
55 <table> |
52 <table> |
56 <tr><td>None</td></tr> |
53 <tr><td>None</td></tr> |
57 </table> |
54 </table> |
|
55 |
58 <h3>Methods</h3> |
56 <h3>Methods</h3> |
59 |
|
60 <table> |
57 <table> |
61 |
|
62 <tr> |
58 <tr> |
63 <td><a href="#MicrobitDevice.__init__">MicrobitDevice</a></td> |
59 <td><a href="#MicrobitDevice.__init__">MicrobitDevice</a></td> |
64 <td>Constructor</td> |
60 <td>Constructor</td> |
65 </tr> |
61 </tr> |
66 <tr> |
62 <tr> |
190 <tr> |
186 <tr> |
191 <td><a href="#MicrobitDevice.setConnected">setConnected</a></td> |
187 <td><a href="#MicrobitDevice.setConnected">setConnected</a></td> |
192 <td>Public method to set the connection state.</td> |
188 <td>Public method to set the connection state.</td> |
193 </tr> |
189 </tr> |
194 </table> |
190 </table> |
|
191 |
195 <h3>Static Methods</h3> |
192 <h3>Static Methods</h3> |
196 |
|
197 <table> |
193 <table> |
198 <tr><td>None</td></tr> |
194 <tr><td>None</td></tr> |
199 </table> |
195 </table> |
200 |
196 |
|
197 |
201 <a NAME="MicrobitDevice.__init__" ID="MicrobitDevice.__init__"></a> |
198 <a NAME="MicrobitDevice.__init__" ID="MicrobitDevice.__init__"></a> |
202 <h4>MicrobitDevice (Constructor)</h4> |
199 <h4>MicrobitDevice (Constructor)</h4> |
203 <b>MicrobitDevice</b>(<i>microPythonWidget, deviceType, serialNumber, parent=None</i>) |
200 <b>MicrobitDevice</b>(<i>microPythonWidget, deviceType, serialNumber, parent=None</i>) |
204 |
|
205 <p> |
201 <p> |
206 Constructor |
202 Constructor |
207 </p> |
203 </p> |
|
204 |
208 <dl> |
205 <dl> |
209 |
206 |
210 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
207 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
211 <dd> |
208 <dd> |
212 reference to the main MicroPython widget |
209 reference to the main MicroPython widget |
225 </dd> |
222 </dd> |
226 </dl> |
223 </dl> |
227 <a NAME="MicrobitDevice.__createMicrobitMenu" ID="MicrobitDevice.__createMicrobitMenu"></a> |
224 <a NAME="MicrobitDevice.__createMicrobitMenu" ID="MicrobitDevice.__createMicrobitMenu"></a> |
228 <h4>MicrobitDevice.__createMicrobitMenu</h4> |
225 <h4>MicrobitDevice.__createMicrobitMenu</h4> |
229 <b>__createMicrobitMenu</b>(<i></i>) |
226 <b>__createMicrobitMenu</b>(<i></i>) |
230 |
|
231 <p> |
227 <p> |
232 Private method to create the microbit submenu. |
228 Private method to create the microbit submenu. |
233 </p> |
229 </p> |
|
230 |
234 <a NAME="MicrobitDevice.__firmwareVersionResponse" ID="MicrobitDevice.__firmwareVersionResponse"></a> |
231 <a NAME="MicrobitDevice.__firmwareVersionResponse" ID="MicrobitDevice.__firmwareVersionResponse"></a> |
235 <h4>MicrobitDevice.__firmwareVersionResponse</h4> |
232 <h4>MicrobitDevice.__firmwareVersionResponse</h4> |
236 <b>__firmwareVersionResponse</b>(<i>reply</i>) |
233 <b>__firmwareVersionResponse</b>(<i>reply</i>) |
237 |
|
238 <p> |
234 <p> |
239 Private slot handling the response of the latest version request. |
235 Private slot handling the response of the latest version request. |
240 </p> |
236 </p> |
|
237 |
241 <dl> |
238 <dl> |
242 |
239 |
243 <dt><i>reply</i> (QNetworkReply)</dt> |
240 <dt><i>reply</i> (QNetworkReply)</dt> |
244 <dd> |
241 <dd> |
245 reference to the reply object |
242 reference to the reply object |
246 </dd> |
243 </dd> |
247 </dl> |
244 </dl> |
248 <a NAME="MicrobitDevice.__flashMicroPython" ID="MicrobitDevice.__flashMicroPython"></a> |
245 <a NAME="MicrobitDevice.__flashMicroPython" ID="MicrobitDevice.__flashMicroPython"></a> |
249 <h4>MicrobitDevice.__flashMicroPython</h4> |
246 <h4>MicrobitDevice.__flashMicroPython</h4> |
250 <b>__flashMicroPython</b>(<i>firmware=False</i>) |
247 <b>__flashMicroPython</b>(<i>firmware=False</i>) |
251 |
|
252 <p> |
248 <p> |
253 Private slot to flash MicroPython or the DAPLink firmware to the |
249 Private slot to flash MicroPython or the DAPLink firmware to the |
254 device. |
250 device. |
255 </p> |
251 </p> |
|
252 |
256 <dl> |
253 <dl> |
257 |
254 |
258 <dt><i>firmware</i> (bool)</dt> |
255 <dt><i>firmware</i> (bool)</dt> |
259 <dd> |
256 <dd> |
260 flag indicating to flash the DAPLink firmware |
257 flag indicating to flash the DAPLink firmware |
261 </dd> |
258 </dd> |
262 </dl> |
259 </dl> |
263 <a NAME="MicrobitDevice.__isCalliope" ID="MicrobitDevice.__isCalliope"></a> |
260 <a NAME="MicrobitDevice.__isCalliope" ID="MicrobitDevice.__isCalliope"></a> |
264 <h4>MicrobitDevice.__isCalliope</h4> |
261 <h4>MicrobitDevice.__isCalliope</h4> |
265 <b>__isCalliope</b>(<i></i>) |
262 <b>__isCalliope</b>(<i></i>) |
266 |
|
267 <p> |
263 <p> |
268 Private method to check, if the device is a Calliope mini. |
264 Private method to check, if the device is a Calliope mini. |
269 </p> |
265 </p> |
|
266 |
270 <dl> |
267 <dl> |
271 <dt>Return:</dt> |
268 <dt>Return:</dt> |
272 <dd> |
269 <dd> |
273 flag indicating a Calliope mini |
270 flag indicating a Calliope mini |
274 </dd> |
271 </dd> |
280 </dd> |
277 </dd> |
281 </dl> |
278 </dl> |
282 <a NAME="MicrobitDevice.__isMicroBitV1" ID="MicrobitDevice.__isMicroBitV1"></a> |
279 <a NAME="MicrobitDevice.__isMicroBitV1" ID="MicrobitDevice.__isMicroBitV1"></a> |
283 <h4>MicrobitDevice.__isMicroBitV1</h4> |
280 <h4>MicrobitDevice.__isMicroBitV1</h4> |
284 <b>__isMicroBitV1</b>(<i></i>) |
281 <b>__isMicroBitV1</b>(<i></i>) |
285 |
|
286 <p> |
282 <p> |
287 Private method to check, if the device is a BBC micro:bit v1. |
283 Private method to check, if the device is a BBC micro:bit v1. |
288 </p> |
284 </p> |
|
285 |
289 <dl> |
286 <dl> |
290 <dt>Return:</dt> |
287 <dt>Return:</dt> |
291 <dd> |
288 <dd> |
292 falg indicating a BBC micro:bit v1 |
289 falg indicating a BBC micro:bit v1 |
293 </dd> |
290 </dd> |
299 </dd> |
296 </dd> |
300 </dl> |
297 </dl> |
301 <a NAME="MicrobitDevice.__isMicroBitV2" ID="MicrobitDevice.__isMicroBitV2"></a> |
298 <a NAME="MicrobitDevice.__isMicroBitV2" ID="MicrobitDevice.__isMicroBitV2"></a> |
302 <h4>MicrobitDevice.__isMicroBitV2</h4> |
299 <h4>MicrobitDevice.__isMicroBitV2</h4> |
303 <b>__isMicroBitV2</b>(<i></i>) |
300 <b>__isMicroBitV2</b>(<i></i>) |
304 |
|
305 <p> |
301 <p> |
306 Private method to check, if the device is a BBC micro:bit v2. |
302 Private method to check, if the device is a BBC micro:bit v2. |
307 </p> |
303 </p> |
|
304 |
308 <dl> |
305 <dl> |
309 <dt>Return:</dt> |
306 <dt>Return:</dt> |
310 <dd> |
307 <dd> |
311 falg indicating a BBC micro:bit v2 |
308 falg indicating a BBC micro:bit v2 |
312 </dd> |
309 </dd> |
318 </dd> |
315 </dd> |
319 </dl> |
316 </dl> |
320 <a NAME="MicrobitDevice.__resetDevice" ID="MicrobitDevice.__resetDevice"></a> |
317 <a NAME="MicrobitDevice.__resetDevice" ID="MicrobitDevice.__resetDevice"></a> |
321 <h4>MicrobitDevice.__resetDevice</h4> |
318 <h4>MicrobitDevice.__resetDevice</h4> |
322 <b>__resetDevice</b>(<i></i>) |
319 <b>__resetDevice</b>(<i></i>) |
323 |
|
324 <p> |
320 <p> |
325 Private slot to reset the connected device. |
321 Private slot to reset the connected device. |
326 </p> |
322 </p> |
|
323 |
327 <a NAME="MicrobitDevice.__saveMain" ID="MicrobitDevice.__saveMain"></a> |
324 <a NAME="MicrobitDevice.__saveMain" ID="MicrobitDevice.__saveMain"></a> |
328 <h4>MicrobitDevice.__saveMain</h4> |
325 <h4>MicrobitDevice.__saveMain</h4> |
329 <b>__saveMain</b>(<i></i>) |
326 <b>__saveMain</b>(<i></i>) |
330 |
|
331 <p> |
327 <p> |
332 Private slot to copy the current script as 'main.py' onto the |
328 Private slot to copy the current script as 'main.py' onto the |
333 connected device. |
329 connected device. |
334 </p> |
330 </p> |
|
331 |
335 <a NAME="MicrobitDevice.__showFirmwareVersions" ID="MicrobitDevice.__showFirmwareVersions"></a> |
332 <a NAME="MicrobitDevice.__showFirmwareVersions" ID="MicrobitDevice.__showFirmwareVersions"></a> |
336 <h4>MicrobitDevice.__showFirmwareVersions</h4> |
333 <h4>MicrobitDevice.__showFirmwareVersions</h4> |
337 <b>__showFirmwareVersions</b>(<i></i>) |
334 <b>__showFirmwareVersions</b>(<i></i>) |
338 |
|
339 <p> |
335 <p> |
340 Private slot to show the firmware version of the connected device and the |
336 Private slot to show the firmware version of the connected device and the |
341 available firmware version. |
337 available firmware version. |
342 </p> |
338 </p> |
|
339 |
343 <a NAME="MicrobitDevice._getSetTimeCode" ID="MicrobitDevice._getSetTimeCode"></a> |
340 <a NAME="MicrobitDevice._getSetTimeCode" ID="MicrobitDevice._getSetTimeCode"></a> |
344 <h4>MicrobitDevice._getSetTimeCode</h4> |
341 <h4>MicrobitDevice._getSetTimeCode</h4> |
345 <b>_getSetTimeCode</b>(<i></i>) |
342 <b>_getSetTimeCode</b>(<i></i>) |
346 |
|
347 <p> |
343 <p> |
348 Protected method to get the device code to set the time. |
344 Protected method to get the device code to set the time. |
349 </p> |
345 </p> |
350 <p> |
346 <p> |
351 Note: This method must be implemented in the various device specific |
347 Note: This method must be implemented in the various device specific |
352 subclasses. |
348 subclasses. |
353 </p> |
349 </p> |
|
350 |
354 <dl> |
351 <dl> |
355 <dt>Return:</dt> |
352 <dt>Return:</dt> |
356 <dd> |
353 <dd> |
357 code to be executed on the connected device to set the time |
354 code to be executed on the connected device to set the time |
358 </dd> |
355 </dd> |
364 </dd> |
361 </dd> |
365 </dl> |
362 </dl> |
366 <a NAME="MicrobitDevice.activateBluetoothInterface" ID="MicrobitDevice.activateBluetoothInterface"></a> |
363 <a NAME="MicrobitDevice.activateBluetoothInterface" ID="MicrobitDevice.activateBluetoothInterface"></a> |
367 <h4>MicrobitDevice.activateBluetoothInterface</h4> |
364 <h4>MicrobitDevice.activateBluetoothInterface</h4> |
368 <b>activateBluetoothInterface</b>(<i></i>) |
365 <b>activateBluetoothInterface</b>(<i></i>) |
369 |
|
370 <p> |
366 <p> |
371 Public method to activate the Bluetooth interface. |
367 Public method to activate the Bluetooth interface. |
372 </p> |
368 </p> |
|
369 |
373 <dl> |
370 <dl> |
374 <dt>Return:</dt> |
371 <dt>Return:</dt> |
375 <dd> |
372 <dd> |
376 flag indicating the new state of the Bluetooth interface |
373 flag indicating the new state of the Bluetooth interface |
377 </dd> |
374 </dd> |
390 </dd> |
387 </dd> |
391 </dl> |
388 </dl> |
392 <a NAME="MicrobitDevice.addDeviceMenuEntries" ID="MicrobitDevice.addDeviceMenuEntries"></a> |
389 <a NAME="MicrobitDevice.addDeviceMenuEntries" ID="MicrobitDevice.addDeviceMenuEntries"></a> |
393 <h4>MicrobitDevice.addDeviceMenuEntries</h4> |
390 <h4>MicrobitDevice.addDeviceMenuEntries</h4> |
394 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
391 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
395 |
|
396 <p> |
392 <p> |
397 Public method to add device specific entries to the given menu. |
393 Public method to add device specific entries to the given menu. |
398 </p> |
394 </p> |
|
395 |
399 <dl> |
396 <dl> |
400 |
397 |
401 <dt><i>menu</i> (QMenu)</dt> |
398 <dt><i>menu</i> (QMenu)</dt> |
402 <dd> |
399 <dd> |
403 reference to the context menu |
400 reference to the context menu |
404 </dd> |
401 </dd> |
405 </dl> |
402 </dl> |
406 <a NAME="MicrobitDevice.canRunScript" ID="MicrobitDevice.canRunScript"></a> |
403 <a NAME="MicrobitDevice.canRunScript" ID="MicrobitDevice.canRunScript"></a> |
407 <h4>MicrobitDevice.canRunScript</h4> |
404 <h4>MicrobitDevice.canRunScript</h4> |
408 <b>canRunScript</b>(<i></i>) |
405 <b>canRunScript</b>(<i></i>) |
409 |
|
410 <p> |
406 <p> |
411 Public method to determine, if a script can be executed. |
407 Public method to determine, if a script can be executed. |
412 </p> |
408 </p> |
|
409 |
413 <dl> |
410 <dl> |
414 <dt>Return:</dt> |
411 <dt>Return:</dt> |
415 <dd> |
412 <dd> |
416 tuple containing a flag indicating it is safe to start a |
413 tuple containing a flag indicating it is safe to start a |
417 Plotter and a reason why it cannot. |
414 Plotter and a reason why it cannot. |
424 </dd> |
421 </dd> |
425 </dl> |
422 </dl> |
426 <a NAME="MicrobitDevice.canStartFileManager" ID="MicrobitDevice.canStartFileManager"></a> |
423 <a NAME="MicrobitDevice.canStartFileManager" ID="MicrobitDevice.canStartFileManager"></a> |
427 <h4>MicrobitDevice.canStartFileManager</h4> |
424 <h4>MicrobitDevice.canStartFileManager</h4> |
428 <b>canStartFileManager</b>(<i></i>) |
425 <b>canStartFileManager</b>(<i></i>) |
429 |
|
430 <p> |
426 <p> |
431 Public method to determine, if a File Manager can be started. |
427 Public method to determine, if a File Manager can be started. |
432 </p> |
428 </p> |
|
429 |
433 <dl> |
430 <dl> |
434 <dt>Return:</dt> |
431 <dt>Return:</dt> |
435 <dd> |
432 <dd> |
436 tuple containing a flag indicating it is safe to start a |
433 tuple containing a flag indicating it is safe to start a |
437 File Manager and a reason why it cannot. |
434 File Manager and a reason why it cannot. |
444 </dd> |
441 </dd> |
445 </dl> |
442 </dl> |
446 <a NAME="MicrobitDevice.canStartPlotter" ID="MicrobitDevice.canStartPlotter"></a> |
443 <a NAME="MicrobitDevice.canStartPlotter" ID="MicrobitDevice.canStartPlotter"></a> |
447 <h4>MicrobitDevice.canStartPlotter</h4> |
444 <h4>MicrobitDevice.canStartPlotter</h4> |
448 <b>canStartPlotter</b>(<i></i>) |
445 <b>canStartPlotter</b>(<i></i>) |
449 |
|
450 <p> |
446 <p> |
451 Public method to determine, if a Plotter can be started. |
447 Public method to determine, if a Plotter can be started. |
452 </p> |
448 </p> |
|
449 |
453 <dl> |
450 <dl> |
454 <dt>Return:</dt> |
451 <dt>Return:</dt> |
455 <dd> |
452 <dd> |
456 tuple containing a flag indicating it is safe to start a |
453 tuple containing a flag indicating it is safe to start a |
457 Plotter and a reason why it cannot. |
454 Plotter and a reason why it cannot. |
464 </dd> |
461 </dd> |
465 </dl> |
462 </dl> |
466 <a NAME="MicrobitDevice.canStartRepl" ID="MicrobitDevice.canStartRepl"></a> |
463 <a NAME="MicrobitDevice.canStartRepl" ID="MicrobitDevice.canStartRepl"></a> |
467 <h4>MicrobitDevice.canStartRepl</h4> |
464 <h4>MicrobitDevice.canStartRepl</h4> |
468 <b>canStartRepl</b>(<i></i>) |
465 <b>canStartRepl</b>(<i></i>) |
469 |
|
470 <p> |
466 <p> |
471 Public method to determine, if a REPL can be started. |
467 Public method to determine, if a REPL can be started. |
472 </p> |
468 </p> |
|
469 |
473 <dl> |
470 <dl> |
474 <dt>Return:</dt> |
471 <dt>Return:</dt> |
475 <dd> |
472 <dd> |
476 tuple containing a flag indicating it is safe to start a REPL |
473 tuple containing a flag indicating it is safe to start a REPL |
477 and a reason why it cannot. |
474 and a reason why it cannot. |
484 </dd> |
481 </dd> |
485 </dl> |
482 </dl> |
486 <a NAME="MicrobitDevice.deactivateBluetoothInterface" ID="MicrobitDevice.deactivateBluetoothInterface"></a> |
483 <a NAME="MicrobitDevice.deactivateBluetoothInterface" ID="MicrobitDevice.deactivateBluetoothInterface"></a> |
487 <h4>MicrobitDevice.deactivateBluetoothInterface</h4> |
484 <h4>MicrobitDevice.deactivateBluetoothInterface</h4> |
488 <b>deactivateBluetoothInterface</b>(<i></i>) |
485 <b>deactivateBluetoothInterface</b>(<i></i>) |
489 |
|
490 <p> |
486 <p> |
491 Public method to deactivate the Bluetooth interface. |
487 Public method to deactivate the Bluetooth interface. |
492 </p> |
488 </p> |
|
489 |
493 <dl> |
490 <dl> |
494 <dt>Return:</dt> |
491 <dt>Return:</dt> |
495 <dd> |
492 <dd> |
496 flag indicating the new state of the Bluetooth interface |
493 flag indicating the new state of the Bluetooth interface |
497 </dd> |
494 </dd> |
529 </dd> |
526 </dd> |
530 </dl> |
527 </dl> |
531 <a NAME="MicrobitDevice.forceInterrupt" ID="MicrobitDevice.forceInterrupt"></a> |
528 <a NAME="MicrobitDevice.forceInterrupt" ID="MicrobitDevice.forceInterrupt"></a> |
532 <h4>MicrobitDevice.forceInterrupt</h4> |
529 <h4>MicrobitDevice.forceInterrupt</h4> |
533 <b>forceInterrupt</b>(<i></i>) |
530 <b>forceInterrupt</b>(<i></i>) |
534 |
|
535 <p> |
531 <p> |
536 Public method to determine the need for an interrupt when opening the |
532 Public method to determine the need for an interrupt when opening the |
537 serial connection. |
533 serial connection. |
538 </p> |
534 </p> |
|
535 |
539 <dl> |
536 <dl> |
540 <dt>Return:</dt> |
537 <dt>Return:</dt> |
541 <dd> |
538 <dd> |
542 flag indicating an interrupt is needed |
539 flag indicating an interrupt is needed |
543 </dd> |
540 </dd> |
549 </dd> |
546 </dd> |
550 </dl> |
547 </dl> |
551 <a NAME="MicrobitDevice.getBluetoothStatus" ID="MicrobitDevice.getBluetoothStatus"></a> |
548 <a NAME="MicrobitDevice.getBluetoothStatus" ID="MicrobitDevice.getBluetoothStatus"></a> |
552 <h4>MicrobitDevice.getBluetoothStatus</h4> |
549 <h4>MicrobitDevice.getBluetoothStatus</h4> |
553 <b>getBluetoothStatus</b>(<i></i>) |
550 <b>getBluetoothStatus</b>(<i></i>) |
554 |
|
555 <p> |
551 <p> |
556 Public method to get Bluetooth status data of the connected board. |
552 Public method to get Bluetooth status data of the connected board. |
557 </p> |
553 </p> |
|
554 |
558 <dl> |
555 <dl> |
559 <dt>Return:</dt> |
556 <dt>Return:</dt> |
560 <dd> |
557 <dd> |
561 list of tuples containing the translated status data label and |
558 list of tuples containing the translated status data label and |
562 the associated value |
559 the associated value |
576 </dd> |
573 </dd> |
577 </dl> |
574 </dl> |
578 <a NAME="MicrobitDevice.getDeviceScan" ID="MicrobitDevice.getDeviceScan"></a> |
575 <a NAME="MicrobitDevice.getDeviceScan" ID="MicrobitDevice.getDeviceScan"></a> |
579 <h4>MicrobitDevice.getDeviceScan</h4> |
576 <h4>MicrobitDevice.getDeviceScan</h4> |
580 <b>getDeviceScan</b>(<i>timeout=10</i>) |
577 <b>getDeviceScan</b>(<i>timeout=10</i>) |
581 |
|
582 <p> |
578 <p> |
583 Public method to perform a Bluetooth device scan. |
579 Public method to perform a Bluetooth device scan. |
584 </p> |
580 </p> |
|
581 |
585 <dl> |
582 <dl> |
586 |
583 |
587 <dt><i>timeout</i> (int (optional))</dt> |
584 <dt><i>timeout</i> (int (optional))</dt> |
588 <dd> |
585 <dd> |
589 duration of the device scan in seconds (defaults |
586 duration of the device scan in seconds (defaults |
604 </dd> |
601 </dd> |
605 </dl> |
602 </dl> |
606 <a NAME="MicrobitDevice.getDocumentationUrl" ID="MicrobitDevice.getDocumentationUrl"></a> |
603 <a NAME="MicrobitDevice.getDocumentationUrl" ID="MicrobitDevice.getDocumentationUrl"></a> |
607 <h4>MicrobitDevice.getDocumentationUrl</h4> |
604 <h4>MicrobitDevice.getDocumentationUrl</h4> |
608 <b>getDocumentationUrl</b>(<i></i>) |
605 <b>getDocumentationUrl</b>(<i></i>) |
609 |
|
610 <p> |
606 <p> |
611 Public method to get the device documentation URL. |
607 Public method to get the device documentation URL. |
612 </p> |
608 </p> |
|
609 |
613 <dl> |
610 <dl> |
614 <dt>Return:</dt> |
611 <dt>Return:</dt> |
615 <dd> |
612 <dd> |
616 documentation URL of the device |
613 documentation URL of the device |
617 </dd> |
614 </dd> |
623 </dd> |
620 </dd> |
624 </dl> |
621 </dl> |
625 <a NAME="MicrobitDevice.getDownloadMenuEntries" ID="MicrobitDevice.getDownloadMenuEntries"></a> |
622 <a NAME="MicrobitDevice.getDownloadMenuEntries" ID="MicrobitDevice.getDownloadMenuEntries"></a> |
626 <h4>MicrobitDevice.getDownloadMenuEntries</h4> |
623 <h4>MicrobitDevice.getDownloadMenuEntries</h4> |
627 <b>getDownloadMenuEntries</b>(<i></i>) |
624 <b>getDownloadMenuEntries</b>(<i></i>) |
628 |
|
629 <p> |
625 <p> |
630 Public method to retrieve the entries for the downloads menu. |
626 Public method to retrieve the entries for the downloads menu. |
631 </p> |
627 </p> |
|
628 |
632 <dl> |
629 <dl> |
633 <dt>Return:</dt> |
630 <dt>Return:</dt> |
634 <dd> |
631 <dd> |
635 list of tuples with menu text and URL to be opened for each |
632 list of tuples with menu text and URL to be opened for each |
636 entry |
633 entry |
643 </dd> |
640 </dd> |
644 </dl> |
641 </dl> |
645 <a NAME="MicrobitDevice.hasBluetooth" ID="MicrobitDevice.hasBluetooth"></a> |
642 <a NAME="MicrobitDevice.hasBluetooth" ID="MicrobitDevice.hasBluetooth"></a> |
646 <h4>MicrobitDevice.hasBluetooth</h4> |
643 <h4>MicrobitDevice.hasBluetooth</h4> |
647 <b>hasBluetooth</b>(<i></i>) |
644 <b>hasBluetooth</b>(<i></i>) |
648 |
|
649 <p> |
645 <p> |
650 Public method to check the availability of Bluetooth. |
646 Public method to check the availability of Bluetooth. |
651 </p> |
647 </p> |
|
648 |
652 <dl> |
649 <dl> |
653 <dt>Return:</dt> |
650 <dt>Return:</dt> |
654 <dd> |
651 <dd> |
655 flag indicating the availability of Bluetooth |
652 flag indicating the availability of Bluetooth |
656 </dd> |
653 </dd> |
669 </dd> |
666 </dd> |
670 </dl> |
667 </dl> |
671 <a NAME="MicrobitDevice.hasFlashMenuEntry" ID="MicrobitDevice.hasFlashMenuEntry"></a> |
668 <a NAME="MicrobitDevice.hasFlashMenuEntry" ID="MicrobitDevice.hasFlashMenuEntry"></a> |
672 <h4>MicrobitDevice.hasFlashMenuEntry</h4> |
669 <h4>MicrobitDevice.hasFlashMenuEntry</h4> |
673 <b>hasFlashMenuEntry</b>(<i></i>) |
670 <b>hasFlashMenuEntry</b>(<i></i>) |
674 |
|
675 <p> |
671 <p> |
676 Public method to check, if the device has its own flash menu entry. |
672 Public method to check, if the device has its own flash menu entry. |
677 </p> |
673 </p> |
|
674 |
678 <dl> |
675 <dl> |
679 <dt>Return:</dt> |
676 <dt>Return:</dt> |
680 <dd> |
677 <dd> |
681 flag indicating a specific flash menu entry |
678 flag indicating a specific flash menu entry |
682 </dd> |
679 </dd> |
688 </dd> |
685 </dd> |
689 </dl> |
686 </dl> |
690 <a NAME="MicrobitDevice.hasTimeCommands" ID="MicrobitDevice.hasTimeCommands"></a> |
687 <a NAME="MicrobitDevice.hasTimeCommands" ID="MicrobitDevice.hasTimeCommands"></a> |
691 <h4>MicrobitDevice.hasTimeCommands</h4> |
688 <h4>MicrobitDevice.hasTimeCommands</h4> |
692 <b>hasTimeCommands</b>(<i></i>) |
689 <b>hasTimeCommands</b>(<i></i>) |
693 |
|
694 <p> |
690 <p> |
695 Public method to check, if the device supports time commands. |
691 Public method to check, if the device supports time commands. |
696 </p> |
692 </p> |
697 <p> |
693 <p> |
698 The default returns True. |
694 The default returns True. |
699 </p> |
695 </p> |
|
696 |
700 <dl> |
697 <dl> |
701 <dt>Return:</dt> |
698 <dt>Return:</dt> |
702 <dd> |
699 <dd> |
703 flag indicating support for time commands |
700 flag indicating support for time commands |
704 </dd> |
701 </dd> |
710 </dd> |
707 </dd> |
711 </dl> |
708 </dl> |
712 <a NAME="MicrobitDevice.lls" ID="MicrobitDevice.lls"></a> |
709 <a NAME="MicrobitDevice.lls" ID="MicrobitDevice.lls"></a> |
713 <h4>MicrobitDevice.lls</h4> |
710 <h4>MicrobitDevice.lls</h4> |
714 <b>lls</b>(<i>dirname="", fullstat=False, showHidden=False</i>) |
711 <b>lls</b>(<i>dirname="", fullstat=False, showHidden=False</i>) |
715 |
|
716 <p> |
712 <p> |
717 Public method to get a long directory listing of the connected device |
713 Public method to get a long directory listing of the connected device |
718 including meta data. |
714 including meta data. |
719 </p> |
715 </p> |
|
716 |
720 <dl> |
717 <dl> |
721 |
718 |
722 <dt><i>dirname</i> (str)</dt> |
719 <dt><i>dirname</i> (str)</dt> |
723 <dd> |
720 <dd> |
724 name of the directory to be listed |
721 name of the directory to be listed |
755 </dd> |
752 </dd> |
756 </dl> |
753 </dl> |
757 <a NAME="MicrobitDevice.ls" ID="MicrobitDevice.ls"></a> |
754 <a NAME="MicrobitDevice.ls" ID="MicrobitDevice.ls"></a> |
758 <h4>MicrobitDevice.ls</h4> |
755 <h4>MicrobitDevice.ls</h4> |
759 <b>ls</b>(<i>dirname=""</i>) |
756 <b>ls</b>(<i>dirname=""</i>) |
760 |
|
761 <p> |
757 <p> |
762 Public method to get a directory listing of the connected device. |
758 Public method to get a directory listing of the connected device. |
763 </p> |
759 </p> |
|
760 |
764 <dl> |
761 <dl> |
765 |
762 |
766 <dt><i>dirname</i> (str)</dt> |
763 <dt><i>dirname</i> (str)</dt> |
767 <dd> |
764 <dd> |
768 name of the directory to be listed |
765 name of the directory to be listed |
807 </dd> |
804 </dd> |
808 </dl> |
805 </dl> |
809 <a NAME="MicrobitDevice.runScript" ID="MicrobitDevice.runScript"></a> |
806 <a NAME="MicrobitDevice.runScript" ID="MicrobitDevice.runScript"></a> |
810 <h4>MicrobitDevice.runScript</h4> |
807 <h4>MicrobitDevice.runScript</h4> |
811 <b>runScript</b>(<i>script</i>) |
808 <b>runScript</b>(<i>script</i>) |
812 |
|
813 <p> |
809 <p> |
814 Public method to run the given Python script. |
810 Public method to run the given Python script. |
815 </p> |
811 </p> |
|
812 |
816 <dl> |
813 <dl> |
817 |
814 |
818 <dt><i>script</i> (str)</dt> |
815 <dt><i>script</i> (str)</dt> |
819 <dd> |
816 <dd> |
820 script to be executed |
817 script to be executed |
821 </dd> |
818 </dd> |
822 </dl> |
819 </dl> |
823 <a NAME="MicrobitDevice.setButtons" ID="MicrobitDevice.setButtons"></a> |
820 <a NAME="MicrobitDevice.setButtons" ID="MicrobitDevice.setButtons"></a> |
824 <h4>MicrobitDevice.setButtons</h4> |
821 <h4>MicrobitDevice.setButtons</h4> |
825 <b>setButtons</b>(<i></i>) |
822 <b>setButtons</b>(<i></i>) |
826 |
|
827 <p> |
823 <p> |
828 Public method to enable the supported action buttons. |
824 Public method to enable the supported action buttons. |
829 </p> |
825 </p> |
|
826 |
830 <a NAME="MicrobitDevice.setConnected" ID="MicrobitDevice.setConnected"></a> |
827 <a NAME="MicrobitDevice.setConnected" ID="MicrobitDevice.setConnected"></a> |
831 <h4>MicrobitDevice.setConnected</h4> |
828 <h4>MicrobitDevice.setConnected</h4> |
832 <b>setConnected</b>(<i>connected</i>) |
829 <b>setConnected</b>(<i>connected</i>) |
833 |
|
834 <p> |
830 <p> |
835 Public method to set the connection state. |
831 Public method to set the connection state. |
836 </p> |
832 </p> |
837 <p> |
833 <p> |
838 Note: This method can be overwritten to perform actions upon connect |
834 Note: This method can be overwritten to perform actions upon connect |
839 or disconnect of the device. |
835 or disconnect of the device. |
840 </p> |
836 </p> |
|
837 |
841 <dl> |
838 <dl> |
842 |
839 |
843 <dt><i>connected</i> (bool)</dt> |
840 <dt><i>connected</i> (bool)</dt> |
844 <dd> |
841 <dd> |
845 connection state |
842 connection state |
849 <hr /> |
846 <hr /> |
850 <hr /> |
847 <hr /> |
851 <a NAME="createDevice" ID="createDevice"></a> |
848 <a NAME="createDevice" ID="createDevice"></a> |
852 <h2>createDevice</h2> |
849 <h2>createDevice</h2> |
853 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>) |
850 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>) |
854 |
|
855 <p> |
851 <p> |
856 Function to instantiate a MicroPython device object. |
852 Function to instantiate a MicroPython device object. |
857 </p> |
853 </p> |
|
854 |
858 <dl> |
855 <dl> |
859 |
856 |
860 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
857 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
861 <dd> |
858 <dd> |
862 reference to the main MicroPython widget |
859 reference to the main MicroPython widget |