8000 Merge pull request #1068 from dhalbert/micropython-25ae98f-merge · sparkfun/circuitpython@a6d94b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6d94b6

Browse files
authored
Merge pull request adafruit#1068 from dhalbert/micropython-25ae98f-merge
Micropython 25ae98f merge
2 parents 433a29b + b100617 commit a6d94b6

File tree

770 files changed

+35904
-14132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

770 files changed

+35904
-14132
lines changed

.gitattributes

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
tests/basics/string_cr_conversion.py -text
1919
tests/basics/string_crlf_conversion.py -text
2020
ports/stm32/pybcdc.inf_template -text
21-
ports/stm32/usbd_* -text
22-
ports/stm32/usbdev/** -text
2321
ports/stm32/usbhost/** -text
2422
ports/cc3200/hal/aes.c -text
2523
ports/cc3200/hal/aes.h -text

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
url = https://github.com/atgreen/libffi
88
[submodule "lib/lwip"]
99
path = lib/lwip
10-
url = http://git.savannah.gnu.org/r/lwip.git
10+
url = https://git.savannah.gnu.org/r/lwip.git
1111
[submodule "lib/berkeley-db-1.xx"]
1212
path = lib/berkeley-db-1.xx
1313
url = https://github.com/pfalcon/berkeley-db-1.xx

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ env:
2727
- TRAVIS_BOARD=hallowing_m0_express
2828
- TRAVIS_BOARD=feather52832
2929
- TRAVIS_BOARD=pca10056
30-
- TRAVIS_TEST=qemu
3130
- TRAVIS_TEST=unix
3231
- TRAVIS_TEST=docs
3332

@@ -50,9 +49,7 @@ notifications:
5049
before_script:
5150
- sudo dpkg --add-architecture i386
5251

53-
- ([[ -z "$TRAVIS_TEST" ]] || sudo apt-get install -y qemu-system)
5452
- ([[ -z "$TRAVIS_BOARD" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
55-
- ([[ $TRAVIS_TEST != "qemu" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
5653

5754
# For nrf builds
5855
- ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
@@ -81,10 +78,6 @@ script:
8178
- ([[ $TRAVIS_TEST != "unix" ]] || make -C ports/unix coverage -j2)
8279
- echo -en 'travis_fold:end:unix\\r'
8380

84-
- echo 'Building qemu' && echo -en 'travis_fold:start:qemu\\r'
85-
- ([[ $TRAVIS_TEST != "qemu" ]] || make -C ports/qemu-arm test -j2)
86-
- echo -en 'travis_fold:end:qemu\\r'
87-
8881
# run tests without coverage info
8982
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1)
9083
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1 --emit native)
@@ -116,4 +109,3 @@ script:
116109

117110
after_failure:
118111
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
119-
- (grep "FAIL" ports/qemu-arm/build/console.out)

conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"ports/cc3200",
109109
"ports/cc3200/FreeRTOS",
110110
"ports/cc3200/hal",
111+
"ports/esp32",
111112
"ports/esp8266/boards",
112113
"ports/esp8266/common-hal",
113114
"ports/esp8266/modules",

docs/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Classes
2121

2222
.. method:: append(val)
2323

24-
Append new element to the end of array, growing it.
24+
Append new element ``val`` to the end of array, growing it.
2525

2626
.. method:: extend(iterable)
2727

28-
Append new elements as contained in an iterable to the end of
28+
Append new elements as contained in `iterable` to the end of
2929
array, growing it.

docs/library/btree.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:synopsis: simple BTree database
88

99
The ``btree`` module implements a simple key-value database using external
10-
storage (disk files, or in general case, a random-access stream). Keys are
10+
storage (disk files, or in general case, a random-access ``stream``). Keys are
1111
stored sorted in the database, and besides efficient retrieval by a key
1212
value, a database also supports efficient ordered range scans (retrieval
1313
of values with the keys in a given range). On the application interface

docs/library/framebuf.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ Constants
150150

151151
Red Green Blue (16-bit, 5+6+5) color format
152152

153+
.. data:: framebuf.GS2_HMSB
154+
155+
Grayscale (2-bit) color format
156+
153157
.. data:: framebuf.GS4_HMSB
154158

155159
Grayscale (4-bit) color format
160+
161+
.. data:: framebuf.GS8
162+
163+
Grayscale (8-bit) color format

docs/library/micropython.rst

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ Functions
3535
compilation of scripts, and returns ``None``. Otherwise it returns the current
3636
optimisation level.
3737

38-
.. function:: alloc_emergency_exception_buf(size)
38+
The optimisation level controls the following compilation features:
3939

40-
Allocate *size* bytes of RAM for the emergency exception buffer (a good
41-
size is around 100 bytes). The buffer is used to create exceptions in cases
42-
when normal RAM allocation would fail (eg within an interrupt handler) and
43-
therefore give useful traceback information in these situations.
40+
- Assertions: at level 0 assertion statements are enabled and compiled into the
41+
bytecode; at levels 1 and higher assertions are not compiled.
42+
- Built-in ``__debug__`` variable: at level 0 this variable expands to ``True``;
43+
at levels 1 and higher it expands to ``False``.
44+
- Source-code line numbers: at levels 0, 1 and 2 source-code line number are
45+
stored along with the bytecode so that exceptions can report the line number
46+
they occurred at; at levels 3 and higher line numbers are not stored.
4447

45-
A good way to use this function is to put it at the start of your main script
46-
(eg ``boot.py`` or ``main.py``) and then the emergency exception buffer will be active
47-
for all the code following it.
48+
The default optimisation level is usually level 0.
4849

4950
.. function:: mem_info([verbose])
5051

@@ -90,29 +91,3 @@ Functions
9091
This function can be used to prevent the capturing of Ctrl-C on the
9192
incoming stream of characters that is usually used for the REPL, in case
9293
that stream is used for other purposes.
93-
94-
.. function:: schedule(func, arg)
95-
96-
Schedule the function *func* to be executed "very soon". The function
97-
is passed the value *arg* as its single argument. "Very soon" means that
98-
the MicroPython runtime will do its best to execute the function at the
99-
earliest possible time, given that it is also trying to be efficient, and
100-
that the following conditions hold:
101-
102-
- A scheduled function will never preempt another scheduled function.
103-
- Scheduled functions are always executed "between opcodes" which means
104-
that all fundamental Python operations (such as appending to a list)
105-
are guaranteed to be atomic.
106-
- A given port may define "critical regions" within which scheduled
107-
functions will never be executed. Functions may be scheduled within
108-
a critical region but they will not be executed until that region
109-
is exited. An example of a critical region is a preempting interrupt
110-
handler (an IRQ).
111-
112-
A use for this function is to schedule a callback from a preempting IRQ.
113-
Such an IRQ puts restrictions on the code that runs in the IRQ (for example
114-
the heap may be locked) and scheduling a function to call later will lift
115-
those restrictions.
116-
117-
There is a finite stack to hold the scheduled functions and `schedule`
118-
will raise a `RuntimeError` if the stack is full.

docs/library/sys.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ Constants
105105

106106
.. data:: stderr
107107

108-
Standard error stream.
108+
Standard error ``stream``.
109109

110110
.. data:: stdin
111111

112-
Standard input stream.
112+
Standard input ``stream``.
113113

114114
.. data:: stdout
115115

116-
Standard output stream.
116+
Standard output ``stream``.
117117

118118
.. data:: version
119119

docs/library/uctypes.rst

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This module implements "foreign data interface" for MicroPython. The idea
1010
behind it is similar to CPython's ``ctypes`` modules, but the actual API is
1111
different, streamlined and optimized for small size. The basic idea of the
1212
module is to define data structure layout with about the same power as the
13-
C language allows, and the access it using familiar dot-syntax to reference
13+
C language allows, and then access it using familiar dot-syntax to reference
1414
sub-fields.
1515

1616
.. seealso::
@@ -31,55 +31,55 @@ Following are encoding examples for various field types:
3131

3232
* Scalar types::
3333

34-
"field_name": uctypes.UINT32 | 0
34+
"field_name": offset | uctypes.UINT32
3535

3636
in other words, value is scalar type identifier ORed with field offset
3737
(in bytes) from the start of the structure.
3838

3939
* Recursive structures::
4040

41-
"sub": (2, {
42-
"b0": uctypes.UINT8 | 0,
43-
"b1": uctypes.UINT8 | 1,
41+
"sub": (offset, {
42+
"b0": 0 | uctypes.UINT8,
43+
"b1": 1 | uctypes.UINT8,
4444
})
4545

4646
i.e. value is a 2-tuple, first element of which is offset, and second is
4747
a structure descriptor dictionary (note: offsets in recursive descriptors
48-
are relative to a structure it defines).
48+
are relative to the structure it defines).
4949

5050
* Arrays of primitive types::
5151

52-
"arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2),
52+
"arr": (offset | uctypes.ARRAY, size | uctypes.UINT8),
5353

5454
i.e. value is a 2-tuple, first element of which is ARRAY flag ORed
5555
with offset, and second is scalar element type ORed number of elements
5656
in array.
5757

5858
* Arrays of aggregate types::
5959

60-
"arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}),
60+
"arr2": (offset | uctypes.ARRAY, size, {"b": 0 | uctypes.UINT8}),
6161

6262
i.e. value is a 3-tuple, first element of which is ARRAY flag ORed
6363
with offset, second is a number of elements in array, and third is
6464
descriptor of element type.
6565

6666
* Pointer to a primitive type::
6767

68-
"ptr": (uctypes.PTR | 0, uctypes.UINT8),
68+
"ptr": (offset | uctypes.PTR, uctypes.UINT8),
6969

7070
i.e. value is a 2-tuple, first element of which is PTR flag ORed
7171
with offset, and second is scalar element type.
7272

7373
* Pointer to an aggregate type::
7474

75-
"ptr2": (uctypes.PTR | 0, {"b": uctypes.UINT8 | 0}),
75+
"ptr2": (offset | uctypes.PTR, {"b": 0 | uctypes.UINT8}),
7676

7777
i.e. value is a 2-tuple, first element of which is PTR flag ORed
7878
with offset, second is descriptor of type pointed to.
7979

8080
* Bitfields::
8181

82-
"bitf0": uctypes.BFUINT16 | 0 | 0 << uctypes.BF_POS | 8 << uctypes.BF_LEN,
82+
"bitf0": offset | uctypes.BFUINT16 | lsbit << uctypes.BF_POS | bitsize << uctypes.BF_LEN,
8383

8484
i.e. value is type of scalar value containing given bitfield (typenames are
8585
similar to scalar types, but prefixes with "BF"), ORed with offset for
@@ -88,20 +88,21 @@ Following are encoding examples for various field types:
8888
BF_POS and BF_LEN positions, respectively. Bitfield position is counted
8989
from the least significant bit, and is the number of right-most bit of a
9090
field (in other words, it's a number of bits a scalar needs to be shifted
91-
right to extra the bitfield).
91+
right to extract the bitfield).
9292

93-
In the example above, first UINT16 value will be extracted at offset 0
93+
In the example above, first a UINT16 value will be extracted at offset 0
9494
(this detail may be important when accessing hardware registers, where
9595
particular access size and alignment are required), and then bitfield
96-
whose rightmost bit is least-significant bit of this UINT16, and length
97-
is 8 bits, will be extracted - effectively, this will access
98-
least-significant byte of UINT16.
96+
whose rightmost bit is *lsbit* bit of this UINT16, and length
97+
is *bitsize* bits, will be extracted. For example, if *lsbit* is 0 and
98+
*bitsize* is 8, then effectively it will access least-significant byte
99+
of UINT16.
99100

100101
Note that bitfield operations are independent of target byte endianness,
101102
in particular, example above will access least-significant byte of UINT16
102103
in both little- and big-endian structures. But it depends on the least
103104
significant bit being numbered 0. Some targets may use different
104-
numbering in their native ABI, but ``uctypes`` always uses normalized
105+
numbering in their native ABI, but ``uctypes`` always uses the normalized
105106
numbering described above.
106107

107108
Module contents

docs/library/uio.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
|see_cpython_module| :mod:`cpython:io`.
1010

11-
This module contains additional types of stream (file-like) objects
11+
This module contains additional types of ``stream`` (file-like) objects
1212
and helper functions.
1313

1414
Conceptual hierarchy

docs/library/ujson.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,24 @@ data format.
1414
Functions
1515
---------
1616

17+
.. function:: dump(obj, stream)
18+
19+
Serialise ``obj`` to a JSON string, writing it to the given *stream*.
20+
1721
.. function:: dumps(obj)
1822

1923
Return ``obj`` represented as a JSON string.
2024

25+
.. function:: load(stream)
26+
27+
Parse the given ``stream``, interpreting it as a JSON string and
28+
deserialising the data to a Python object. The resulting object is
29+
returned.
30+
31+
Parsing continues until end-of-file is encountered.
32+
A :exc:`ValueError` is raised if the data in ``stream`` is not correctly formed.
33+
2134
.. function:: loads(str)
2235

23-
Parse the JSON ``str`` and return an object. Raises ValueError if the
36+
Parse the JSON *str* and return an object. Raises :exc:`ValueError` if the
2437
string is not correctly formed.

docs/library/ure.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ Supported operators are:
1717
``'.'``
1818
Match any character.
1919

20-
``'[]'``
21-
Match set of characters. Individual characters and ranges are supported.
20+
``'[...]'``
21+
Match set of characters. Individual characters and ranges are supported,
22+
including negated sets (e.g. ``[^a-c]``).
2223

2324
``'^'``
2425

@@ -38,18 +39,19 @@ Supported operators are:
3839

3940
``'|'``
4041

41-
``'()'``
42+
``'(...)'``
4243
Grouping. Each group is capturing (a substring it captures can be accessed
4344
with `match.group()` method).
4445

45-
Counted repetitions (``{m,n}``), more advanced assertions, named groups,
46-
etc. are not supported.
46+
**NOT SUPPORTED**: Counted repetitions (``{m,n}``), more advanced assertions
47+
(``\b``, ``\B``), named groups (``(?P<name>...)``), non-capturing groups
48+
(``(?:...)``), etc.
4749

4850

4951
Functions
5052
---------
5153

52-
.. function:: compile(regex_str)
54+
.. function:: compile(regex_str, [flags])
5355

5456
Compile regular expression, return `regex <regex>` object.
5557

0 commit comments

Comments
 (0)
0