Merge pull request #17 from adafruit/main

update from main
This commit is contained in:
DavePutz 2020-08-01 12:22:12 -05:00 committed by GitHub
commit a44c09e286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
173 changed files with 4586 additions and 1232 deletions

View File

@ -37,7 +37,7 @@ jobs:
run: |
sudo apt-get install -y eatmydata
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli
- name: Versions
run: |
gcc --version
@ -86,24 +86,32 @@ jobs:
working-directory: tools
- name: Build mpy-cross.static-raspbian
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: mpy-cross.static-raspbian
path: mpy-cross/mpy-cross.static-raspbian
- name: Build mpy-cross.static
run: make -C mpy-cross -j2 -f Makefile.static
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: mpy-cross.static-amd64-linux
path: mpy-cross/mpy-cross.static
- name: Build mpy-cross.static-mingw
run: make -C mpy-cross -j2 -f Makefile.static-mingw
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: mpy-cross.static-x64-windows
path: mpy-cross/mpy-cross.static.exe
- name: Upload mpy-cross builds to S3
run: |
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
mpy-cross-mac:
runs-on: macos-10.15
@ -112,9 +120,9 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Make gettext programs available
- name: Install dependencies
run: |
brew install gettext
brew install gettext awscli
echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH"
- name: Versions
run: |
@ -127,13 +135,23 @@ jobs:
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: CircuitPython version
run: git describe --dirty --tags
run: |
git describe --dirty --tags
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
- name: Build mpy-cross
run: make -C mpy-cross -j2
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: mpy-cross-macos-catalina
path: mpy-cross/mpy-cross
- name: Upload mpy-cross build to S3
run: |
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
build-arm:
runs-on: ubuntu-18.04
@ -154,6 +172,7 @@ jobs:
- "bast_pro_mini_m0"
- "bdmicro_vina_m0"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "capablerobot_usbhub"
- "catwan_usbstick"
- "circuitbrains_basic_m0"
@ -195,6 +214,7 @@ jobs:
- "hallowing_m0_express"
- "hallowing_m4_express"
- "hiibot_bluefi"
- "ikigaisense_vita"
- "imxrt1010_evk"
- "imxrt1020_evk"
- "imxrt1060_evk"
@ -216,6 +236,7 @@ jobs:
- "mini_sam_m4"
- "monster_m4sk"
- "ndgarage_ndbit6"
- "ndgarage_ndbit6_v2"
- "nfc_copy_cat"
- "nice_nano"
- "nucleo_f746zg"
@ -314,7 +335,7 @@ jobs:
working-directory: tools
env:
BOARDS: ${{ matrix.board }}
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.board }}
path: bin/${{ matrix.board }}
@ -362,7 +383,7 @@ jobs:
working-directory: tools
env:
BOARDS: ${{ matrix.board }}
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.board }}
path: bin/${{ matrix.board }}
@ -442,7 +463,7 @@ jobs:
IDF_PATH: ${{ github.workspace }}/ports/esp32s2/esp-idf
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
BOARDS: ${{ matrix.board }}
- uses: actions/upload-artifact@v1.0.0
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.board }}
path: bin/${{ matrix.board }}

View File

@ -241,6 +241,7 @@ check-translate:
stubs:
@mkdir -p circuitpython-stubs
@$(PYTHON) tools/extract_pyi.py shared-bindings/ $(STUBDIR)
@$(PYTHON) tools/extract_pyi.py extmod/ulab/code/ $(STUBDIR)/ulab
@$(PYTHON) tools/extract_pyi.py ports/atmel-samd/bindings $(STUBDIR)
@$(PYTHON) setup.py -q sdist

View File

@ -3,3 +3,5 @@ recommonmark==0.6.0
sphinxcontrib-svg2pdfconverter==0.1.0
astroid
sphinx-autoapi
isort
black

@ -1 +1 @@
Subproject commit 48cb939839fcf091fcdcdf742530b1b650066a15
Subproject commit 11a7ecff6d76a02644ff23a734b792afaa615e44

@ -1 +1 @@
Subproject commit dc5445e2f45cb348a44fe24fc1be4bc8b5ba5bab
Subproject commit 22100b252fc2eb8f51ed407949645653c4880fd9

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-21 18:43-0700\n"
"POT-Creation-Date: 2020-07-30 07:23-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -110,10 +110,6 @@ msgstr ""
msgid "'%q' argument required"
msgstr ""
#: py/objarray.c
msgid "'%q' object is not bytes-like"
msgstr ""
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a label"
@ -219,11 +215,11 @@ msgid "'align' requires 1 argument"
msgstr ""
#: py/compile.c
msgid "'async for' or 'async with' outside async function"
msgid "'await' outside function"
msgstr ""
#: py/compile.c
msgid "'await' outside function"
msgid "'await', 'async for' or 'async with' outside async function"
msgstr ""
#: py/compile.c
@ -774,7 +770,7 @@ msgstr ""
msgid "Extended advertisements with scan response not supported."
msgstr ""
#: extmod/ulab/code/fft.c
#: extmod/ulab/code/fft/fft.c
msgid "FFT is defined for ndarrays only"
msgstr ""
@ -865,6 +861,10 @@ msgstr ""
msgid "I2C Init Error"
msgstr ""
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
msgstr ""
#: shared-bindings/aesio/aes.c
#, c-format
msgid "IV must be %d bytes long"
@ -1336,10 +1336,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
#: ports/stm/ref/pulseout-pre-timeralloc.c
msgid "PulseOut not supported on this chip"
msgstr ""
#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
@ -1773,7 +1769,7 @@ msgstr ""
msgid "__new__ arg must be a user-type"
msgstr ""
#: extmod/modubinascii.c extmod/moduhashlib.c
#: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c
msgid "a bytes-like object is required"
msgstr ""
@ -1794,7 +1790,7 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/vector/vectorise.c
msgid "arctan2 is implemented for scalars and ndarrays only"
msgstr ""
@ -1802,7 +1798,7 @@ msgstr ""
msgid "arg is an empty sequence"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "argsort argument must be an ndarray"
msgstr ""
@ -1810,6 +1806,10 @@ msgstr ""
msgid "argument has wrong type"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "argument must be ndarray"
msgstr ""
#: py/argcheck.c shared-bindings/_stage/__init__.c
#: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c
msgid "argument num/types mismatch"
@ -1819,7 +1819,7 @@ msgstr ""
msgid "argument should be a '%q' not a '%q'"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "arguments must be ndarrays"
msgstr ""
@ -1827,7 +1827,7 @@ msgstr ""
msgid "array/bytes required on right side"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "attempt to get argmin/argmax of an empty sequence"
msgstr ""
@ -1835,15 +1835,15 @@ msgstr ""
msgid "attributes not supported yet"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "axis must be -1, 0, None, or 1"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "axis must be -1, 0, or 1"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "axis must be None, 0, or 1"
msgstr ""
@ -2149,15 +2149,15 @@ msgstr ""
msgid "conversion to object"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "convolve arguments must be linear arrays"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "convolve arguments must be ndarrays"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "convolve arguments must not be empty"
msgstr ""
@ -2165,7 +2165,7 @@ msgstr ""
msgid "could not broadast input array from shape"
msgstr ""
#: extmod/ulab/code/poly.c
#: extmod/ulab/code/poly/poly.c
msgid "could not invert Vandermonde matrix"
msgstr ""
@ -2173,15 +2173,15 @@ msgstr ""
msgid "couldn't determine SD card version"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "data must be iterable"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "data must be of equal length"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "ddof must be smaller than length of data set"
msgstr ""
@ -2210,7 +2210,7 @@ msgstr ""
msgid "dict update sequence has wrong length"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "diff argument must be an ndarray"
msgstr ""
@ -2313,11 +2313,11 @@ msgstr ""
msgid "filesystem must provide mount method"
msgstr ""
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/vector/vectorise.c
msgid "first argument must be a callable"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "first argument must be a function"
msgstr ""
@ -2325,7 +2325,7 @@ msgstr ""
msgid "first argument must be an iterable"
msgstr ""
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/vector/vectorise.c
msgid "first argument must be an ndarray"
msgstr ""
@ -2337,7 +2337,7 @@ msgstr ""
msgid "flattening order must be either 'C', or 'F'"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "flip argument must be an ndarray"
msgstr ""
@ -2370,11 +2370,11 @@ msgstr ""
msgid "function got multiple values for argument '%q'"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "function has the same sign at the ends of interval"
msgstr ""
#: extmod/ulab/code/compare.c
#: extmod/ulab/code/compare/compare.c
msgid "function is implemented for scalars and ndarrays only"
msgstr ""
@ -2460,7 +2460,7 @@ msgstr ""
msgid "indices must be integers, slices, or Boolean lists"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "initial values must be iterable"
msgstr ""
@ -2468,35 +2468,35 @@ msgstr ""
msgid "inline assembler must be a function"
msgstr ""
#: extmod/ulab/code/create.c
#: extmod/ulab/code/ulab_create.c
msgid "input argument must be an integer or a 2-tuple"
msgstr ""
#: extmod/ulab/code/fft.c
#: extmod/ulab/code/fft/fft.c
msgid "input array length must be power of 2"
msgstr ""
#: extmod/ulab/code/poly.c
#: extmod/ulab/code/poly/poly.c
msgid "input data must be an iterable"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "input matrix is asymmetric"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "input matrix is singular"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "input must be square matrix"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "input must be tuple, list, range, or ndarray"
msgstr ""
#: extmod/ulab/code/poly.c
#: extmod/ulab/code/poly/poly.c
msgid "input vectors must be of equal length"
msgstr ""
@ -2508,7 +2508,7 @@ msgstr ""
msgid "integer required"
msgstr ""
#: extmod/ulab/code/approx.c
#: extmod/ulab/code/approx/approx.c
msgid "interp is defined for 1D arrays of equal length"
msgstr ""
@ -2578,7 +2578,7 @@ msgstr ""
msgid "iterables are not of the same length"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "iterations did not converge"
msgstr ""
@ -2642,11 +2642,11 @@ msgstr ""
msgid "math domain error"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix dimensions do not match"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "matrix is not positive definite"
msgstr ""
@ -2673,7 +2673,7 @@ msgstr ""
msgid "module not found"
msgstr ""
#: extmod/ulab/code/poly.c
#: extmod/ulab/code/poly/poly.c
msgid "more degrees of freedom than data points"
msgstr ""
@ -2697,7 +2697,7 @@ msgstr ""
msgid "must use keyword argument for key function"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "n must be between 0, and 9"
msgstr ""
@ -2795,11 +2795,11 @@ msgstr ""
msgid "not enough arguments for format string"
msgstr ""
#: extmod/ulab/code/poly.c
#: extmod/ulab/code/poly/poly.c
msgid "number of arguments must be 2, or 3"
msgstr ""
#: extmod/ulab/code/create.c
#: extmod/ulab/code/ulab_create.c
msgid "number of points must be at least 2"
msgstr ""
@ -2870,12 +2870,12 @@ msgstr ""
msgid "only slices with step=1 (aka None) are supported"
msgstr ""
#: extmod/ulab/code/compare.c extmod/ulab/code/ndarray.c
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/compare/compare.c extmod/ulab/code/ndarray.c
#: extmod/ulab/code/vector/vectorise.c
msgid "operands could not be broadcast together"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "operation is not implemented on ndarrays"
msgstr ""
@ -2967,7 +2967,7 @@ msgstr ""
msgid "raw f-strings are not implemented"
msgstr ""
#: extmod/ulab/code/fft.c
#: extmod/ulab/code/fft/fft.c
msgid "real and imaginary parts must be of equal length"
msgstr ""
@ -3040,7 +3040,7 @@ msgstr ""
msgid "single '}' encountered in format string"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "size is defined for ndarrays only"
msgstr ""
@ -3064,19 +3064,19 @@ msgstr ""
msgid "soft reboot\n"
msgstr ""
#: extmod/ulab/code/numerical.c
#: extmod/ulab/code/numerical/numerical.c
msgid "sort argument must be an ndarray"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "sos array must be of shape (n_section, 6)"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "sos[:, 3] should be all ones"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "sosfilt requires iterable arguments"
msgstr ""
@ -3190,7 +3190,11 @@ msgstr ""
msgid "too many values to unpack (expected %d)"
msgstr ""
#: extmod/ulab/code/linalg.c py/objstr.c
#: extmod/ulab/code/approx/approx.c
msgid "trapz is defined for 1D arrays of equal length"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c py/objstr.c
msgid "tuple index out of range"
msgstr ""
@ -3318,6 +3322,10 @@ msgstr ""
msgid "value_count must be > 0"
msgstr ""
#: extmod/ulab/code/linalg/linalg.c
msgid "vectors must have same lengths"
msgstr ""
#: shared-bindings/watchdog/WatchDogTimer.c
msgid "watchdog timeout must be greater than 0"
msgstr ""
@ -3326,7 +3334,7 @@ msgstr ""
msgid "window must be <= interval"
msgstr ""
#: extmod/ulab/code/linalg.c
#: extmod/ulab/code/linalg/linalg.c
msgid "wrong argument type"
msgstr ""
@ -3334,11 +3342,11 @@ msgstr ""
msgid "wrong index type"
msgstr ""
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/vector/vectorise.c
msgid "wrong input type"
msgstr ""
#: py/objstr.c
#: extmod/ulab/code/ulab_create.c py/objstr.c
msgid "wrong number of arguments"
msgstr ""
@ -3350,7 +3358,7 @@ msgstr ""
msgid "wrong operand type"
msgstr ""
#: extmod/ulab/code/vectorise.c
#: extmod/ulab/code/vector/vectorise.c
msgid "wrong output type"
msgstr ""
@ -3370,14 +3378,14 @@ msgstr ""
msgid "zero step"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "zi must be an ndarray"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "zi must be of float type"
msgstr ""
#: extmod/ulab/code/filter.c
#: extmod/ulab/code/filter/filter.c
msgid "zi must be of shape (n_section, 2)"
msgstr ""

