Merge MicroPython 1.12 into CircuitPython · megacoder/circuitpython@b35fa44 · GitHub
Skip to content

Commit b35fa44

Browse files
committed
Merge MicroPython 1.12 into CircuitPython
1 parent 25ccd5d commit b35fa44

409 files changed

Lines changed: 46797 additions & 5223 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 0 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ dist/
2828
######################
2929
*.swp
3030

31-
# Build directory
31+
# Build directories
3232
######################
3333
build/
3434
bin/
3535
circuitpython-stubs/
36+
build-*/
3637

3738
# Test failure outputs
3839
######################

ACKNOWLEDGEMENTS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ today. The names appear in order of pledging.
762762
1642 Udine
763763
1643 Simon Critchley
764764
1644 Sven Haiges, Germany
765-
1645 Yi Qing Sim
766765
1646 "silicium" ("silicium_one", if "silicium" is busy)
767766
1648 Andy O'Malia, @andyomalia
768767
1650 RedCamelApps.com

docs/library/array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:mod:`array` -- arrays of numeric data
2-
======================================
2+
=======================================
33

44
.. module:: array
55
:synopsis: efficient arrays of numeric data
@@ -13,7 +13,7 @@ floating-point support).
1313
Classes
1414
-------
1515

16-
.. class:: array.array(typecode, [iterable])
16+
.. class:: array(typecode, [iterable])
1717

1818
Create array with elements of given type. Initial contents of the
1919
array are given by an `iterable`. If it is not provided, an empty

docs/library/framebuf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ For example::
2121
import framebuf
2222

2323
# FrameBuffer needs 2 bytes for every RGB565 pixel
24-
fbuf = FrameBuffer(bytearray(10 * 100 * 2), 10, 100, framebuf.RGB565)
24+
fbuf = framebuf.FrameBuffer(bytearray(10 * 100 * 2), 10, 100, framebuf.RGB565)
2525

2626
fbuf.fill(0)
2727
fbuf.text('MicroPython!', 0, 0, 0xffff)

docs/library/micropython.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,36 @@ Functions
9494
This function can be used to prevent the capturing of Ctrl-C on the
9595
incoming stream of characters that is usually used for the REPL, in case
9696
that stream is used for other purposes.
97+
98+
.. function:: schedule(func, arg)
99+
100+
Schedule the function *func* to be executed "very soon". The function
101+
is passed the value *arg* as its single argument. "Very soon" means that
102+
the MicroPython runtime will do its best to execute the function at the
103+
earliest possible time, given that it is also trying to be efficient, and
104+
that the following conditions hold:
105+
106+
- A scheduled function will never preempt another scheduled function.
107+
- Scheduled functions are always executed "between opcodes" which means
108+
that all fundamental Python operations (such as appending to a list)
109+
are guaranteed to be atomic.
110+
- A given port may define "critical regions" within which scheduled
111+
functions will never be executed. Functions may be scheduled within
112+
a critical region but they will not be executed until that region
113+
is exited. An example of a critical region is a preempting interrupt
114+
handler (an IRQ).
115+
116+
A use for this function is to schedule a callback from a preempting IRQ.
117+
Such an IRQ puts restrictions on the code that runs in the IRQ (for example
118+
the heap may be locked) and scheduling a function to call later will lift
119+
those restrictions.
120+
121+
Note: If `schedule()` is called from a preempting IRQ, when memory
122+
allocation is not allowed and the callback to be passed to `schedule()` is
123+
a bound method, passing this directly will fail. This is because creating a
124+
reference to a bound method causes memory allocation. A solution is to
125+
create a reference to the method in the class constructor and to pass that
126+
reference to `schedule()`.
127+
128+
There is a finite queue to hold the scheduled functions and `schedule()`
129+
will raise a `RuntimeError` if the queue is full.

docs/library/sys.rst

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ Functions
1717
function raise as `SystemExit` exception. If an argument is given, its
1818
value given as an argument to `SystemExit`.
1919

20-
.. function:: print_exception(exc, file=sys.stdout)
21-
22-
Print exception with a traceback to a file-like object *file* (or
23-
`sys.stdout` by default).
24-
25-
.. admonition:: Difference to CPython
26-
:class: attention
27-
28-
This is simplified version of a function which appears in the
29-
``traceback`` module in CPython. Unlike ``traceback.print_exception()``,
30-
this function takes just exception value instead of exception type,
31-
exception value, and traceback object; *file* argument should be
32-
positional; further arguments are not supported.
33-
3420
Constants
3521
---------
3622

@@ -122,3 +108,9 @@ Constants
122108
.. data:: version_info
123109

124110
Python language version that this implementation conforms to, as a tuple of ints.
111+
112+
.. admonition:: Difference to CPython
113+
:class: attention
114+
115+
Only the first three version numbers (major, minor, micro) are supported and
116+
they can be referenced only by index, not by name.

extmod/crypto-algorithms/sha256.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*********************************************************************
2+
* Source: https://github.com/B-Con/crypto-algorithms
23
* Filename: sha256.c
34
* Author: Brad Conte (brad AT bradconte.com)
4-
* Copyright:
5+
* Copyright: This code is released into the public domain.
56
* Disclaimer: This code is presented "as is" without any guarantees.
67
* Details: Implementation of the SHA-256 hashing algorithm.
78
SHA-256 is one of the three algorithms in the SHA2

extmod/crypto-algorithms/sha256.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*********************************************************************
2+
* Source: https://github.com/B-Con/crypto-algorithms
23
* Filename: sha256.h
34
* Author: Brad Conte (brad AT bradconte.com)
4-
* Copyright:
5+
* Copyright: This code is released into the public domain.
56
* Disclaimer: This code is presented "as is" without any guarantees.
67
* Details: Defines the API for the corresponding SHA1 implementation.
78
*********************************************************************/

extmod/extmod.mk

Lines changed: 232 additions & 0 deletions

0 commit comments

Comments
 (0)