Skip to content

Commit 6de494b

Browse files
committed
Merge branch 'pr/andrewleech/853'
2 parents db4af20 + 1ea8fd3 commit 6de494b

File tree

2,934 files changed

+261446
-0
lines changed

Some content is hidden

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

2,934 files changed

+261446
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Jos Verlinde
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# micropython-mimxrt-mimxrt1010_evk-stubs
2+
3+
4+
This is a stub-only package for MicroPython.
5+
It is intended to be installed in a projects virtual environment to allow static type checkers and intellisense features to be used while writing Micropython code.
6+
7+
The version of this package is alligned the the version of the MicroPython firmware.
8+
- Major, Minor and Patch levels are alligned to the same version as the firmware.
9+
- The post release level is used to publish new releases of the stubs.
10+
11+
For `Micropython 1.17` the stubs are published as `1.17.post1` ... `1.17.post2`
12+
for `Micropython 1.18` the stubs are published as `1.18.post1` ... `1.18.post2`
13+
14+
To install the latest stubs:
15+
`pip install -I micropython-<port>-stubs` where port is the port of the MicroPython firmware.
16+
17+
To install the stubs for an older version, such as MicroPython 1.17:
18+
`pip install micropython-stm32-stubs==1.17.*` which will install the last post release of the stubs for MicroPython 1.17.
19+
20+
21+
As the creation of the stubs, and merging of the different types is still going though improvements, the stub packages are marked as Beta.
22+
To upgrade stubs to the latest stubs for a specific version use `pip install micropython-stm32-stubs==1.17.* --upgrade`
23+
24+
If you have suggestions or find any issues with the stubs, please report them in the [MicroPython-stubs Discussions](https://github.com/Josverl/micropython-stubs/discussions)
25+
26+
For an overview of Micropython Stubs please see: https://micropython-stubs.readthedocs.io/en/main/
27+
* List of all stubs : https://micropython-stubs.readthedocs.io/en/main/firmware_grp.html
28+
29+
30+
31+
Included stubs:
32+
* Merged stubs from `stubs/micropython-v1_26_1-mimxrt-MIMXRT1010_EVK-merged`
33+
* Frozen stubs from `stubs/micropython-v1_26_1-frozen/mimxrt/GENERIC`
34+
* Core stubs from `stubs/micropython-core`
35+
36+
37+
origin | Family | Port | Board | Version
38+
-------|--------|------|-------|--------
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Allows for type checking of Micropython specific builtins by pyright and pylance.
2+
"""
3+
4+
from typing import Tuple, TypeVar
5+
6+
Const_T = TypeVar("Const_T", int, float, str, bytes, Tuple) # constant
7+
8+
def const(expr: Const_T) -> Const_T:
9+
"""
10+
Used to declare that the expression is a constant so that the compiler can
11+
optimise it. The use of this function should be as follows::
12+
13+
from micropython import const
14+
15+
CONST_X = const(123)
16+
CONST_Y = const(2 * CONST_X + 1)
17+
18+
Constants declared this way are still accessible as global variables from
19+
outside the module they are declared in. On the other hand, if a constant
20+
begins with an underscore then it is hidden, it is not available as a global
21+
variable, and does not take up any memory during execution.
22+
23+
This `const` function is recognised directly by the MicroPython parser and is
24+
provided as part of the :mod:`micropython` module mainly so that scripts can be
25+
written which run under both CPython and MicroPython, by following the above
26+
pattern.
27+
"""
28+
...
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from _typeshed import Incomplete
2+
from machine import Pin as Pin
3+
4+
bdev: Incomplete
5+
fs: Incomplete
6+
sdcard: Incomplete
7+
fat: Incomplete
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Module: '_onewire' on micropython-v1.26.1-mimxrt-MIMXRT1010_EVK
3+
"""
4+
5+
# MCU: {'variant': '', 'build': '', 'arch': 'armv7emsp', 'port': 'mimxrt', 'board': 'MIMXRT1010_EVK', 'board_id': 'MIMXRT1010_EVK', 'mpy': 'v6.3', 'ver': '1.26.1', 'family': 'micropython', 'cpu': 'MIMXRT1011DAE5A', 'version': '1.26.1'}
6+
# Stubber: v1.26.3
7+
from __future__ import annotations
8+
from _typeshed import Incomplete
9+
10+
def reset(*args, **kwargs) -> Incomplete: ...
11+
def writebyte(*args, **kwargs) -> Incomplete: ...
12+
def writebit(*args, **kwargs) -> Incomplete: ...
13+
def crc8(*args, **kwargs) -> Incomplete: ...
14+
def readbyte(*args, **kwargs) -> Incomplete: ...
15+
def readbit(*args, **kwargs) -> Incomplete: ...
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
Binary/ASCII conversions.
3+
4+
MicroPython module: https://docs.micropython.org/en/v1.26.0/library/binascii.html
5+
6+
CPython module: :mod:`python:binascii` https://docs.python.org/3/library/binascii.html .
7+
8+
This module implements conversions between binary data and various
9+
encodings of it in ASCII form (in both directions).
10+
11+
---
12+
Module: 'binascii' on micropython-v1.26.1-mimxrt-MIMXRT1010_EVK
13+
"""
14+
15+
# MCU: {'variant': '', 'build': '', 'arch': 'armv7emsp', 'port': 'mimxrt', 'board': 'MIMXRT1010_EVK', 'board_id': 'MIMXRT1010_EVK', 'mpy': 'v6.3', 'ver': '1.26.1', 'family': 'micropython', 'cpu': 'MIMXRT1011DAE5A', 'version': '1.26.1'}
16+
# Stubber: v1.26.3
17+
from __future__ import annotations
18+
from _typeshed import Incomplete
19+
from typing import Any, Optional
20+
from typing_extensions import Awaitable, TypeAlias, TypeVar
21+
22+
def crc32(data, value: Optional[Any] = None) -> Incomplete:
23+
"""
24+
Compute CRC-32, the 32-bit checksum of *data*, starting with an initial CRC
25+
of *value*. The default initial CRC is zero. The algorithm is consistent
26+
with the ZIP file checksum.
27+
"""
28+
...
29+
30+
def hexlify(data: bytes, sep: str | bytes = ..., /) -> bytes:
31+
"""
32+
Convert the bytes in the *data* object to a hexadecimal representation.
33+
Returns a bytes object.
34+
35+
If the additional argument *sep* is supplied it is used as a separator
36+
between hexadecimal values.
37+
"""
38+
...
39+
40+
def unhexlify(data: str | bytes, /) -> bytes:
41+
"""
42+
Convert hexadecimal data to binary representation. Returns bytes string.
43+
(i.e. inverse of hexlify)
44+
"""
45+
...
46+
47+
def b2a_base64(data: bytes, /) -> bytes:
48+
"""
49+
Encode binary data in base64 format, as in `RFC 3548
50+
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
51+
followed by a newline character if newline is true, as a bytes object.
52+
"""
53+
...
54+
55+
def a2b_base64(data: str | bytes, /) -> bytes:
56+
"""
57+
Decode base64-encoded data, ignoring invalid characters in the input.
58+
Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
59+
Returns a bytes object.
60+
"""
61+
...
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
"""
2+
Mathematical functions for complex numbers.
3+
4+
MicroPython module: https://docs.micropython.org/en/v1.26.0/library/cmath.html
5+
6+
CPython module: :mod:`python:cmath` https://docs.python.org/3/library/cmath.html .
7+
8+
The ``cmath`` module provides some basic mathematical functions for
9+
working with complex numbers.
10+
11+
Availability: not available on WiPy and ESP8266. Floating point support
12+
required for this module.
13+
14+
---
15+
Module: 'cmath' on micropython-v1.26.1-mimxrt-MIMXRT1010_EVK
16+
"""
17+
18+
# MCU: {'variant': '', 'build': '', 'arch': 'armv7emsp', 'port': 'mimxrt', 'board': 'MIMXRT1010_EVK', 'board_id': 'MIMXRT1010_EVK', 'mpy': 'v6.3', 'ver': '1.26.1', 'family': 'micropython', 'cpu': 'MIMXRT1011DAE5A', 'version': '1.26.1'}
19+
# Stubber: v1.26.3
20+
from __future__ import annotations
21+
from _typeshed import Incomplete
22+
from typing import SupportsComplex, SupportsFloat, SupportsIndex, Tuple
23+
from typing_extensions import Awaitable, TypeAlias, TypeVar
24+
25+
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex
26+
27+
e: float = 2.7182818
28+
"""base of the natural logarithm"""
29+
pi: float = 3.1415928
30+
"""the ratio of a circle's circumference to its diameter"""
31+
32+
def polar(z: _C, /) -> Tuple:
33+
"""
34+
Returns, as a tuple, the polar form of ``z``.
35+
"""
36+
...
37+
38+
def sqrt(z: _C, /) -> complex:
39+
"""
40+
Return the square-root of ``z``.
41+
"""
42+
...
43+
44+
def rect(r: float, phi: float, /) -> float:
45+
"""
46+
Returns the complex number with modulus ``r`` and phase ``phi``.
47+
"""
48+
...
49+
50+
def sin(z: _C, /) -> float:
51+
"""
52+
Return the sine of ``z``.
53+
"""
54+
...
55+
56+
def exp(z: _C, /) -> float:
57+
"""
58+
Return the exponential of ``z``.
59+
"""
60+
...
61+
62+
def cos(z: _C, /) -> float:
63+
"""
64+
Return the cosine of ``z``.
65+
"""
66+
...
67+
68+
def phase(z: _C, /) -> float:
69+
"""
70+
Returns the phase of the number ``z``, in the range (-pi, +pi].
71+
"""
72+
...
73+
74+
def log(z: _C, /) -> float:
75+
"""
76+
Return the natural logarithm of ``z``. The branch cut is along the negative real axis.
77+
"""
78+
...
79+
80+
def log10(z: _C, /) -> float:
81+
"""
82+
Return the base-10 logarithm of ``z``. The branch cut is along the negative real axis.
83+
"""
84+
...
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
"""
2+
Deflate compression & decompression.
3+
4+
MicroPython module: https://docs.micropython.org/en/v1.26.0/library/deflate.html
5+
6+
This module allows compression and decompression of binary data with the
7+
`DEFLATE algorithm <https://en.wikipedia.org/wiki/DEFLATE>`_
8+
(commonly used in the zlib library and gzip archiver).
9+
10+
**Availability:**
11+
12+
* Added in MicroPython v1.21.
13+
14+
* Decompression: Enabled via the ``MICROPY_PY_DEFLATE`` build option, on by default
15+
on ports with the "extra features" level or higher (which is most boards).
16+
17+
* Compression: Enabled via the ``MICROPY_PY_DEFLATE_COMPRESS`` build option, on
18+
by default on ports with the "full features" level or higher (generally this means
19+
you need to build your own firmware to enable this).
20+
21+
---
22+
Module: 'deflate' on micropython-v1.26.1-mimxrt-MIMXRT1010_EVK
23+
"""
24+
25+
# MCU: {'variant': '', 'build': '', 'arch': 'armv7emsp', 'port': 'mimxrt', 'board': 'MIMXRT1010_EVK', 'board_id': 'MIMXRT1010_EVK', 'mpy': 'v6.3', 'ver': '1.26.1', 'family': 'micropython', 'cpu': 'MIMXRT1011DAE5A', 'version': '1.26.1'}
26+
# Stubber: v1.26.3
27+
from __future__ import annotations
28+
from typing import Final
29+
from _typeshed import Incomplete
30+
from typing_extensions import Awaitable, TypeAlias, TypeVar
31+
32+
GZIP: Final[int] = 3
33+
"""Supported values for the *format* parameter."""
34+
RAW: Final[int] = 1
35+
"""Supported values for the *format* parameter."""
36+
ZLIB: Final[int] = 2
37+
"""Supported values for the *format* parameter."""
38+
AUTO: Final[int] = 0
39+
"""Supported values for the *format* parameter."""
40+
41+
class DeflateIO:
42+
"""
43+
This class can be used to wrap a *stream* which is any
44+
:term:`stream-like <stream>` object such as a file, socket, or stream
45+
(including :class:`io.BytesIO`). It is itself a stream and implements the
46+
standard read/readinto/write/close methods.
47+
48+
The *stream* must be a blocking stream. Non-blocking streams are currently
49+
not supported.
50+
51+
The *format* can be set to any of the constants defined below, and defaults
52+
to ``AUTO`` which for decompressing will auto-detect gzip or zlib streams,
53+
and for compressing it will generate a raw stream.
54+
55+
The *wbits* parameter sets the base-2 logarithm of the DEFLATE dictionary
56+
window size. So for example, setting *wbits* to ``10`` sets the window size
57+
to 1024 bytes. Valid values are ``5`` to ``15`` inclusive (corresponding to
58+
window sizes of 32 to 32k bytes).
59+
60+
If *wbits* is set to ``0`` (the default), then for compression a window size
61+
of 256 bytes will be used (as if *wbits* was set to 8). For decompression, it
62+
depends on the format:
63+
64+
* ``RAW`` will use 256 bytes (corresponding to *wbits* set to 8).
65+
* ``ZLIB`` (or ``AUTO`` with zlib detected) will use the value from the zlib
66+
header.
67+
* ``GZIP`` (or ``AUTO`` with gzip detected) will use 32 kilobytes
68+
(corresponding to *wbits* set to 15).
69+
70+
See the :ref:`window size <deflate_wbits>` notes below for more information
71+
about the window size, zlib, and gzip streams.
72+
73+
If *close* is set to ``True`` then the underlying stream will be closed
74+
automatically when the :class:`deflate.DeflateIO` stream is closed. This is
75+
useful if you want to return a :class:`deflate.DeflateIO` stream that wraps
76+
another stream and not have the caller need to know about managing the
77+
underlying stream.
78+
79+
If compression is enabled, a given :class:`deflate.DeflateIO` instance
80+
supports both reading and writing. For example, a bidirectional stream like
81+
a socket can be wrapped, which allows for compression/decompression in both
82+
directions.
83+
"""
84+
def readinto(self, *args, **kwargs) -> Incomplete: ...
85+
def readline(self, *args, **kwargs) -> Incomplete: ...
86+
def write(self, *args, **kwargs) -> Incomplete: ...
87+
def read(self, *args, **kwargs) -> Incomplete: ...
88+
def close(self, *args, **kwargs) -> Incomplete: ...
89+
def __init__(self, stream, format=AUTO, wbits=0, close=False, /) -> None: ...
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from _typeshed import Incomplete
2+
3+
class DHTBase:
4+
pin: Incomplete
5+
buf: Incomplete
6+
def __init__(self, pin) -> None: ...
7+
def measure(self) -> None: ...
8+
9+
class DHT11(DHTBase):
10+
def humidity(self): ...
11+
def temperature(self): ...
12+
13+
class DHT22(DHTBase):
14+
def humidity(self): ...
15+
def temperature(self): ...
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from _typeshed import Incomplete
2+
from micropython import const as const
3+
4+
_CONVERT: int
5+
_RD_SCRATCH: int
6+
_WR_SCRATCH: int
7+
8+
class DS18X20:
9+
ow: Incomplete
10+
buf: Incomplete
11+
def __init__(self, onewire) -> None: ...
12+
def scan(self): ...
13+
def convert_temp(self) -> None: ...
14+
def read_scratch(self, rom): ...
15+
def write_scratch(self, rom, buf) -> None: ...
16+
def read_temp(self, rom): ...

0 commit comments

Comments
 (0)