3386
locale/hi.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -87,25 +87,28 @@ INC += -I. \
ifeq ($(CHIP_FAMILY), samd21)
PERIPHERALS_CHIP_FAMILY=samd21
CFLAGS += -Os -DNDEBUG
OPTIMIZATION_FLAGS ?= -Os
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
endif
ifeq ($(CHIP_FAMILY), samd51)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
CFLAGS += -Os -DNDEBUG
OPTIMIZATION_FLAGS ?= -O2
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
endif
ifeq ($(CHIP_FAMILY), same54)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
CFLAGS += -Os -DNDEBUG
OPTIMIZATION_FLAGS ?= -O2
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
endif
# option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS) -DNDEBUG
$(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
#Debugging/Optimization
ifeq ($(DEBUG), 1)

View File

@ -30,7 +30,6 @@
#include "py/objproperty.h"
#include "py/runtime.h"
//| import typing
//| class Clock:
//| """Identifies a clock on the microcontroller.
//|
@ -44,7 +43,7 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print
mp_printf(print, "%q.%q.%q", MP_QSTR_samd, MP_QSTR_clock, self->name);
}
//| enabled: bool = ...
//| enabled: bool
//| """Is the clock enabled? (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) {
@ -62,7 +61,7 @@ const mp_obj_property_t samd_clock_enabled_obj = {
},
};
//| parent: typing.Union(Clock | None) = ...
//| parent: Union[Clock, None]
//| """Clock parent. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) {
@ -90,7 +89,7 @@ const mp_obj_property_t samd_clock_parent_obj = {
},
};
//| frequency: int = ...
//| frequency: int
//| """Clock frequency in Herz. (read-only)"""
//|
STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) {
@ -108,7 +107,7 @@ const mp_obj_property_t samd_clock_frequency_obj = {
},
};
//| calibration: int = ...
//| calibration: int
//| """Clock calibration. Not all clocks can be calibrated."""
//|
STATIC mp_obj_t samd_clock_get_calibration(mp_obj_t self_in) {

View File

@ -18,6 +18,8 @@ SUPEROPT_GC = 0
CFLAGS_INLINE_LIMIT = 60
CIRCUITPY_GAMEPAD = 1
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID

View File

@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "supervisor/shared/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
board_reset_user_neopixels();
}

View File

@ -0,0 +1,37 @@
#define MICROPY_HW_BOARD_NAME "Adafruit BLM Badge"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_LED_STATUS (&pin_PA03)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define DEFAULT_I2C_BUS_SCL (&pin_PA01)
#define DEFAULT_I2C_BUS_SDA (&pin_PA00)
#define DEFAULT_UART_BUS_RX (&pin_PA01)
#define DEFAULT_UART_BUS_TX (&pin_PA00)
#define USER_NEOPIXELS_PIN (&pin_PA05)
#define IGNORE_PIN_PA09 1
#define IGNORE_PIN_PA12 1
#define IGNORE_PIN_PA13 1
#define IGNORE_PIN_PA14 1
#define IGNORE_PIN_PA15 1
#define IGNORE_PIN_PA16 1
#define IGNORE_PIN_PA17 1
#define IGNORE_PIN_PA18 1
#define IGNORE_PIN_PA19 1
#define IGNORE_PIN_PA20 1
#define IGNORE_PIN_PA21 1
#define IGNORE_PIN_PA22 1
#define IGNORE_PIN_PA23 1
// USB is always used.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PA27 1
#define IGNORE_PIN_PA28 1
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1

View File

@ -0,0 +1,24 @@
USB_VID = 0x239A
USB_PID = 0x80C0
USB_PRODUCT = "BLM Badge"
USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_AUDIOIO = 1
CIRCUITPY_AUDIOBUSIO = 1
# Pins for I2SOut are not available.
CIRCUITPY_AUDIOBUSIO_I2SOUT = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 0
SUPEROPT_GC = 0

View File

@ -0,0 +1,43 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) }, // pad 1
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) }, // pad 0
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_CAP1), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_CAP2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_CAP3), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_CAP4), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA03) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -28,7 +28,7 @@
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
// Increase stack size slightly due to CPX library import nesting
#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) //divisible by 8
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) //divisible by 8
#define USER_NEOPIXELS_PIN (&pin_PB23)

View File

@ -30,7 +30,7 @@
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
// Increase stack size slightly due to CPX library import nesting
#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) // divisible by 8
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)

View File

@ -28,7 +28,7 @@
#define BOARD_USER_SAFE_MODE_ACTION "pressing both buttons at start up"
// Increase stack size slightly due to CPX library import nesting.
#define CIRCUITPY_DEFAULT_STACK_SIZE (4760) // divisible by 8
#define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8
#define USER_NEOPIXELS_PIN (&pin_PB23)

View File

@ -13,7 +13,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA31) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA30) },
{ MP_ROM_QSTR(MP_QSTR_SDI), MP_ROM_PTR(&pin_PA30) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
@ -31,6 +33,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_EN), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },

View File

@ -18,3 +18,6 @@ CIRCUITPY_PS2IO = 0
CIRCUITPY_AUDIOMP3 = 0
CIRCUITPY_ULAB = 0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANG_APA102 = 1
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -0,0 +1,39 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
#include "mpconfigboard.h"
#include "hal/include/hal_gpio.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,22 @@
#define MICROPY_HW_BOARD_NAME "ndGarage[n°] Bit6: FeatherSnow-v2"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_LED_STATUS (&pin_PA23)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 CIRCUITPY_INTERNAL_NVM_SIZE)
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
#define DEFAULT_UART_BUS_RX (&pin_PA17)
#define DEFAULT_UART_BUS_TX (&pin_PA16)
// USB is always used.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,14 @@
LD_FILE = boards/samd21x18-bootloader.ld
USB_VID = 0x239A
USB_PID = 0x80B9
USB_PRODUCT = "Bit6"
USB_MANUFACTURER = "ndGarage"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0

View File

@ -0,0 +1,36 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PA28) },
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -76,13 +76,13 @@ void board_init(void) {
sizeof(start_sequence),
stop_sequence,
sizeof(stop_sequence),
400, // width
300, // height
400, // RAM width
300, // RAM height
300, // width
400, // height
300, // RAM width
400, // RAM height
0, // colstart
0, // rowstart
0, // rotation
270, // rotation
NO_COMMAND, // set_column_window_command
NO_COMMAND, // set_row_window_command
NO_COMMAND, // set_current_column_command

View File

@ -53,6 +53,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_EBSY), MP_ROM_PTR(&pin_PA01) },
// Special named pins
{ MP_OBJ_NEW_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_USB), MP_ROM_PTR(&pin_PB00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICIN), MP_ROM_PTR(&pin_PB04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICOUT), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LOCK_BUTTON), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_PB12) },

