|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.MicroPython.Devices.TeensyDevices</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.TeensyDevices</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the device interface class for Teensy boards with MicroPython. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#TeensyDevice">TeensyDevice</a></td> |
|
25 <td>Class implementing the device for Teensy boards with MicroPython.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 |
|
32 <tr> |
|
33 <td><a href="#createDevice">createDevice</a></td> |
|
34 <td>Function to instantiate a MicroPython device object.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <hr /> |
|
38 <hr /> |
|
39 <a NAME="TeensyDevice" ID="TeensyDevice"></a> |
|
40 <h2>TeensyDevice</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing the device for Teensy boards with MicroPython. |
|
44 </p> |
|
45 <h3>Derived from</h3> |
|
46 BaseDevice |
|
47 <h3>Class Attributes</h3> |
|
48 |
|
49 <table> |
|
50 <tr><td>None</td></tr> |
|
51 </table> |
|
52 <h3>Class Methods</h3> |
|
53 |
|
54 <table> |
|
55 <tr><td>None</td></tr> |
|
56 </table> |
|
57 <h3>Methods</h3> |
|
58 |
|
59 <table> |
|
60 |
|
61 <tr> |
|
62 <td><a href="#TeensyDevice.__init__">TeensyDevice</a></td> |
|
63 <td>Constructor</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#TeensyDevice.__createTeensyMenu">__createTeensyMenu</a></td> |
|
67 <td>Private method to create the microbit submenu.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#TeensyDevice.__firmwareVersionResponse">__firmwareVersionResponse</a></td> |
|
71 <td>Private method handling the response of the latest version request.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#TeensyDevice.__showFirmwareVersions">__showFirmwareVersions</a></td> |
|
75 <td>Private slot to show the firmware version of the connected device and the available firmware version.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#TeensyDevice.__showFlashInstructions">__showFlashInstructions</a></td> |
|
79 <td>Private method to show a message box with instruction to flash the Teensy.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#TeensyDevice.__startTeensyLoader">__startTeensyLoader</a></td> |
|
83 <td>Private method to start the 'Teensy Loader' application.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#TeensyDevice.addDeviceMenuEntries">addDeviceMenuEntries</a></td> |
|
87 <td>Public method to add device specific entries to the given menu.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#TeensyDevice.canRunScript">canRunScript</a></td> |
|
91 <td>Public method to determine, if a script can be executed.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#TeensyDevice.canStartFileManager">canStartFileManager</a></td> |
|
95 <td>Public method to determine, if a File Manager can be started.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#TeensyDevice.canStartPlotter">canStartPlotter</a></td> |
|
99 <td>Public method to determine, if a Plotter can be started.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#TeensyDevice.canStartRepl">canStartRepl</a></td> |
|
103 <td>Public method to determine, if a REPL can be started.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#TeensyDevice.deviceName">deviceName</a></td> |
|
107 <td>Public method to get the name of the device.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#TeensyDevice.forceInterrupt">forceInterrupt</a></td> |
|
111 <td>Public method to determine the need for an interrupt when opening the serial connection.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#TeensyDevice.getDocumentationUrl">getDocumentationUrl</a></td> |
|
115 <td>Public method to get the device documentation URL.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#TeensyDevice.getFirmwareUrl">getFirmwareUrl</a></td> |
|
119 <td>Public method to get the device firmware download URL.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#TeensyDevice.runScript">runScript</a></td> |
|
123 <td>Public method to run the given Python script.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#TeensyDevice.setButtons">setButtons</a></td> |
|
127 <td>Public method to enable the supported action buttons.</td> |
|
128 </tr> |
|
129 </table> |
|
130 <h3>Static Methods</h3> |
|
131 |
|
132 <table> |
|
133 <tr><td>None</td></tr> |
|
134 </table> |
|
135 |
|
136 <a NAME="TeensyDevice.__init__" ID="TeensyDevice.__init__"></a> |
|
137 <h4>TeensyDevice (Constructor)</h4> |
|
138 <b>TeensyDevice</b>(<i>microPythonWidget, deviceType, parent=None</i>) |
|
139 |
|
140 <p> |
|
141 Constructor |
|
142 </p> |
|
143 <dl> |
|
144 |
|
145 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
146 <dd> |
|
147 reference to the main MicroPython widget |
|
148 </dd> |
|
149 <dt><i>deviceType</i> (str)</dt> |
|
150 <dd> |
|
151 device type assigned to this device interface |
|
152 </dd> |
|
153 <dt><i>parent</i> (QObject)</dt> |
|
154 <dd> |
|
155 reference to the parent object |
|
156 </dd> |
|
157 </dl> |
|
158 <a NAME="TeensyDevice.__createTeensyMenu" ID="TeensyDevice.__createTeensyMenu"></a> |
|
159 <h4>TeensyDevice.__createTeensyMenu</h4> |
|
160 <b>__createTeensyMenu</b>(<i></i>) |
|
161 |
|
162 <p> |
|
163 Private method to create the microbit submenu. |
|
164 </p> |
|
165 <a NAME="TeensyDevice.__firmwareVersionResponse" ID="TeensyDevice.__firmwareVersionResponse"></a> |
|
166 <h4>TeensyDevice.__firmwareVersionResponse</h4> |
|
167 <b>__firmwareVersionResponse</b>(<i>reply</i>) |
|
168 |
|
169 <p> |
|
170 Private method handling the response of the latest version request. |
|
171 </p> |
|
172 <dl> |
|
173 |
|
174 <dt><i>reply</i> (QNetworkReply)</dt> |
|
175 <dd> |
|
176 reference to the reply object |
|
177 </dd> |
|
178 </dl> |
|
179 <a NAME="TeensyDevice.__showFirmwareVersions" ID="TeensyDevice.__showFirmwareVersions"></a> |
|
180 <h4>TeensyDevice.__showFirmwareVersions</h4> |
|
181 <b>__showFirmwareVersions</b>(<i></i>) |
|
182 |
|
183 <p> |
|
184 Private slot to show the firmware version of the connected device and the |
|
185 available firmware version. |
|
186 </p> |
|
187 <a NAME="TeensyDevice.__showFlashInstructions" ID="TeensyDevice.__showFlashInstructions"></a> |
|
188 <h4>TeensyDevice.__showFlashInstructions</h4> |
|
189 <b>__showFlashInstructions</b>(<i></i>) |
|
190 |
|
191 <p> |
|
192 Private method to show a message box with instruction to flash the Teensy. |
|
193 </p> |
|
194 <a NAME="TeensyDevice.__startTeensyLoader" ID="TeensyDevice.__startTeensyLoader"></a> |
|
195 <h4>TeensyDevice.__startTeensyLoader</h4> |
|
196 <b>__startTeensyLoader</b>(<i></i>) |
|
197 |
|
198 <p> |
|
199 Private method to start the 'Teensy Loader' application. |
|
200 </p> |
|
201 <p> |
|
202 Note: The application must be accessible via the application search path. |
|
203 </p> |
|
204 <a NAME="TeensyDevice.addDeviceMenuEntries" ID="TeensyDevice.addDeviceMenuEntries"></a> |
|
205 <h4>TeensyDevice.addDeviceMenuEntries</h4> |
|
206 <b>addDeviceMenuEntries</b>(<i>menu</i>) |
|
207 |
|
208 <p> |
|
209 Public method to add device specific entries to the given menu. |
|
210 </p> |
|
211 <dl> |
|
212 |
|
213 <dt><i>menu</i> (QMenu)</dt> |
|
214 <dd> |
|
215 reference to the context menu |
|
216 </dd> |
|
217 </dl> |
|
218 <a NAME="TeensyDevice.canRunScript" ID="TeensyDevice.canRunScript"></a> |
|
219 <h4>TeensyDevice.canRunScript</h4> |
|
220 <b>canRunScript</b>(<i></i>) |
|
221 |
|
222 <p> |
|
223 Public method to determine, if a script can be executed. |
|
224 </p> |
|
225 <dl> |
|
226 <dt>Return:</dt> |
|
227 <dd> |
|
228 tuple containing a flag indicating it is safe to start a |
|
229 Plotter and a reason why it cannot. |
|
230 </dd> |
|
231 </dl> |
|
232 <dl> |
|
233 <dt>Return Type:</dt> |
|
234 <dd> |
|
235 tuple of (bool, str) |
|
236 </dd> |
|
237 </dl> |
|
238 <a NAME="TeensyDevice.canStartFileManager" ID="TeensyDevice.canStartFileManager"></a> |
|
239 <h4>TeensyDevice.canStartFileManager</h4> |
|
240 <b>canStartFileManager</b>(<i></i>) |
|
241 |
|
242 <p> |
|
243 Public method to determine, if a File Manager can be started. |
|
244 </p> |
|
245 <dl> |
|
246 <dt>Return:</dt> |
|
247 <dd> |
|
248 tuple containing a flag indicating it is safe to start a |
|
249 File Manager and a reason why it cannot. |
|
250 </dd> |
|
251 </dl> |
|
252 <dl> |
|
253 <dt>Return Type:</dt> |
|
254 <dd> |
|
255 tuple of (bool, str) |
|
256 </dd> |
|
257 </dl> |
|
258 <a NAME="TeensyDevice.canStartPlotter" ID="TeensyDevice.canStartPlotter"></a> |
|
259 <h4>TeensyDevice.canStartPlotter</h4> |
|
260 <b>canStartPlotter</b>(<i></i>) |
|
261 |
|
262 <p> |
|
263 Public method to determine, if a Plotter can be started. |
|
264 </p> |
|
265 <dl> |
|
266 <dt>Return:</dt> |
|
267 <dd> |
|
268 tuple containing a flag indicating it is safe to start a |
|
269 Plotter and a reason why it cannot. |
|
270 </dd> |
|
271 </dl> |
|
272 <dl> |
|
273 <dt>Return Type:</dt> |
|
274 <dd> |
|
275 tuple of (bool, str) |
|
276 </dd> |
|
277 </dl> |
|
278 <a NAME="TeensyDevice.canStartRepl" ID="TeensyDevice.canStartRepl"></a> |
|
279 <h4>TeensyDevice.canStartRepl</h4> |
|
280 <b>canStartRepl</b>(<i></i>) |
|
281 |
|
282 <p> |
|
283 Public method to determine, if a REPL can be started. |
|
284 </p> |
|
285 <dl> |
|
286 <dt>Return:</dt> |
|
287 <dd> |
|
288 tuple containing a flag indicating it is safe to start a REPL |
|
289 and a reason why it cannot. |
|
290 </dd> |
|
291 </dl> |
|
292 <dl> |
|
293 <dt>Return Type:</dt> |
|
294 <dd> |
|
295 tuple of (bool, str) |
|
296 </dd> |
|
297 </dl> |
|
298 <a NAME="TeensyDevice.deviceName" ID="TeensyDevice.deviceName"></a> |
|
299 <h4>TeensyDevice.deviceName</h4> |
|
300 <b>deviceName</b>(<i></i>) |
|
301 |
|
302 <p> |
|
303 Public method to get the name of the device. |
|
304 </p> |
|
305 <dl> |
|
306 <dt>Return:</dt> |
|
307 <dd> |
|
308 name of the device |
|
309 </dd> |
|
310 </dl> |
|
311 <dl> |
|
312 <dt>Return Type:</dt> |
|
313 <dd> |
|
314 str |
|
315 </dd> |
|
316 </dl> |
|
317 <a NAME="TeensyDevice.forceInterrupt" ID="TeensyDevice.forceInterrupt"></a> |
|
318 <h4>TeensyDevice.forceInterrupt</h4> |
|
319 <b>forceInterrupt</b>(<i></i>) |
|
320 |
|
321 <p> |
|
322 Public method to determine the need for an interrupt when opening the |
|
323 serial connection. |
|
324 </p> |
|
325 <dl> |
|
326 <dt>Return:</dt> |
|
327 <dd> |
|
328 flag indicating an interrupt is needed |
|
329 </dd> |
|
330 </dl> |
|
331 <dl> |
|
332 <dt>Return Type:</dt> |
|
333 <dd> |
|
334 bool |
|
335 </dd> |
|
336 </dl> |
|
337 <a NAME="TeensyDevice.getDocumentationUrl" ID="TeensyDevice.getDocumentationUrl"></a> |
|
338 <h4>TeensyDevice.getDocumentationUrl</h4> |
|
339 <b>getDocumentationUrl</b>(<i></i>) |
|
340 |
|
341 <p> |
|
342 Public method to get the device documentation URL. |
|
343 </p> |
|
344 <dl> |
|
345 <dt>Return:</dt> |
|
346 <dd> |
|
347 documentation URL of the device |
|
348 </dd> |
|
349 </dl> |
|
350 <dl> |
|
351 <dt>Return Type:</dt> |
|
352 <dd> |
|
353 str |
|
354 </dd> |
|
355 </dl> |
|
356 <a NAME="TeensyDevice.getFirmwareUrl" ID="TeensyDevice.getFirmwareUrl"></a> |
|
357 <h4>TeensyDevice.getFirmwareUrl</h4> |
|
358 <b>getFirmwareUrl</b>(<i></i>) |
|
359 |
|
360 <p> |
|
361 Public method to get the device firmware download URL. |
|
362 </p> |
|
363 <dl> |
|
364 <dt>Return:</dt> |
|
365 <dd> |
|
366 firmware download URL of the device |
|
367 </dd> |
|
368 </dl> |
|
369 <dl> |
|
370 <dt>Return Type:</dt> |
|
371 <dd> |
|
372 str |
|
373 </dd> |
|
374 </dl> |
|
375 <a NAME="TeensyDevice.runScript" ID="TeensyDevice.runScript"></a> |
|
376 <h4>TeensyDevice.runScript</h4> |
|
377 <b>runScript</b>(<i>script</i>) |
|
378 |
|
379 <p> |
|
380 Public method to run the given Python script. |
|
381 </p> |
|
382 <dl> |
|
383 |
|
384 <dt><i>script</i> (str)</dt> |
|
385 <dd> |
|
386 script to be executed |
|
387 </dd> |
|
388 </dl> |
|
389 <a NAME="TeensyDevice.setButtons" ID="TeensyDevice.setButtons"></a> |
|
390 <h4>TeensyDevice.setButtons</h4> |
|
391 <b>setButtons</b>(<i></i>) |
|
392 |
|
393 <p> |
|
394 Public method to enable the supported action buttons. |
|
395 </p> |
|
396 <div align="right"><a href="#top">Up</a></div> |
|
397 <hr /> |
|
398 <hr /> |
|
399 <a NAME="createDevice" ID="createDevice"></a> |
|
400 <h2>createDevice</h2> |
|
401 <b>createDevice</b>(<i>microPythonWidget, deviceType, vid, pid, boardName, serialNumber</i>) |
|
402 |
|
403 <p> |
|
404 Function to instantiate a MicroPython device object. |
|
405 </p> |
|
406 <dl> |
|
407 |
|
408 <dt><i>microPythonWidget</i> (MicroPythonWidget)</dt> |
|
409 <dd> |
|
410 reference to the main MicroPython widget |
|
411 </dd> |
|
412 <dt><i>deviceType</i> (str)</dt> |
|
413 <dd> |
|
414 device type assigned to this device interface |
|
415 </dd> |
|
416 <dt><i>vid</i> (int)</dt> |
|
417 <dd> |
|
418 vendor ID |
|
419 </dd> |
|
420 <dt><i>pid</i> (int)</dt> |
|
421 <dd> |
|
422 product ID |
|
423 </dd> |
|
424 <dt><i>boardName</i> (str)</dt> |
|
425 <dd> |
|
426 name of the board |
|
427 </dd> |
|
428 <dt><i>serialNumber</i> (str)</dt> |
|
429 <dd> |
|
430 serial number of the board |
|
431 </dd> |
|
432 </dl> |
|
433 <dl> |
|
434 <dt>Return:</dt> |
|
435 <dd> |
|
436 reference to the instantiated device object |
|
437 </dd> |
|
438 </dl> |
|
439 <dl> |
|
440 <dt>Return Type:</dt> |
|
441 <dd> |
|
442 PyBoardDevice |
|
443 </dd> |
|
444 </dl> |
|
445 <div align="right"><a href="#top">Up</a></div> |
|
446 <hr /> |
|
447 </body></html> |