File tree 3 files changed +17
-12
lines changed 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 1
- # A modified version of uasyncio
1
+ # An experimental modified version of uasyncio
2
2
3
3
This document describes a "priority" version of uasyncio. Its purpose is to
4
4
provide a simple priority mechanism to facilitate the design of applications
5
5
with improved millisecond-level timing accuracy and reduced scheduling latency.
6
6
7
- I remain hopeful that uasyncio will mature natively to support fast I/O
8
- polling: if this occurs I plan to deprecate this solution. See
9
- [ this thread] ( https://github.com/micropython/micropython/pull/3836#issuecomment-397317408 )
10
- and [ this one] ( https://github.com/micropython/micropython/issues/2664 ) .
7
+ I am hopeful that uasyncio will support fast I/O polling and have a
8
+ [ PR] ( https://github.com/micropython/micropython-lib/pull/287 ) in place to
9
+ implement this. If this (or other solution) is implemented I will deprecate
10
+ this module as the I/O mechanism is inherently more efficient with polling
11
+ implemented in C.
11
12
12
13
V0.3 Feb 2018. A single module designed to work with the official ` uasyncio `
13
14
library. This requires ` uasyncio ` V2.0 which requires firmware dated
Original file line number Diff line number Diff line change @@ -21,8 +21,11 @@ This GitHub repository consists of the following parts:
21
21
* [ A modified uasyncio] ( ./FASTPOLL.md ) This incorporates a simple priority
22
22
mechanism. With suitable application design this improves the rate at which
23
23
devices can be polled and improves the accuracy of time delays. Also provides
24
- for low priority tasks which are only scheduled when normal tasks are paused.
25
- NOTE: this requires uasyncio V2.0.
24
+ for low priority tasks which are only scheduled when normal tasks are paused.
25
+ NOTE1: this requires uasyncio V2.0.
26
+ NOTE2: I have a PR in place which, if accepted, will largely supersede this
27
+ with a faster and more efficient way of handling fast I/O. This modified
28
+ version should be regarded as "experimental". It may stop being supported.
26
29
* [ Communication between devices] ( ./syncom_as/README.md ) Enables MicroPython
27
30
boards to communicate without using a UART. Primarily intended to enable a
28
31
a Pyboard-like device to achieve bidirectional communication with an ESP8266.
Original file line number Diff line number Diff line change @@ -908,11 +908,9 @@ comes from the `Lock` class:
908
908
If the ` async with ` has an ` as variable ` clause the variable receives the
909
909
value returned by ` __aenter__ ` .
910
910
911
- Note there is currently a bug in the implementation whereby if an explicit
912
- ` return ` is issued within an ` async with ` block, the ` __aexit__ ` method
913
- is not called. The solution is to design the code so that in all cases it runs
914
- to completion. The error appears to be in [ PEP492] ( https://www.python.org/dev/peps/pep-0492/ ) .
915
- See [ this issue] ( https://github.com/micropython/micropython/issues/3153 ) .
911
+ There was a bug in the implementation whereby if an explicit ` return ` was issued
912
+ within an ` async with ` block, the ` __aexit__ ` method was not called. This was
913
+ fixed as of 27th June 2018 [ ref] ( https://github.com/micropython/micropython/pull/3890 ) .
916
914
917
915
###### [ Contents] ( ./TUTORIAL.md#contents )
918
916
@@ -1269,11 +1267,14 @@ All devices must provide an `ioctl` method which polls the hardware to
1269
1267
determine its ready status. A typical example for a read/write driver is:
1270
1268
1271
1269
``` python
1270
+ import io
1272
1271
MP_STREAM_POLL_RD = const(1 )
1273
1272
MP_STREAM_POLL_WR = const(4 )
1274
1273
MP_STREAM_POLL = const(3 )
1275
1274
MP_STREAM_ERROR = const(- 1 )
1276
1275
1276
+ class MyIO (io .IOBase ):
1277
+ # Methods omitted
1277
1278
def ioctl (self , req , arg ): # see ports/stm32/uart.c
1278
1279
ret = MP_STREAM_ERROR
1279
1280
if req == MP_STREAM_POLL :
You can’t perform that action at this time.
0 commit comments