View File

@ -46,3 +46,5 @@ CFLAGS_INLINE_LIMIT = 45
else
CFLAGS_INLINE_LIMIT = 70
endif
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -1,4 +1,5 @@
#include "shared-bindings/board/__init__.h"
#include "shared-module/displayio/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
@ -86,5 +87,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -27,6 +27,11 @@
#include <stdint.h>
#include <string.h>
#include "mpconfigport.h"
// Some boards don't implement I2SOut, so suppress any routines from here.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
#include "extmod/vfs_fat.h"
#include "py/gc.h"
#include "py/mperrno.h"
@ -382,3 +387,5 @@ bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) {
}
return still_playing;
}
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT

View File

@ -32,6 +32,9 @@
#include "audio_dma.h"
#include "py/obj.h"
// Some boards don't implement I2SOut, so suppress any routines from here.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
// We don't bit pack because we'll only have two at most. Its better to save code size instead.
typedef struct {
mp_obj_base_t base;
@ -48,4 +51,6 @@ typedef struct {
void i2sout_reset(void);
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_AUDIOBUSIO_I2SOUT_H

View File

@ -84,12 +84,12 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
self->clock_pin = clock_pin; // PA10, PA20 -> SCK0, PB11 -> SCK1
#ifdef SAMD21
if (clock_pin == &pin_PA10
#ifdef PIN_PA20
#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20)
|| clock_pin == &pin_PA20
#endif
) {
self->clock_unit = 0;
#ifdef PIN_PB11
#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11)
} else if (clock_pin == &pin_PB11) {
self->clock_unit = 1;
#endif
@ -98,7 +98,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
self->clock_unit = 0;
} else if (clock_pin == &pin_PB12
#ifdef PIN_PB28
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|| data_pin == &pin_PB28) {
#else
) {
@ -112,14 +112,24 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1
#ifdef SAMD21
if (data_pin == &pin_PA07 || data_pin == &pin_PA19) {
self->serializer = 0;
} else if (data_pin == &pin_PA08
#ifdef PIN_PB16
|| data_pin == &pin_PB16) {
#else
) {
if (false
#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07)
|| data_pin == &pin_PA07
#endif
#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19)
|| data_pin == &pin_PA19
#endif
) {
self->serializer = 0;
}
else if (false
#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08)
|| data_pin == &pin_PA08
#endif
#if defined (PIN_PB16) && !defined(IGNORE_PIN_PB16)
|| data_pin == &pin_PB16
#endif
) {
self->serializer = 1;
#endif
#ifdef SAM_D5X_E5X

View File

@ -109,7 +109,7 @@
#endif
#ifndef CIRCUITPY_DEFAULT_STACK_SIZE
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
#define CIRCUITPY_DEFAULT_STACK_SIZE 3584
#endif
#ifndef SAMD21_BOD33_LEVEL

@ -1 +1 @@
Subproject commit e4161d7d6d98d78eddcccb82128856af4baf7e50
Subproject commit 0f5f1522d09c8fa7d858edec484a994c21c59668

View File

@ -322,9 +322,11 @@ void reset_port(void) {
audioout_reset();
#endif
#if CIRCUITPY_AUDIOBUSIO
i2sout_reset();
//pdmin_reset();
#endif
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
i2sout_reset();
#endif
#if CIRCUITPY_TOUCHIO && CIRCUITPY_TOUCHIO_USE_NATIVE
touchin_reset();

View File

@ -107,7 +107,6 @@ CFLAGS += \
-Dmain=spresense_main \
-D_estack=__stack \
-c \
-Os \
-pipe \
-std=gnu11 \
-mcpu=cortex-m4 \
@ -123,6 +122,12 @@ CFLAGS += \
-fdata-sections \
-Wall \
OPTIMIZATION_FLAGS ?= -O2
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
LIBM = "${shell "$(CC)" $(CFLAGS) -print-file-name=libm.a}"
LIBGCC = "${shell "$(CC)" $(CFLAGS) -print-libgcc-file-name}"
@ -146,7 +151,7 @@ LDFLAGS = \
--end-group \
-L$(BUILD) \
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_CXD56 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=512 $(CFLAGS_MOD)
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_CXD56 -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=512 $(CFLAGS_MOD)
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \

View File

@ -1,5 +1,5 @@
USB_SERIAL_NUMBER_LENGTH = 10
USB_MSC_MAX_PACKET_SIZE = 512
USB_HIGHSPEED = 1
USB_RENUMBER_ENDPOINTS = 0
USB_CDC_EP_NUM_NOTIFICATION = 3
USB_CDC_EP_NUM_DATA_OUT = 2

View File

@ -101,14 +101,19 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5
#Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
OPTIMIZATION_FLAGS ?= -Og
# You may want to enable these flags to make setting breakpoints easier.
# CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -Os -DNDEBUG -ggdb3
CFLAGS += -DNDEBUG -ggdb3
OPTIMIZATION_FLAGS ?= -O2
# TODO: Test with -flto
### CFLAGS += -flto
endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Werror -Wall -mlongcalls -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref

View File

@ -77,12 +77,17 @@ ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
# You may want to enable these flags to make setting breakpoints easier.
CFLAGS += -fno-inline -fno-ipa-sra
OPTIMIZATION_FLAGS ?= -Og
else
CFLAGS += -Os -DNDEBUG -ggdb3
CFLAGS += -DNDEBUG -ggdb3
OPTIMIZATION_FLAGS ?= -O2
# TODO: Test with -flto
### CFLAGS += -flto
endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
# TODO: check this

View File

@ -78,7 +78,7 @@ INC += \
CFLAGS += -Os -DNDEBUG
# TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024
#Debugging/Optimization
ifeq ($(DEBUG), 1)
@ -105,9 +105,14 @@ CFLAGS += \
-DCPU_$(CHIP_VARIANT) \
-DDEBUG \
-DIMXRT10XX \
-Os -g3 -Wno-unused-parameter \
-g3 -Wno-unused-parameter \
-ffunction-sections -fdata-sections -fstack-usage
OPTIMIZATION_FLAGS ?= -O2
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
LD_FILES = $(wildcard boards/$(BOARD)/*.ld) $(addprefix linking/, flash/$(FLASH).ld chip_family/$(CHIP_FAMILY).ld common.ld)
LD_SCRIPT_FLAG := -Wl,-T,

View File

@ -15,7 +15,7 @@ endif
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
USB_MSC_MAX_PACKET_SIZE = 512
USB_HIGHSPEED = 1
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -86,12 +86,16 @@ INC += -I../../supervisor/shared/usb
#Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3 -Og
CFLAGS += -ggdb3
OPTIMIZATION_FLAGS = -Og
else
CFLAGS += -Os -DNDEBUG -ggdb3
OPTIMIZATION_FLAGS ?= -O2
CFLAGS += -DNDEBUG -ggdb3
CFLAGS += -flto -flto-partition=none
endif
# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT)

View File

@ -0,0 +1,38 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "boards/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,20 @@
#include "nrfx/hal/nrf_gpio.h"
#define MICROPY_HW_BOARD_NAME "IkigaiSense Vita nRF52840"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_HW_LED_STATUS (&pin_P0_27)
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
#define CIRCUITPY_INTERNAL_NVM_SIZE (4096)
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_P0_08)
#define DEFAULT_I2C_BUS_SDA (&pin_P0_04)
#define DEFAULT_UART_BUS_RX (&pin_P0_24)
#define DEFAULT_UART_BUS_TX (&pin_P0_22)

View File

@ -0,0 +1,8 @@
USB_VID = 0x239A
USB_PID = 0x8094
USB_PRODUCT = "IkigaiSense Vita nRF52840"
USB_MANUFACTURER = "IkigaiSense Technologies LTD"
MCU_CHIP = nrf52840
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -0,0 +1,36 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P1_15) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_MAXTEMP_SCL), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_MAXTEMP_SDA), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_ACC_SCL), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_ACC_SDA), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_ADDON_SCL), MP_ROM_PTR(&pin_P1_09) },
{ MP_ROM_QSTR(MP_QSTR_ADDON_SDA), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_YELLOW_LED), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -30,3 +30,6 @@ SUPEROPT_GC = 0
# These defines must be overridden before mpconfigboard.h is included, which is
# why they are passed on the command line.
CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)'
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -32,3 +32,6 @@ CIRCUITPY_WATCHDOG = 1
# These defines must be overridden before mpconfigboard.h is included, which is
# why they are passed on the command line.
CFLAGS += -DSPIM3_BUFFER_SIZE=0 -DSOFTDEVICE_RAM_SIZE='(32*1024)' -DNRFX_SPIM3_ENABLED=0
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os

View File

@ -85,12 +85,16 @@ ifeq ($(DEBUG), 1)
# You may want to enable these flags to make setting breakpoints easier.
CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -Os -DNDEBUG
CFLAGS += -DNDEBUG
OPTIMIZATION_FLAGS ?= -O2
CFLAGS += -ggdb3
# TODO: Test with -flto
# CFLAGS += -flto
endif
# to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
CFLAGS += $(OPTIMIZATION_FLAGS)
# MCU Series is defined by the HAL package and doesn't need to be specified here
C_DEFS = -D$(MCU_PACKAGE) -DUSE_HAL_DRIVER -DUSE_FULL_LL_DRIVER -D$(MCU_VARIANT)

View File

@ -799,7 +799,7 @@ void supervisor_run_background_tasks_if_tick(void);
#endif
#ifndef CIRCUITPY_PYSTACK_SIZE
#define CIRCUITPY_PYSTACK_SIZE 1024
#define CIRCUITPY_PYSTACK_SIZE 1536
#endif
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"

View File

@ -42,6 +42,10 @@ CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
CIRCUITPY_AUDIOBUSIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO)
# Some boards have PDMIn but do not implement I2SOut.
CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO)
CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT)
CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)

View File

@ -1713,11 +1713,11 @@ STATIC void compile_yield_from(compiler_t *comp) {
#if MICROPY_PY_ASYNC_AWAIT
STATIC bool compile_require_async_context(compiler_t *comp, mp_parse_node_struct_t *pns) {
int scope_flags = comp->scope_cur->scope_flags;
if(scope_flags & MP_SCOPE_FLAG_GENERATOR) {
if(scope_flags & MP_SCOPE_FLAG_ASYNC) {
return true;
}
compile_syntax_error(comp, (mp_parse_node_t)pns,
translate("'async for' or 'async with' outside async function"));
translate("'await', 'async for' or 'async with' outside async function"));
return false;
}
@ -1741,7 +1741,8 @@ STATIC void compile_async_for_stmt(compiler_t *comp, mp_parse_node_struct_t *pns
uint try_finally_label = comp_next_label(comp);
compile_node(comp, pns->nodes[1]); // iterator
compile_await_object_method(comp, MP_QSTR___aiter__);
EMIT_ARG(load_method, MP_QSTR___aiter__, false);
EMIT_ARG(call_method, 0, 0, 0);
compile_store_id(comp, context);
START_BREAK_CONTINUE_BLOCK
@ -2645,6 +2646,7 @@ STATIC void compile_atom_expr_await(compiler_t *comp, mp_parse_node_struct_t *pn
compile_syntax_error(comp, (mp_parse_node_t)pns, translate("'await' outside function"));
return;
}
compile_require_async_context(comp, pns);
compile_atom_expr_normal(comp, pns);
compile_yield_from(comp);
}

View File

@ -107,6 +107,7 @@ endif
ifeq ($(CIRCUITPY_ULAB),1)
SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*.c))
SRC_MOD += $(patsubst $(TOP)/%,%,$(wildcard $(TOP)/extmod/ulab/code/*/*.c))
CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1
$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-float-equal -Wno-sign-compare -DCIRCUITPY
endif

View File

@ -71,7 +71,7 @@
//| ...
//|
//| enabled: bool = ...
//| enabled: bool
//| """State of the BLE adapter."""
//|
STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) {
@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| address: Address = ...
//| address: Address
//| """MAC address of the BLE adapter. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) {
@ -111,7 +111,7 @@ const mp_obj_property_t bleio_adapter_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| name: str = ...
//| name: str
//| """name of the BLE adapter used once connected.
//| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``,
//| to make it easy to distinguish multiple CircuitPython boards."""
@ -135,7 +135,7 @@ const mp_obj_property_t bleio_adapter_name_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def start_advertising(self, data: buf, *, scan_response: buf = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
//| def start_advertising(self, data: ReadableBuffer, *, scan_response: Optional[ReadableBuffer] = None, connectable: bool = True, anonymous: bool = False, timeout: int = 0, interval: float = 0.1) -> None:
//| """Starts advertising until `stop_advertising` is called or if connectable, another device
//| connects to us.
//|
@ -215,7 +215,7 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising);
//| def start_scan(self, prefixes: sequence = b"", *, buffer_size: int = 512, extended: bool = False, timeout: float = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> iterable:
//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]:
//| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are
//| filtered and returned separately.
//|
@ -301,7 +301,7 @@ STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop_scan);
//| advertising: bool = ...
//| advertising: bool
//| """True when the adapter is currently advertising. (read-only)"""
//|
STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) {
@ -317,7 +317,7 @@ const mp_obj_property_t bleio_adapter_advertising_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connected: bool = ...
//| connected: bool
//| """True when the adapter is connected to another device regardless of who initiated the
//| connection. (read-only)"""
//|
@ -334,7 +334,7 @@ const mp_obj_property_t bleio_adapter_connected_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connections: tuple = ...
//| connections: tuple
//| """Tuple of active connections including those initiated through
//| :py:meth:`_bleio.Adapter.connect`. (read-only)"""
//|
@ -350,11 +350,11 @@ const mp_obj_property_t bleio_adapter_connections_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def connect(self, address: Address, *, timeout: float/int) -> Connection:
//| def connect(self, address: Address, *, timeout: float) -> Connection:
//| """Attempts a connection to the device with the given address.
//|
//| :param Address address: The address of the peripheral to connect to
//| :param float/int timeout: Try to connect for timeout seconds."""
//| :param float timeout: Try to connect for timeout seconds."""
//| ...
//|
STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -77,7 +77,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(self);
}
//| address_bytes: bytes = ...
//| address_bytes: bytes
//| """The bytes that make up the device address (read-only).
//|
//| Note that the ``bytes`` object returned is in little-endian order:
@ -108,7 +108,7 @@ const mp_obj_property_t bleio_address_address_bytes_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| type: int = ...
//| type: int
//| """The address type (read-only).
//|
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`,
@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def __eq__(self, other: Any) -> bool:
//| def __eq__(self, other: Address) -> bool:
//| """Two Address objects are equal if their addresses and address types are equal."""
//| ...
//|
@ -187,17 +187,17 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
}
//| PUBLIC: int = ...
//| PUBLIC: int
//| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits)."""
//|
//| RANDOM_STATIC: int = ...
//| RANDOM_STATIC: int
//| """A randomly generated address that does not change often. It may never change or may change after
//| a power cycle."""
//|
//| RANDOM_PRIVATE_RESOLVABLE: int = ...
//| RANDOM_PRIVATE_RESOLVABLE: int
//| """An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK)."""
//|
//| RANDOM_PRIVATE_NON_RESOLVABLE: int = ...
//| RANDOM_PRIVATE_NON_RESOLVABLE: int
//| """A randomly generated address that changes on every connection."""
//|
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {

View File

@ -43,25 +43,25 @@
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {
//| NO_ACCESS: int = ...
//| NO_ACCESS: int
//| """security mode: access not allowed"""
//|
//| OPEN: int = ...
//| OPEN: int
//| """security_mode: no security (link is not encrypted)"""
//|
//| ENCRYPT_NO_MITM: int = ...
//| ENCRYPT_NO_MITM: int
//| """security_mode: unauthenticated encryption, without man-in-the-middle protection"""
//|
//| ENCRYPT_WITH_MITM: int = ...
//| ENCRYPT_WITH_MITM: int
//| """security_mode: authenticated encryption, with man-in-the-middle protection"""
//|
//| LESC_ENCRYPT_WITH_MITM: int = ...
//| LESC_ENCRYPT_WITH_MITM: int
//| """security_mode: LESC encryption, with man-in-the-middle protection"""
//|
//| SIGNED_NO_MITM: int = ...
//| SIGNED_NO_MITM: int
//| """security_mode: unauthenticated data signing, without man-in-the-middle protection"""
//|
//| SIGNED_WITH_MITM: int = ...
//| SIGNED_WITH_MITM: int
//| """security_mode: authenticated data signing, without man-in-the-middle protection"""
//|
{ MP_ROM_QSTR(MP_QSTR_NO_ACCESS), MP_ROM_INT(SECURITY_MODE_NO_ACCESS) },

View File

@ -45,7 +45,7 @@
//| ...
//|
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: buf = None) -> Characteristic:
//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: Optional[ReadableBuffer] = None) -> Characteristic:
//| """Create a new Characteristic object, and add it to this Service.
//|
//| :param Service service: The service that will provide this characteristic
@ -141,7 +141,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj,
//| properties: int = ...
//| properties: int
//| """An int bitmask representing which properties are set, specified as bitwise or'ing of
//| of these possible values.
//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`."""
@ -160,7 +160,7 @@ const mp_obj_property_t bleio_characteristic_properties_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Optional[UUID] = ...
//| uuid: Optional[UUID]
//| """The UUID of this characteristic. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known."""
@ -180,7 +180,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: bytearray = ...
//| value: bytearray
//| """The value of this characteristic."""
//|
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
@ -211,7 +211,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| descriptors: Descriptor = ...
//| descriptors: Descriptor
//| """A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only)"""
//|
STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) {
@ -241,7 +241,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| service: Service = ...
//| service: Service
//| """The Service this Characteristic is a part of."""
//|
STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) {
@ -258,7 +258,7 @@ const mp_obj_property_t bleio_characteristic_service_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| def set_cccd(self, *, notify: bool = False, indicate: float = False) -> None:
//| def set_cccd(self, *, notify: bool = False, indicate: bool = False) -> None:
//| """Set the remote characteristic's CCCD to enable or disable notification and indication.
//|
//| :param bool notify: True if Characteristic should receive notifications of remote writes
@ -291,22 +291,22 @@ STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
// Bitmask constants to represent properties
//| BROADCAST: int = ...
//| BROADCAST: int
//| """property: allowed in advertising packets"""
//|
//| INDICATE: int = ...
//| INDICATE: int
//| """property: server will indicate to the client when the value is set and wait for a response"""
//|
//| NOTIFY: int = ...
//| NOTIFY: int
//| """property: server will notify the client when the value is set"""
//|
//| READ: int = ...
//| READ: int
//| """property: clients may read this characteristic"""
//|
//| WRITE: int = ...
//| WRITE: int
//| """property: clients may write this characteristic; a response will be sent back"""
//|
//| WRITE_NO_RESPONSE: int = ...
//| WRITE_NO_RESPONSE: int
//| """property: clients may write this characteristic; no response will be sent back"""
//|
{ MP_ROM_QSTR(MP_QSTR_BROADCAST), MP_ROM_INT(CHAR_PROP_BROADCAST) },

View File

@ -100,7 +100,7 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
// These are standard stream methods. Code is in py/stream.c.
//
//| def read(self, nbytes: int = None) -> Optional[bytes]:
//| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
//| """Read characters. If ``nbytes`` is specified then read at most that many
//| bytes. Otherwise, read everything that arrives until the connection
//| times out. Providing the number of bytes expected is highly recommended
@ -167,7 +167,7 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r
return ret;
}
//| in_waiting: int = ...
//| in_waiting: int
//| """The number of bytes in the input buffer, available to be read"""
//|
STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) {

View File

@ -71,11 +71,11 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
//| def __init__(self) -> None:
//| """Connections cannot be made directly. Instead, to initiate a connection use `Adapter.connect`.
//| Connections may also be made when another device initiates a connection. To use a Connection
//| created by a peer, read the `Adapter.connections` property.
//| created by a peer, read the `Adapter.connections` property."""
//| ...
//|
//| def disconnect(self) -> Any:
//| ""Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| def disconnect(self) -> None:
//| """Disconnects from the remote peripheral. Does nothing if already disconnected."""
//| ...
//|
STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) {
@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair);
//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service:
//| def discover_remote_services(self, service_uuids_whitelist: Optional[Iterable[UUID]] = None) -> Tuple[Service, ...]:
//| """Do BLE discovery for all services or for the given service UUIDS,
//| to find their handles and characteristics, and return the discovered services.
//| `Connection.connected` must be True.
@ -152,7 +152,7 @@ STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, cons
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, 1, bleio_connection_discover_remote_services);
//| connected: bool = ...
//| connected: bool
//| """True if connected to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) {
@ -170,7 +170,7 @@ const mp_obj_property_t bleio_connection_connected_obj = {
};
//| paired: bool = ...
//| paired: bool
//| """True if paired to the remote peer."""
//|
STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) {
@ -188,7 +188,7 @@ const mp_obj_property_t bleio_connection_paired_obj = {
};
//| connection_interval: float = ...
//| connection_interval: float
//| """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers
//| increase speed and decrease latency but increase power consumption.
//|
@ -206,7 +206,7 @@ STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_get_connection_interval_obj, bleio_connection_get_connection_interval);
//| attribute: int = ...
//| attribute: int
//| """The maximum number of data bytes that can be sent in a single transmission,
//| not including overhead bytes.
//|

View File

@ -43,27 +43,27 @@
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
//| and attached to a Characteristic by calling `add_to_characteristic()`.
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
//| as part of remote Characteristics in the remote Services that are discovered.
//| as part of remote Characteristics in the remote Services that are discovered."""
//|
//| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'')
//| @classmethod
//| def add_to_characteristic(characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor:
//| """Create a new Descriptor object, and add it to this Service.
//|
//| Create a new Descriptor object, and add it to this Service.
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
//| :param UUID uuid: The uuid of the descriptor
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
//| security mode is required. Values allowed are the same as ``read_perm``.
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the descriptor value is of fixed length.
//| :param buf initial_value: The initial value for this descriptor.
//|
//| :param Characteristic characteristic: The characteristic that will hold this descriptor
//| :param UUID uuid: The uuid of the descriptor
//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
//| security mode is required. Values allowed are the same as ``read_perm``.
//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
//| number of data bytes that fit in a single BLE 4.x ATT packet.
//| :param bool fixed_length: True if the descriptor value is of fixed length.
//| :param buf initial_value: The initial value for this descriptor.
//|
//| :return: the new Descriptor."""
//| :return: the new Descriptor."""
//| ...
//|
STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic);
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj));
//| uuid: UUID = ...
//| uuid: UUID
//| """The descriptor uuid. (read-only)"""
//|
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| characteristic: Characteristic = ...
//| characteristic: Characteristic
//| """The Characteristic this Descriptor is a part of."""
//|
STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) {
@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| value: WriteableBuffer = ...
//| value: bytearray
//| """The value of this descriptor."""
//|
STATIC mp_obj_t bleio_descriptor_get_value(mp_obj_t self_in) {

View File

@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto);
//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int:
//| def write(self, data: ReadableBuffer, *, header: Optional[bytes] = None) -> int:
//| """Writes all bytes from data into the same outgoing packet. The bytes from header are included
//| before data when the pending packet is currently empty.
//|
@ -179,12 +179,12 @@ STATIC mp_obj_t bleio_packet_buffer_deinit(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_buffer_deinit);
//| packet_size: int = ...
//| packet_size: int
//| """`packet_size` is the same as `incoming_packet_length`.
//| The name `packet_size` is deprecated and
//| will be removed in CircuitPython 6.0.0."""
//|
//| incoming_packet_length: int = ...
//| incoming_packet_length: int
//| """Maximum length in bytes of a packet we are reading."""
//|
STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) {
@ -205,7 +205,7 @@ const mp_obj_property_t bleio_packet_buffer_incoming_packet_length_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| outgoing_packet_length: int = ...
//| outgoing_packet_length: int
//| """Maximum length in bytes of a packet we are writing."""
//|
STATIC mp_obj_t bleio_packet_buffer_get_outgoing_packet_length(mp_obj_t self_in) {

View File

@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches);
//| address: Address = ...
//| address: Address
//| """The address of the device (read-only), of type `_bleio.Address`."""
//|
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
@ -86,7 +86,7 @@ const mp_obj_property_t bleio_scanentry_address_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| advertisement_bytes: bytes = ...
//| advertisement_bytes: bytes
//| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) {
@ -102,7 +102,7 @@ const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| rssi: int = ...
//| rssi: int
//| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) {
@ -118,7 +118,7 @@ const mp_obj_property_t bleio_scanentry_rssi_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| connectable: bool = ...
//| connectable: bool
//| """True if the device can be connected to. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) {
@ -134,7 +134,7 @@ const mp_obj_property_t bleio_scanentry_connectable_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| scan_response: bool = ...
//| scan_response: bool
//| """True if the entry was a scan response. (read-only)"""
//|
STATIC mp_obj_t scanentry_get_scan_response(mp_obj_t self_in) {

View File

@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args,
return MP_OBJ_FROM_PTR(service);
}
//| characteristics: Tuple[Characteristic, ...] = ...
//| characteristics: Tuple[Characteristic, ...]
//| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by
//| this service. (read-only)"""
//|
@ -92,7 +92,7 @@ const mp_obj_property_t bleio_service_characteristics_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| remote: bool = ...
//| remote: bool
//| """True if this is a service provided by a remote device. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) {
@ -109,7 +109,7 @@ const mp_obj_property_t bleio_service_remote_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| secondary: bool = ...
//| secondary: bool
//| """True if this is a secondary service. (read-only)"""
//|
STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) {
@ -126,7 +126,7 @@ const mp_obj_property_t bleio_service_secondary_obj = {
(mp_obj_t)&mp_const_none_obj },
};
//| uuid: Optional[UUID] = ...
//| uuid: Optional[UUID]
//| """The UUID of this service. (read-only)
//|
//| Will be ``None`` if the 128-bit UUID for this service is not known."""

View File

@ -120,7 +120,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co
return MP_OBJ_FROM_PTR(self);
}
//| uuid16: int = ...
//| uuid16: int
//| """The 16-bit part of the UUID. (read-only)
//|
//| :type: int"""
@ -139,7 +139,7 @@ const mp_obj_property_t bleio_uuid_uuid16_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| uuid128: bytes = ...
//| uuid128: bytes
//| """The 128-bit value of the UUID
//| Raises AttributeError if this is a 16-bit UUID. (read-only)
//|
@ -165,7 +165,7 @@ const mp_obj_property_t bleio_uuid_uuid128_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| size: int = ...
//| size: int
//| """128 if this UUID represents a 128-bit vendor-specific UUID. 16 if this UUID represents a
//| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported.
//|
@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __eq__(self, other: Any) -> bool:
//| def __eq__(self, other: UUID) -> bool:
//| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit."""
//| ...
//|

View File

@ -70,7 +70,7 @@ STATIC mp_obj_t _flush(mp_obj_t self) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush);
//| def cc(self, b: bytes) -> None:
//| def cc(self, b: ReadableBuffer) -> None:
//| """Append bytes to the command FIFO.
//|
//| :param bytes b: The bytes to add"""

View File

@ -45,8 +45,31 @@
//| used internally by it. All user-visible interactions are done through
//| that library."""
//|
//| def __init__(self, buffer: ReadableBuffer, rows: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], cols: List[DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut, DigitalInOut], buttons: DigitalInOut) -> None:
//| def __init__(
//| self,
//| buffer: ReadableBuffer,
//| rows: List[
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| ],
//| cols: List[
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| digitalio.DigitalInOut,
//| ],
//| buttons: digitalio.DigitalInOut,
//| ) -> None:
//| """Initializes matrix scanning routines.
//|
//| The ``buffer`` is a 64 byte long ``bytearray`` that stores what should

View File

@ -47,7 +47,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
//| class PixelBuf:
//| """A fast RGB[W] pixel buffer for LED and similar devices."""
//|
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: bytes = b"", trailer: bytes = b"") -> None:
//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: ReadableBuffer = b"", trailer: ReadableBuffer = b"") -> None:
//| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -152,7 +152,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t
}
}
//| bpp: int = ...
//| bpp: int
//| """The number of bytes per pixel in the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
};
//| brightness: float = ...
//| brightness: float
//| """Float value between 0 and 1. Output brightness.
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
@ -199,7 +199,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_write: bool = ...
//| auto_write: bool
//| """Whether to automatically write the pixels after each update."""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
@ -221,7 +221,7 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| byteorder: string = ...
//| byteorder: str
//| """byteorder string for the buffer (read-only)"""
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
@ -257,7 +257,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
//| def fill(color: Union[int, Tuple[int, int, int]]) -> None:
//| def fill(self, color: Union[int, Tuple[int, int, int]]) -> None:
//| """Fills the given pixelbuf with the given color."""
//| ...
//|
@ -269,13 +269,19 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
//| def __getitem__(self, index: int) -> Tuple[int, int, int, Union[int, float]]:
//| @overload
//| def __getitem__(self, index: slice) -> Tuple[Tuple, ...]: ...
//| def __getitem__(self, index: int) -> Tuple:
//| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
//| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel
//| intensity from 0-1.0."""
//| ...
//|
//| def __setitem__(self, index: int, value: Union[int, Tuple[int, int, int, Union[int, float]]]) -> PixelBuf:
//| @overload
//| def __setitem__(self, index: slice, value: Tuple[Union[int, Tuple, List], ...]) -> None: ...
//| @overload
//| def __setitem__(self, index: slice, value: List[Union[int, Tuple, List]]) -> None: ...
//| def __setitem__(self, index: int, value: Union[int, Tuple, List]) -> None:
//| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are
//| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the
//| red, green and blue values are packed into the lower three bytes (0xRRGGBB).

View File

@ -41,12 +41,12 @@
//| Byteorders are configured with strings, such as "RGB" or "RGBD"."""
// TODO: Pull in docs from pypixelbuf.
//| def colorwheel(n: int) -> int:
//| def colorwheel(n: float) -> int:
//| """C implementation of the common wheel() function found in many examples.
//| Returns the colorwheel RGB value as an integer value for n (usable in :py:class:`PixelBuf`, neopixel, and dotstar)."""
//| ...
//|
//| def wheel(n: Any) -> Any:
//| def wheel(n: float) -> int:
//| """Use of wheel() is deprecated. Please use colorwheel()."""
//|

View File

@ -33,7 +33,7 @@
//| class Layer:
//| """Keep information about a single layer of graphics"""
//|
//| def __init__(self, width: int, height: int, graphic: bytearray, palette: bytearray, grid: bytearray) -> None:
//| def __init__(self, width: int, height: int, graphic: ReadableBuffer, palette: ReadableBuffer, grid: ReadableBuffer) -> None:
//| """Keep internal information about a layer of graphics (either a
//| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -33,7 +33,7 @@
//| class Text:
//| """Keep information about a single grid of text"""
//|
//| def __init__(self, width: int, height: int, font: bytearray, palette: bytearray, chars: bytearray) -> None:
//| def __init__(self, width: int, height: int, font: ReadableBuffer, palette: ReadableBuffer, chars: ReadableBuffer) -> None:
//| """Keep internal information about a grid of text
//| in a format suitable for fast rendering
//| with the ``render()`` function.

View File

@ -39,7 +39,7 @@
//| The `_stage` module contains native code to speed-up the ```stage`` Library
//| <https://github.com/python-ugame/circuitpython-stage>`_."""
//|
//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: bytearray, display: displayio.Display, scale: int, background: int) -> Any:
//| def render(x0: int, y0: int, x1: int, y1: int, layers: list, buffer: WriteableBuffer, display: displayio.Display, scale: int, background: int) -> None:
//| """Render and send to the display a fragment of the screen.
//|
//| :param int x0: Left edge of the fragment.

View File

@ -12,7 +12,7 @@
//| class AES:
//| """Encrypt and decrypt AES streams"""
//|
//| def __init__(self, key: Optional[ReadableBuffer], mode: int=0, iv: ReadableBuffer=None, segment_size: int=8) -> None:
//| def __init__(self, key: ReadableBuffer, mode: int = 0, iv: Optional[ReadableBuffer] = None, segment_size: int = 8) -> None:
//| """Create a new AES state with the given key.
//|
//| :param bytearray key: A 16-, 24-, or 32-byte key
@ -152,7 +152,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length,
}
}
//| def encrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| def encrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| """Encrypt the buffer from ``src`` into ``dest``.
//|
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
@ -183,8 +183,7 @@ STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src,
STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj,
aesio_aes_encrypt_into);
//| def decrypt_into(src: ReadableBuffer, dest: WriteableBuffer) -> None:
//|
//| def decrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None:
//| """Decrypt the buffer from ``src`` into ``dest``.
//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the
//| buffers must be a multiple of 16 bytes, and must be equal length. For

View File

@ -104,7 +104,7 @@ STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, analogio_analogin___exit__);
//| value: int = ...
//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (read-only)
//|
//| Even if the underlying analog to digital converter (ADC) is lower
@ -124,7 +124,7 @@ const mp_obj_property_t analogio_analogin_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| reference_voltage: Optional[float] = ...
//| reference_voltage: Optional[float]
//| """The maximum voltage measurable (also known as the reference voltage) as a
//| `float` in Volts."""
//|

View File

@ -97,7 +97,7 @@ STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args)
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogout___exit___obj, 4, 4, analogio_analogout___exit__);
//| value: int = ...
//| value: int
//| """The value on the analog pin between 0 and 65535 inclusive (16-bit). (write-only)
//|
//| Even if the underlying digital to analog converter (DAC) is lower

View File

@ -91,6 +91,10 @@
//| ...
//|
STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
#if !CIRCUITPY_AUDIOBUSIO_I2SOUT
mp_raise_NotImplementedError(translate("I2SOut not available"));
return NULL; // Not reachable.
#else
enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_left_justified };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bit_clock, MP_ARG_OBJ | MP_ARG_REQUIRED },
@ -110,8 +114,11 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
common_hal_audiobusio_i2sout_construct(self, bit_clock, word_select, data, args[ARG_left_justified].u_bool);
return MP_OBJ_FROM_PTR(self);
#endif
}
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
//| def deinit(self) -> None:
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
//| ...
@ -120,6 +127,7 @@ STATIC mp_obj_t audiobusio_i2sout_deinit(mp_obj_t self_in) {
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiobusio_i2sout_deinit(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_deinit_obj, audiobusio_i2sout_deinit);
@ -147,7 +155,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *ar
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, audiobusio_i2sout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -186,7 +194,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when the audio sample is being output. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) {
@ -235,7 +243,7 @@ STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_resume_obj, audiobusio_i2sout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiobusio_i2sout_obj_get_paused(mp_obj_t self_in) {
@ -251,9 +259,11 @@ const mp_obj_property_t audiobusio_i2sout_paused_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
STATIC const mp_rom_map_elem_t audiobusio_i2sout_locals_dict_table[] = {
// Methods
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
@ -266,6 +276,7 @@ STATIC const mp_rom_map_elem_t audiobusio_i2sout_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audiobusio_i2sout_playing_obj) },
{ MP_ROM_QSTR(MP_QSTR_paused), MP_ROM_PTR(&audiobusio_i2sout_paused_obj) },
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
};
STATIC MP_DEFINE_CONST_DICT(audiobusio_i2sout_locals_dict, audiobusio_i2sout_locals_dict_table);

View File

@ -32,6 +32,9 @@
extern const mp_obj_type_t audiobusio_i2sout_type;
// Some boards don't have the I2SOut pins available.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select, const mcu_pin_obj_t* data,
bool left_justified);
@ -45,4 +48,6 @@ void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self);
void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self);
bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self);
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOBUSIO_I2SOUT_H

View File

@ -210,7 +210,7 @@ STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destinat
}
MP_DEFINE_CONST_FUN_OBJ_3(audiobusio_pdmin_record_obj, audiobusio_pdmin_obj_record);
//| sample_rate: int = ...
//| sample_rate: int
//| """The actual sample_rate of the recording. This may not match the constructed
//| sample rate due to internal clock limitations."""
//|

View File

@ -38,13 +38,13 @@
//| class RawSample:
//| """A raw audio sample buffer in memory"""
//|
//| def __init__(self, buffer: array.array, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| def __init__(self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000) -> None:
//| """Create a RawSample based on the given buffer of signed values. If channel_count is more than
//| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the
//| first sample will be for channel 1, the second sample will be for channel two, the third for
//| channel 1 and so on.
//|
//| :param array.array buffer: An `array.array` with samples
//| :param ReadableBuffer buffer: A buffer with samples
//| :param int channel_count: The number of channels in the buffer
//| :param int sample_rate: The desired playback sample rate
//|
@ -136,7 +136,7 @@ STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *ar
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_rawsample___exit___obj, 4, 4, audioio_rawsample_obj___exit__);
//| sample_rate: Optional(int) = ...
//| sample_rate: Optional[int]
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).
//| When the sample is looped, this can change the pitch output without changing the underlying
//| sample. This will not change the sample rate of any active playback. Call ``play`` again to

View File

@ -125,7 +125,7 @@ STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, audioio_wavefile_obj___exit__);
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -152,7 +152,7 @@ const mp_obj_property_t audioio_wavefile_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: int = ...
//| bits_per_sample: int
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -168,7 +168,7 @@ const mp_obj_property_t audioio_wavefile_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: int = ...
//| channel_count: int
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audioio_wavefile_obj_get_channel_count(mp_obj_t self_in) {

View File

@ -38,6 +38,13 @@
//| """Support for audio samples"""
//|
//| _AudioSample = Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer, audiomp3.MP3Decoder]
//| """An audio sample for playback with `audioio.AudioOut`, `audiobusio.I2SOut` or `audiopwmio.PWMAudioOut`.
//|
//| Supported sources are :py:class:`audiocore.WaveFile`, :py:class:`audiocore.RawSample`,
//| :py:class:`audiomixer.Mixer` and :py:class:`audiomp3.MP3Decoder`."""
//|
STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) },
{ MP_ROM_QSTR(MP_QSTR_RawSample), MP_ROM_PTR(&audioio_rawsample_type) },

View File

@ -39,7 +39,7 @@
//| class AudioOut:
//| """Output an analog audio signal"""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None:
//| """Create a AudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s).
//|
@ -146,7 +146,7 @@ STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *arg
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, audioio_audioout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -187,7 +187,7 @@ STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) {
@ -236,7 +236,7 @@ STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_resume_obj, audioio_audioout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audioio_audioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -156,7 +156,7 @@ STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, audiomixer_mixer_obj___exit__);
//| playing: bool = ...
//| playing: bool
//| """True when any voice is being output. (read-only)"""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) {
@ -173,7 +173,7 @@ const mp_obj_property_t audiomixer_mixer_playing_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second)."""
//|
STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) {
@ -190,7 +190,7 @@ const mp_obj_property_t audiomixer_mixer_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| voice: Tuple[MixerVoice, ...] = ...
//| voice: Tuple[MixerVoice, ...]
//| """A tuple of the mixer's `audiomixer.MixerVoice` object(s).
//|
//| .. code-block:: python
@ -211,7 +211,7 @@ const mp_obj_property_t audiomixer_mixer_voice_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def play(self, sample: Union[audiomixer.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, voice: int = 0, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, voice: int = 0, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|

View File

@ -56,7 +56,7 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(self);
}
//| def play(self, sample: Union[audiocore.WaveFile, Mixer, audiocore.RawSample], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when ``loop=False``, and continuously when ``loop=True``.
//| Does not block. Use `playing` to block.
//|
@ -100,7 +100,7 @@ STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *po
}
MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervoice_obj_stop);
//| level: float = ...
//| level: float
//| """The volume level of a voice, as a floating point number between 0 and 1."""
//|
STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) {
@ -136,7 +136,7 @@ const mp_obj_property_t audiomixer_mixervoice_level_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| playing: bool = ...
//| playing: bool
//| """True when this voice is being output. (read-only)"""
//|

View File

@ -34,7 +34,7 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| class MP3:
//| class MP3Decoder:
//| """Load a mp3 file for audio playback"""
//|
//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None:
@ -124,7 +124,7 @@ STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *arg
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, audiomp3_mp3file_obj___exit__);
//| file: file = ...
//| file: file
//| """File to play back."""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
@ -154,7 +154,7 @@ const mp_obj_property_t audiomp3_mp3file_file_obj = {
//| sample_rate: int = ...
//| sample_rate: int
//| """32 bit value that dictates how quickly samples are loaded into the DAC
//| in Hertz (cycles per second). When the sample is looped, this can change
//| the pitch output without changing the underlying sample."""
@ -181,7 +181,7 @@ const mp_obj_property_t audiomp3_mp3file_sample_rate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bits_per_sample: int = ...
//| bits_per_sample: int
//| """Bits per sample. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) {
@ -198,7 +198,7 @@ const mp_obj_property_t audiomp3_mp3file_bits_per_sample_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| channel_count: int = ...
//| channel_count: int
//| """Number of audio channels. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) {
@ -215,7 +215,7 @@ const mp_obj_property_t audiomp3_mp3file_channel_count_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rms_level: float = ...
//| rms_level: float
//| """The RMS audio level of a recently played moment of audio. (read only)"""
//|
STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) {

View File

@ -39,7 +39,7 @@
//| class PWMAudioOut:
//| """Output an analog audio signal by varying the PWM duty cycle."""
//|
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: microcontroller.Pin = None, quiescent_value: int = 0x8000) -> None:
//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None:
//| """Create a PWMAudioOut object associated with the given pin(s). This allows you to
//| play audio signals out on the given pin(s). In contrast to mod:`audioio`,
//| the pin(s) specified are digital pins, and are driven with a device-dependent PWM
@ -148,7 +148,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj___exit__(size_t n_args, const mp_obj_
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, 4, 4, audiopwmio_pwmaudioout_obj___exit__);
//| def play(self, sample: Union[audiocore.WaveFile, audiocore.RawSample, audiomixer.Mixer], *, loop: bool = False) -> None:
//| def play(self, sample: audiocore._AudioSample, *, loop: bool = False) -> None:
//| """Plays the sample once when loop=False and continuously when loop=True.
//| Does not block. Use `playing` to block.
//|
@ -189,7 +189,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioout_obj_stop);
//| playing: bool = ...
//| playing: bool
//| """True when an audio sample is being output even if `paused`. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) {
@ -238,7 +238,7 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_resume_obj, audiopwmio_pwmaudioout_obj_resume);
//| paused: bool = ...
//| paused: bool
//| """True when playback is paused. (read-only)"""
//|
STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_paused(mp_obj_t self_in) {

View File

@ -40,7 +40,7 @@
//| class I2C:
//| """Two wire serial protocol"""
//|
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int) -> None:
//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None:
//| """I2C is a two-wire protocol for communicating between devices. At the
//| physical level it consists of 2 wires: SCL and SDA, the clock and data
//| lines respectively.
@ -165,7 +165,7 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock);
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
@ -217,7 +217,7 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a
}
MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into);
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a
//| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start
//| before a read.
@ -274,7 +274,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);
//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| def writeto_then_readfrom(self, address: int, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.

View File

@ -51,7 +51,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None:
//| """Construct an SPI object on the given pins.
//|
//| .. seealso:: Using this class directly requires careful lock management.
@ -248,7 +248,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *args) {
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitbangio_spi_readinto_obj, 2, 2, bitbangio_spi_readinto);
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``.
//| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]``
//| must be equal.

View File

@ -126,13 +126,12 @@ static void check_lock(busio_i2c_obj_t *self) {
}
//| def scan(self) -> list:
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
//| list of those that respond.
//|
//| """Scan all I2C addresses between 0x08 and 0x77 inclusive and return a
//| list of those that respond.
//|
//| :return: List of device ids on the I2C bus
//| :rtype: list"""
//| ...
//| :return: List of device ids on the I2C bus
//| :rtype: list"""
//| ...
//|
STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) {
busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in);
@ -176,20 +175,20 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock);
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None) -> None:
//| """Read into ``buffer`` from the device selected by ``address``.
//| The number of bytes read will be the length of ``buffer``.
//| At least one byte must be read.
//|
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buf[start:end]`` will so it saves memory.
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buf[start:end]`` will so it saves memory.
//|
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer to write into
//| :param int start: Index to start writing at
//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer to write into
//| :param int start: Index to start writing at
//| :param int end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
// Shared arg parsing for readfrom_into and writeto_then_readfrom.
STATIC void readfrom(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) {
@ -228,22 +227,22 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args,
}
MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into);
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and
//| then transmit a stop bit.
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, stop: bool = True) -> None:
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and
//| then transmit a stop bit.
//|
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buffer[start:end]`` will so it saves memory.
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like
//| ``buffer[start:end]`` will so it saves memory.
//|
//| Writing a buffer or slice of length zero is permitted, as it can be used
//| to poll for the existence of a device.
//| to poll for the existence of a device.
//|
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray buffer: buffer containing the bytes to write
//| :param int start: Index to start writing from
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
// Shared arg parsing for writeto and writeto_then_readfrom.
STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) {
@ -282,23 +281,23 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);
//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = None, in_start: int = 0, in_end: int = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.
//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None:
//| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop
//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and
//| ``in_buffer`` can be the same buffer because they are used sequentially.
//|
//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]``
//| will so it saves memory.
//| if ``start`` or ``end`` is provided, then the corresponding buffer will be sliced
//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]``
//| will so it saves memory.
//|
//| :param int address: 7-bit device address
//| :param bytearray out_buffer: buffer containing the bytes to write
//| :param bytearray in_buffer: buffer to write into
//| :param int out_start: Index to start writing from
//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)``
//| :param int in_start: Index to start writing at
//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//| :param int address: 7-bit device address
//| :param bytearray out_buffer: buffer containing the bytes to write
//| :param bytearray in_buffer: buffer to write into
//| :param int out_start: Index to start writing from
//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)``
//| :param int in_start: Index to start writing at
//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)``"""
//| ...
//|
STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end };

View File

@ -53,7 +53,7 @@
//| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines
//| and therefore the hardware.)"""
//|
//| def __init__(self, clock: microcontroller.Pin, MOSI: microcontroller.Pin = None, MISO: microcontroller.Pin = None) -> None:
//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None:
//|
//| """Construct an SPI object on the given pins.
//|
@ -153,7 +153,7 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) {
//| or second (1). Rising or falling depends on clock polarity.
//| :param int bits: the number of bits per word
//|
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
//| .. note:: On the SAMD21, it is possible to set the baudrate to 24 MHz, but that
//| speed is not guaranteed to work. 12 MHz is the next available lower speed, and is
//| within spec for the SAMD21.
//|
@ -270,7 +270,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 2, busio_spi_write);
//| def readinto(self, buffer: bytearray, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None:
//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, write_value: int = 0) -> None:
//| """Read into ``buffer`` while writing ``write_value`` for each byte read.
//| The SPI object must be locked.
//| If the number of bytes to read is 0, nothing happens.
@ -377,7 +377,7 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args
}
MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_readinto_obj, 2, busio_spi_write_readinto);
//| frequency: int = ...
//| frequency: int
//| """The actual SPI bus frequency. This may not match the frequency requested
//| due to internal limitations."""
//|

View File

@ -44,7 +44,7 @@
//| class UART:
//| """A bidirectional serial protocol"""
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Parity = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None:
//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Optional[Parity] = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None:
//| """A common bidirectional serial protocol that uses an an agreed upon speed
//| rather than a shared clock line.
//|
@ -263,7 +263,7 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t
return ret;
}
//| baudrate: int = ...
//| baudrate: int
//| """The current baudrate."""
//|
STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) {
@ -289,7 +289,7 @@ const mp_obj_property_t busio_uart_baudrate_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| in_waiting: int = ...
//| in_waiting: int
//| """The number of bytes in the input buffer, available to be read"""
//|
STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) {
@ -306,7 +306,7 @@ const mp_obj_property_t busio_uart_in_waiting_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| timeout: float = ...
//| timeout: float
//| """The current timeout, in seconds (float)."""
//|
STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
@ -349,10 +349,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_o
//| class Parity:
//| """Enum-like class to define the parity used to verify correct data transfer."""
//|
//| ODD: int = ...
//| ODD: int
//| """Total number of ones should be odd."""
//|
//| EVEN: int = ...
//| EVEN: int
//| """Total number of ones should be even."""
//|
const mp_obj_type_t busio_uart_parity_type;

View File

@ -53,7 +53,7 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg
return MP_OBJ_FROM_PTR(self);
}
//| def deinit(self):
//| def deinit(self) -> None:
//| """Deinitializes the Counter and releases any hardware resources for reuse."""
//|
STATIC mp_obj_t countio_counter_deinit(mp_obj_t self_in) {
@ -69,12 +69,12 @@ STATIC void check_for_deinit(countio_counter_obj_t *self) {
}
}
//| def __enter__(self):
//| def __enter__(self) -> Counter:
//| """No-op used by Context Managers."""
//|
// Provided by context manager helper.
//| def __exit__(self):
//| def __exit__(self) -> None:
//| """Automatically deinitializes the hardware when exiting a context. See
//| :ref:`lifetime-and-contextmanagers` for more info."""
//|
@ -86,7 +86,7 @@ STATIC mp_obj_t countio_counter_obj___exit__(size_t n_args, const mp_obj_t *args
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(countio_counter___exit___obj, 4, 4, countio_counter_obj___exit__);
//| count: int = ...
//| count: int
//| """The current count in terms of pulses."""
//|
STATIC mp_obj_t countio_counter_obj_get_count(mp_obj_t self_in) {
@ -113,7 +113,7 @@ const mp_obj_property_t countio_counter_count_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| def reset(self):
//| def reset(self) -> None:
//| """Resets the count back to 0."""
//|
STATIC mp_obj_t countio_counter_reset(mp_obj_t self_in){

View File

@ -106,14 +106,14 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) {
}
}
//| def switch_to_output(self, value: bool = False, drive_mode: digitalio.DriveMode = digitalio.DriveMode.PUSH_PULL) -> None:
//| """Set the drive mode and value and then switch to writing out digital
//| values.
//| def switch_to_output(self, value: bool = False, drive_mode: DriveMode = DriveMode.PUSH_PULL) -> None:
//| """Set the drive mode and value and then switch to writing out digital
//| values.
//|
//| :param bool value: default value to set upon switching
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output
//| """
//| ...
//| :param bool value: default value to set upon switching
//| :param ~digitalio.DriveMode drive_mode: drive mode for the output
//| """
//| ...
//|
STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_value, ARG_drive_mode };
@ -139,7 +139,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digitalio_digitalinout_switch_to_output);
//| def switch_to_input(self, pull: Pull = None) -> None:
//| def switch_to_input(self, pull: Optional[Pull] = None) -> None:
//| """Set the pull and then switch to read in digital values.
//|
//| :param Pull pull: pull configuration for the input
@ -179,7 +179,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o
}
MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digitalio_digitalinout_switch_to_input);
//| direction: Direction = ...
//| direction: Direction
//| """The direction of the pin.
//|
//| Setting this will use the defaults from the corresponding
@ -228,7 +228,7 @@ const mp_obj_property_t digitalio_digitalio_direction_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| value: Bool = ...
//| value: bool
//| """The digital logic level of the pin."""
//|
STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) {
@ -258,7 +258,7 @@ const mp_obj_property_t digitalio_digitalinout_value_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| drive_mode: DriveMode = ...
//| drive_mode: DriveMode
//| """The pin drive mode. One of:
//|
//| - `digitalio.DriveMode.PUSH_PULL`
@ -302,7 +302,7 @@ const mp_obj_property_t digitalio_digitalio_drive_mode_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| pull: Optional[Pull] = ...
//| pull: Optional[Pull]
//| """The pin pull direction. One of:
//|
//| - `digitalio.Pull.UP`

View File

@ -46,10 +46,10 @@
//| going."""
//| ...
//|
//| INPUT: Direction = ...
//| INPUT: Direction
//| """Read digital data in"""
//|
//| OUTPUT: Direction = ...
//| OUTPUT: Direction
//| """Write digital data out"""
//|
const mp_obj_type_t digitalio_direction_type;

View File

@ -34,10 +34,10 @@
//| digital values."""
//| ...
//|
//| PUSH_PULL: DriveMode = ...
//| PUSH_PULL: DriveMode
//| """Output both high and low digital values"""
//|
//| OPEN_DRAIN: DriveMode = ...
//| OPEN_DRAIN: DriveMode
//| """Output low digital values but go into high z for digital high. This is
//| useful for i2c and other protocols that share a digital line."""
//|

View File

@ -34,11 +34,11 @@
//| digital values in."""
//| ...
//|
//| UP: Pull = ...
//| UP: Pull
//| """When the input line isn't being driven the pull up can pull the state
//| of the line high so it reads as true."""
//|
//| DOWN: Pull = ...
//| DOWN: Pull
//| """When the input line isn't being driven the pull down can pull the
//| state of the line low so it reads as false."""
//|

View File

@ -73,7 +73,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar
return MP_OBJ_FROM_PTR(self);
}
//| width: int = ...
//| width: int
//| """Width of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) {
@ -91,7 +91,7 @@ const mp_obj_property_t displayio_bitmap_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Height of the bitmap. (read only)"""
//|
STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) {
@ -163,8 +163,8 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
// load
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_bitmap_get_pixel(self, x, y));
} else {
mp_int_t value = mp_obj_get_int(value_obj);
if (value >= 1 << common_hal_displayio_bitmap_get_bits_per_value(self)) {
mp_uint_t value = (mp_uint_t)mp_obj_get_int(value_obj);
if ((value >> common_hal_displayio_bitmap_get_bits_per_value(self)) != 0) {
mp_raise_ValueError(translate("pixel value requires too many bits"));
}
common_hal_displayio_bitmap_set_pixel(self, x, y, value);
@ -179,8 +179,8 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
STATIC mp_obj_t displayio_bitmap_obj_fill(mp_obj_t self_in, mp_obj_t value_obj) {
displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in);
mp_int_t value = mp_obj_get_int(value_obj);
if (value >= 1 << common_hal_displayio_bitmap_get_bits_per_value(self)) {
mp_uint_t value = (mp_uint_t)mp_obj_get_int(value_obj);
if ((value >> common_hal_displayio_bitmap_get_bits_per_value(self)) != 0) {
mp_raise_ValueError(translate("pixel value requires too many bits"));
}
common_hal_displayio_bitmap_fill(self, value);

View File

@ -84,7 +84,7 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert);
//| dither: bool = ...
//| dither: bool
//| """When true the color converter dithers the output by adding random noise when
//| truncating to display bitdepth"""
//|

View File

@ -39,6 +39,11 @@
#include "shared-module/displayio/__init__.h"
#include "supervisor/shared/translate.h"
//| _DisplayBus = Union[FourWire, ParallelBus, I2CDisplay]
//| """:py:class:`FourWire`, :py:class:`ParallelBus` or :py:class:`I2CDisplay`"""
//|
//|
//| class Display:
//| """Manage updating a display over a display bus
//|
@ -49,8 +54,8 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the initialization sequence at minimum."""
//|
//| def __init__(self, display_bus: displayio, init_sequence: buffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: int = None, brightness: bool = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
//| r"""Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//| def __init__(self, display_bus: _DisplayBus, init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, set_vertical_scroll: int = 0, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: Optional[int] = None, brightness: float = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60) -> None:
//| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`).
//|
//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a
//| command byte followed by a byte to determine the parameter count and if a delay is need after.
@ -76,7 +81,7 @@
//| of the display to minimize tearing artifacts.
//|
//| :param display_bus: The bus that the display is connected to
//| :type display_bus: displayio.FourWire or displayio.ParallelBus
//| :type display_bus: FourWire, ParallelBus or I2CDisplay
//| :param buffer init_sequence: Byte-packed initialization sequence.
//| :param int width: Width in pixels
//| :param int height: Height in pixels
@ -96,7 +101,7 @@
//| :param int set_vertical_scroll: Command used to set the first row to show
//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight
//| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers.
//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True.
//| :param float brightness: Initial display brightness. This value is ignored if auto_brightness is True.
//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism.
//| :param bool single_byte_bounds: Display column and row commands use single bytes
//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this.
@ -245,7 +250,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
}
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh);
//| auto_refresh: None = ...
//| auto_refresh: bool
//| """True when the display is refreshed automatically."""
//|
STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) {
@ -270,7 +275,7 @@ const mp_obj_property_t displayio_display_auto_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| brightness: float = ...
//| brightness: float
//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
//| `auto_brightness` is True, the value of `brightness` will change automatically.
//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False."""
@ -307,7 +312,7 @@ const mp_obj_property_t displayio_display_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| auto_brightness: Optional[bool] = ...
//| auto_brightness: bool
//| """True when the display brightness is adjusted automatically, based on an ambient
//| light sensor or other method. Note that some displays may have this set to True by default,
//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False
@ -338,10 +343,9 @@ const mp_obj_property_t displayio_display_auto_brightness_obj = {
//| width: int = ...
//| width: int
//| Gets the width of the board
//|
//|
STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) {
displayio_display_obj_t *self = native_display(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self));
@ -355,10 +359,9 @@ const mp_obj_property_t displayio_display_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Gets the height of the board"""
//|
//|
STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) {
displayio_display_obj_t *self = native_display(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self));
@ -372,7 +375,7 @@ const mp_obj_property_t displayio_display_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| rotation: int = ...
//| rotation: int
//| """The rotation of the display as an int in degrees."""
//|
STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) {
@ -395,7 +398,7 @@ const mp_obj_property_t displayio_display_rotation_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bus: Union[ParallelBus, FourWire, I2CDisplay] = ...
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
//|
@ -413,7 +416,7 @@ const mp_obj_property_t displayio_display_bus_obj = {
};
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> bytearray:
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
//| """Extract the pixels from a single row
//|
//| :param int y: The top edge of the area

View File

@ -49,7 +49,7 @@
//| Most people should not use this class directly. Use a specific display driver instead that will
//| contain the startup and shutdown sequences at minimum."""
//|
//| def __init__(self, display_bus: displayio, start_sequence: buffer, stop_sequence: buffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
//| def __init__(self, display_bus: _DisplayBus, start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, width: int, height: int, ram_width: int, ram_height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, set_column_window_command: Optional[int] = None, set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False, write_black_ram_command: int, black_bits_inverted: bool = False, write_color_ram_command: Optional[int] = None, color_bits_inverted: bool = False, highlight_color: int = 0x000000, refresh_display_command: int, refresh_time: float = 40, busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, seconds_per_frame: float = 180, always_toggle_chip_select: bool = False) -> None:
//| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`).
//|
//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every
@ -205,7 +205,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh);
//| time_to_refresh: float = ...
//| time_to_refresh: float
//| """Time, in fractional seconds, until the ePaper display can be refreshed."""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) {
@ -221,7 +221,7 @@ const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| width: int = ...
//| width: int
//| """Gets the width of the display in pixels"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) {
@ -237,7 +237,7 @@ const mp_obj_property_t displayio_epaperdisplay_width_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| height: int = ...
//| height: int
//| """Gets the height of the display in pixels"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) {
@ -253,7 +253,7 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| bus: displayio = ...
//| bus: _DisplayBus
//| """The bus being used by the display"""
//|
STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) {

View File

@ -42,7 +42,7 @@
//| """Manage updating a display over SPI four wire protocol in the background while Python code runs.
//| It doesn't handle display initialization."""
//|
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: microcontroller.Pin = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None:
//| def __init__(self, spi_bus: busio.SPI, *, command: microcontroller.Pin, chip_select: microcontroller.Pin, reset: Optional[microcontroller.Pin] = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None:
//| """Create a FourWire object associated with the given pins.
//|
//| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is

View File

@ -86,7 +86,7 @@ displayio_group_t* native_group(mp_obj_t group_obj) {
return MP_OBJ_TO_PTR(native_group);
}
//| hidden: bool = ...
//| hidden: bool
//| """True when the Group and all of it's layers are not visible. When False, the Group's layers
//| are visible if they haven't been hidden."""
//|
@ -111,7 +111,7 @@ const mp_obj_property_t displayio_group_hidden_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| scale: int = ...
//| scale: int
//| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
//| will be represented by 2x2 pixels."""
//|
@ -140,7 +140,7 @@ const mp_obj_property_t displayio_group_scale_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| x: int = ...
//| x: int
//| """X position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) {
@ -165,7 +165,7 @@ const mp_obj_property_t displayio_group_x_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| y: int = ...
//| y: int
//| """Y position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) {
@ -207,6 +207,9 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append
//|
STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t layer) {
displayio_group_t *self = native_group(self_in);
if ((size_t) MP_OBJ_SMALL_INT_VALUE(index_obj) == common_hal_displayio_group_get_len(self)){
return displayio_group_obj_append(self_in, layer);
}
size_t index = mp_get_index(&displayio_group_type, common_hal_displayio_group_get_len(self), index_obj, false);
common_hal_displayio_group_insert(self, index, layer);
return mp_const_none;
@ -264,7 +267,8 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove);
//| def __bool__(self) -> bool: ...
//| def __bool__(self) -> bool:
//| ...
//|
//| def __len__(self) -> int:
//| """Returns the number of layers in a Group"""

Some files were not shown because too many files have changed in this diff Show More