Merge remote-tracking branch 'origin/main' into blm_badge

This commit is contained in:
Jeff Epler 2020-07-30 07:24:48 -05:00
commit d69f081c04
41 changed files with 3570 additions and 716 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 black
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
@ -317,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 }}
@ -365,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 }}
@ -445,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-28 14:15-0400\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"
@ -770,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 ""
@ -1790,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 ""
@ -1798,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 ""
@ -1806,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"
@ -1815,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 ""
@ -1823,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 ""
@ -1831,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 ""
@ -2145,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 ""
@ -2161,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 ""
@ -2169,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 ""
@ -2206,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 ""
@ -2309,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 ""
@ -2321,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 ""
@ -2333,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 ""
@ -2366,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 ""
@ -2456,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 ""
@ -2464,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 ""
@ -2504,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 ""
@ -2574,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 ""
@ -2638,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 ""
@ -2669,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 ""
@ -2693,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 ""
@ -2791,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 ""
@ -2866,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 ""
@ -2963,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 ""
@ -3036,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 ""
@ -3060,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 ""
@ -3186,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 ""
@ -3314,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 ""
@ -3322,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 ""
@ -3330,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 ""
@ -3346,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 ""
@ -3366,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

@ -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

@ -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

@ -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);

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

View File

@ -151,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

@ -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)

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

@ -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

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

@ -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

@ -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;

View File

@ -1,169 +0,0 @@
"""Manipulate numeric data similar to numpy
`ulab` is a numpy-like module for micropython, meant to simplify and
speed up common mathematical operations on arrays. The primary goal was to
implement a small subset of numpy that might be useful in the context of a
microcontroller. This means low-level data processing of linear (array) and
two-dimensional (matrix) data.
`ulab` is adapted from micropython-ulab, and the original project's
documentation can be found at
https://micropython-ulab.readthedocs.io/en/latest/
`ulab` is modeled after numpy, and aims to be a compatible subset where
possible. Numpy's documentation can be found at
https://docs.scipy.org/doc/numpy/index.html"""
class array:
"""1- and 2- dimensional array"""
def __init__(self, values, *, dtype=float) -> None:
""":param sequence values: Sequence giving the initial content of the array.
:param dtype: The type of array values, ``int8``, ``uint8``, ``int16``, ``uint16``, or ``float``
The `values` sequence can either be another ~ulab.array, sequence of numbers
(in which case a 1-dimensional array is created), or a sequence where each
subsequence has the same length (in which case a 2-dimensional array is
created).
Passing a ~ulab.array and a different dtype can be used to convert an array
from one dtype to another.
In many cases, it is more convenient to create an array from a function
like `zeros` or `linspace`.
`ulab.array` implements the buffer protocol, so it can be used in many
places an `array.array` can be used."""
...
shape: tuple = ...
"""The size of the array, a tuple of length 1 or 2"""
size: int = ...
"""The number of elements in the array"""
itemsize: int = ...
"""The number of elements in the array"""
def flatten(self, *, order='C'):
""":param order: Whether to flatten by rows ('C') or columns ('F')
Returns a new `ulab.array` object which is always 1 dimensional.
If order is 'C' (the default", then the data is ordered in rows;
If it is 'F', then the data is ordered in columns. "C" and "F" refer
to the typical storage organization of the C and Fortran languages."""
...
def sort(self, *, axis=1):
""":param axis: Whether to sort elements within rows (0), columns (1), or elements (None)"""
...
def transpose(self):
"""Swap the rows and columns of a 2-dimensional array"""
...
def __add__(self):
"""Adds corresponding elements of the two arrays, or adds a number to all
elements of the array. If both arguments are arrays, their sizes must match."""
...
def __sub__(self):
"""Subtracts corresponding elements of the two arrays, or adds a number to all
elements of the array. If both arguments are arrays, their sizes must match."""
...
def __mul__(self):
"""Multiplies corresponding elements of the two arrays, or multiplies
all elements of the array by a number. If both arguments are arrays,
their sizes must match."""
...
def __div__(self):
"""Multiplies corresponding elements of the two arrays, or divides
all elements of the array by a number. If both arguments are arrays,
their sizes must match."""
...
def __pow__():
"""Computes the power (x**y) of corresponding elements of the the two arrays,
or one number and one array. If both arguments are arrays, their sizes
must match."""
...
def __getitem__():
"""Retrieve an element of the array."""
...
def __setitem__():
"""Set an element of the array."""
...
int8 = ...
"""Type code for signed integers in the range -128 .. 127 inclusive, like the 'b' typecode of `array.array`"""
int16 = ...
"""Type code for signed integers in the range -32768 .. 32767 inclusive, like the 'h' typecode of `array.array`"""
float = ...
"""Type code for floating point values, like the 'f' typecode of `array.array`"""
uint8 = ...
"""Type code for unsigned integers in the range 0 .. 255 inclusive, like the 'H' typecode of `array.array`"""
uint16 = ...
"""Type code for unsigned integers in the range 0 .. 65535 inclusive, like the 'h' typecode of `array.array`"""
def ones(shape, *, dtype=float):
"""
.. param: shape
Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array)
.. param: dtype
Type of values in the array
Return a new array of the given shape with all elements set to 1."""
...
def zeros(shape, *, dtype):
"""
.. param: shape
Shape of the array, either an integer (for a 1-D array) or a tuple of 2 integers (for a 2-D array)
.. param: dtype
Type of values in the array
Return a new array of the given shape with all elements set to 0."""
...
def eye(size, *, dtype=float):
"""Return a new square array of size, with the diagonal elements set to 1
and the other elements set to 0."""
...
def linspace(start, stop, *, dtype=float, num=50, endpoint=True):
"""
.. param: start
First value in the array
.. param: stop
Final value in the array
.. param int: num
Count of values in the array
.. param: dtype
Type of values in the array
.. param bool: endpoint
Whether the ``stop`` value is included. Note that even when
endpoint=True, the exact ``stop`` value may not be included due to the
inaccuracy of floating point arithmetic.
Return a new 1-D array with ``num`` elements ranging from ``start`` to ``stop`` linearly."""
...

View File

@ -1,51 +0,0 @@
"""Numerical approximation methods"""
def bisect(fun, a, b, *, xtol=2.4e-7, maxiter=100) -> float:
"""
:param callable f: The function to bisect
:param float a: The left side of the interval
:param float b: The right side of the interval
:param float xtol: The tolerance value
:param float maxiter: The maximum number of iterations to perform
Find a solution (zero) of the function ``f(x)`` on the interval
(``a``..``b``) using the bisection method. The result is accurate to within
``xtol`` unless more than ``maxiter`` steps are required."""
...
def newton(fun, x0, *, xtol=2.4e-7, rtol=0.0, maxiter=50) -> float:
"""
:param callable f: The function to bisect
:param float x0: The initial x value
:param float xtol: The absolute tolerance value
:param float rtol: The relative tolerance value
:param float maxiter: The maximum number of iterations to perform
Find a solution (zero) of the function ``f(x)`` using Newton's Method.
The result is accurate to within ``xtol * rtol * |f(x)|`` unless more than
``maxiter`` steps are requried."""
...
def fmin(fun, x0, *, xatol=2.4e-7, fatol=2.4e-7, maxiter=200) -> float:
"""
:param callable f: The function to bisect
:param float x0: The initial x value
:param float xatol: The absolute tolerance value
:param float fatol: The relative tolerance value
Find a minimum of the function ``f(x)`` using the downhill simplex method.
The located ``x`` is within ``fxtol`` of the actual minimum, and ``f(x)``
is within ``fatol`` of the actual minimum unless more than ``maxiter``
steps are requried."""
...
def interp(x: ulab.array, xp:ulab.array, fp:ulab.array, *, left=None, right=None) -> ulab.array:
"""
:param ulab.array x: The x-coordinates at which to evaluate the interpolated values.
:param ulab.array xp: The x-coordinates of the data points, must be increasing
:param ulab.array fp: The y-coordinates of the data points, same length as xp
:param left: Value to return for ``x < xp[0]``, default is ``fp[0]``.
:param right: Value to return for ``x > xp[-1]``, default is ``fp[-1]``.
Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x."""
...

View File

@ -1,38 +0,0 @@
"""Comparison functions"""
def clip(x1, x2, x3):
"""
Constrain the values from ``x1`` to be between ``x2`` and ``x3``.
``x2`` is assumed to be less than or equal to ``x3``.
Arguments may be ulab arrays or numbers. All array arguments
must be the same size. If the inputs are all scalars, a 1-element
array is returned.
Shorthand for ``ulab.maximum(x2, ulab.minimum(x1, x3))``"""
...
def maximum(x1, x2):
"""
Compute the element by element maximum of the arguments.
Arguments may be ulab arrays or numbers. All array arguments
must be the same size. If the inputs are both scalars, a number is
returned"""
...
def minimum(x1, x2):
"""Compute the element by element minimum of the arguments.
Arguments may be ulab arrays or numbers. All array arguments
must be the same size. If the inputs are both scalars, a number is
returned"""
...
def equal(x1, x2):
"""Return an array of bool which is true where x1[i] == x2[i] and false elsewhere"""
...
def not_equal(x1, x2):
"""Return an array of bool which is false where x1[i] == x2[i] and true elsewhere"""
...

View File

@ -1,10 +0,0 @@
"""Additional functions not in numpy"""
def spectrum(r):
"""
:param ulab.array r: A 1-dimension array of values whose size is a power of 2
Computes the spectrum of the input signal. This is the absolute value of the (complex-valued) fft of the signal.
This function is similar to scipy's ``scipy.signal.spectrogram``."""
...

View File

@ -1,22 +0,0 @@
"""Frequency-domain functions"""
def fft(r, c=None):
"""
:param ulab.array r: A 1-dimension array of values whose size is a power of 2
:param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value
:return tuple (r, c): The real and complex parts of the FFT
Perform a Fast Fourier Transform from the time domain into the frequency domain
See also ~ulab.extras.spectrum, which computes the magnitude of the fft,
rather than separately returning its real and imaginary parts."""
...
def ifft(r, c=None):
"""
:param ulab.array r: A 1-dimension array of values whose size is a power of 2
:param ulab.array c: An optional 1-dimension array of values whose size is a power of 2, giving the complex part of the value
:return tuple (r, c): The real and complex parts of the inverse FFT
Perform an Inverse Fast Fourier Transform from the frequeny domain into the time domain"""
...

View File

@ -1,36 +0,0 @@
"""Filtering functions"""
def convolve(r, c=None):
"""
:param ulab.array a:
:param ulab.array v:
Returns the discrete, linear convolution of two one-dimensional sequences.
The result is always an array of float. Only the ``full`` mode is supported,
and the ``mode`` named parameter of numpy is not accepted. Note that all other
modes can be had by slicing a ``full`` result.
Convolution filters can implement high pass, low pass, band pass, etc.,
filtering operations. Convolution filters are typically constructed ahead
of time. This can be done using desktop python with scipy, or on web pages
such as https://fiiir.com/
Convolution is most time-efficient when both inputs are of float type."""
...
def sosfilt(sos : ulab.array, x : ulab.array, *, xi : Optional[ulab.array] = None) -> Union[ulab.array, Tuple[ulab.array, ulab.array]]:
"""
:param ulab.array sos: Array of second-order filter coefficients, must have shape (n_sections, 6). Each row corresponds to a second-order section, with the first three columns providing the numerator coefficients and the last three providing the denominator coefficients.
:param ulab.array x: The data to be filtered
:param ulab.array zi: Optional initial conditions for the filter
:return: If ``xi`` is not specified, the filter result alone is returned. If ``xi`` is specified, the return value is a 2-tuple of the filter result and the final filter conditions.
Filter data along one dimension using cascaded second-order sections.
Filter a data sequence, x, using a digital IIR filter defined by sos.
The filter function is implemented as a series of second-order filters with direct-form II transposed structure. It is designed to minimize numerical precision errors for high-order filters.
Filter coefficients can be generated by using scipy's filter generators such as ``signal.ellip(..., output='sos')``."""
...

View File

@ -1,57 +0,0 @@
"""Linear algebra functions"""
def cholesky(A):
"""
:param ~ulab.array A: a positive definite, symmetric square matrix
:return ~ulab.array L: a square root matrix in the lower triangular form
:raises ValueError: If the input does not fulfill the necessary conditions
The returned matrix satisfies the equation m=LL*"""
...
def det():
"""
:param: m, a square matrix
:return float: The determinant of the matrix
Computes the eigenvalues and eigenvectors of a square matrix"""
...
def dot(m1, m2):
"""
:param ~ulab.array m1: a matrix
:param ~ulab.array m2: a matrix
Computes the matrix product of two matrices
**WARNING:** Unlike ``numpy``, this function cannot be used to compute the dot product of two vectors"""
...
def eig(m):
"""
:param m: a square matrix
:return tuple (eigenvectors, eigenvalues):
Computes the eigenvalues and eigenvectors of a square matrix"""
...
def inv(m):
"""
:param ~ulab.array m: a square matrix
:return: The inverse of the matrix, if it exists
:raises ValueError: if the matrix is not invertible
Computes the inverse of a square matrix"""
...
def size(array):
"""Return the total number of elements in the array, as an integer."""
...
def trace(m):
"""
:param m: a square matrix
Compute the trace of the matrix, the sum of its diagonal elements."""
...

View File

@ -1,57 +0,0 @@
"""Numerical and Statistical functions
Most of these functions take an "axis" argument, which indicates whether to
operate over the flattened array (None), rows (0), or columns (1)."""
def argmax(array, *, axis=None):
"""Return the index of the maximum element of the 1D array"""
...
def argmin(array, *, axis=None):
"""Return the index of the minimum element of the 1D array"""
...
def argsort(array, *, axis=None):
"""Returns an array which gives indices into the input array from least to greatest."""
...
def diff(array, *, axis=1):
"""Return the numerical derivative of successive elements of the array, as
an array. axis=None is not supported."""
...
def flip(array, *, axis=None):
"""Returns a new array that reverses the order of the elements along the
given axis, or along all axes if axis is None."""
...
def max(array, *, axis=None):
"""Return the maximum element of the 1D array"""
...
def mean(array, *, axis=None):
"""Return the mean element of the 1D array, as a number if axis is None, otherwise as an array."""
...
def min(array, *, axis=None):
"""Return the minimum element of the 1D array"""
...
def roll(array, distance, *, axis=None):
"""Shift the content of a vector by the positions given as the second
argument. If the ``axis`` keyword is supplied, the shift is applied to
the given axis. The array is modified in place."""
...
def std(array, *, axis=None):
"""Return the standard deviation of the array, as a number if axis is None, otherwise as an array."""
...
def sum(array, *, axis=None):
"""Return the sum of the array, as a number if axis is None, otherwise as an array."""
...
def sort(array, *, axis=0):
"""Sort the array along the given axis, or along all axes if axis is None.
The array is modified in place."""
...

View File

@ -1,10 +0,0 @@
"""Polynomial functions"""
def polyfit(x, y, degree):
"""Return a polynomial of given degree that approximates the function
f(x)=y. If x is not supplied, it is the range(len(y))."""
...
def polyval(p, x):
"""Evaluate the polynomial p at the points x. x must be an array."""
...

View File

@ -1,118 +0,0 @@
"""Element-by-element functions
These functions can operate on numbers, 1-D arrays, or 2-D arrays by
applying the function to every element in the array. This is typically
much more efficient than expressing the same operation as a Python loop."""
def acos():
"""Computes the inverse cosine function"""
...
def acosh():
"""Computes the inverse hyperbolic cosine function"""
...
def asin():
"""Computes the inverse sine function"""
...
def asinh():
"""Computes the inverse hyperbolic sine function"""
...
def around(a, *, decimals):
"""Returns a new float array in which each element is rounded to
``decimals`` places."""
...
def atan():
"""Computes the inverse tangent function; the return values are in the
range [-pi/2,pi/2]."""
...
def atan2(y,x):
"""Computes the inverse tangent function of y/x; the return values are in
the range [-pi, pi]."""
...
def atanh():
"""Computes the inverse hyperbolic tangent function"""
...
def ceil():
"""Rounds numbers up to the next whole number"""
...
def cos():
"""Computes the cosine function"""
...
def erf():
"""Computes the error function, which has applications in statistics"""
...
def erfc():
"""Computes the complementary error function, which has applications in statistics"""
...
def exp():
"""Computes the exponent function."""
...
def expm1():
"""Computes $e^x-1$. In certain applications, using this function preserves numeric accuracy better than the `exp` function."""
...
def floor():
"""Rounds numbers up to the next whole number"""
...
def gamma():
"""Computes the gamma function"""
...
def lgamma():
"""Computes the natural log of the gamma function"""
...
def log():
"""Computes the natural log"""
...
def log10():
"""Computes the log base 10"""
...
def log2():
"""Computes the log base 2"""
...
def sin():
"""Computes the sine"""
...
def sinh():
"""Computes the hyperbolic sine"""
...
def sqrt():
"""Computes the square root"""
...
def tan():
"""Computes the tangent"""
...
def tanh():
"""Computes the hyperbolic tangent"""
...
def vectorize(f, *, otypes=None):
"""
:param callable f: The function to wrap
:param otypes: List of array types that may be returned by the function. None is intepreted to mean the return value is float.
Wrap a Python function ``f`` so that it can be applied to arrays.
The callable must return only values of the types specified by otypes, or the result is undefined."""
...

View File

@ -30,6 +30,7 @@
#include "extmod/vfs.h"
#include "py/mperrno.h"
#include "py/mphal.h"
#include "py/obj.h"
#include "py/runtime.h"
#include "shared-bindings/microcontroller/__init__.h"
@ -159,6 +160,8 @@ void common_hal_storage_remount(const char *mount_path, bool readonly, bool disa
}
void common_hal_storage_erase_filesystem(void) {
usb_disconnect();
mp_hal_delay_ms(1000);
filesystem_init(false, true); // Force a re-format.
common_hal_mcu_reset();
// We won't actually get here, since we're resetting.

View File

@ -143,13 +143,13 @@ uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y)
int y2 = self->points_list[i % self->len];
VECTORIO_POLYGON_DEBUG(" (%3d, %3d)}\n", x2, y2);
if ( y1 <= y ) {
if ( y2 > y && line_side(x1, y1, x2, y2, x, y) > 0 ) {
// Wind up, point is to the right of the edge vector
if ( y2 > y && line_side(x1, y1, x2, y2, x, y) < 0 ) {
// Wind up, point is to the left of the edge vector
++winding_number;
VECTORIO_POLYGON_DEBUG(" wind:%2d winding_number:%2d\n", 1, winding_number);
}
} else if ( y2 <= y && line_side(x1, y1, x2, y2, x, y) < 0 ) {
// Wind down, point is to the left of the edge vector
} else if ( y2 <= y && line_side(x1, y1, x2, y2, x, y) > 0 ) {
// Wind down, point is to the right of the edge vector
--winding_number;
VECTORIO_POLYGON_DEBUG(" wind:%2d winding_number:%2d\n", -1, winding_number);
}

View File

@ -47,8 +47,6 @@
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#ifndef CFG_TUSB_DEBUG
#define CFG_TUSB_DEBUG 0
#endif
@ -58,8 +56,6 @@
#define CFG_TUSB_OS OPT_OS_NONE
#endif
//#define CFG_TUD_TASK_QUEUE_SZ 16
//#define CFG_TUD_TASK_PRIO 0
//#define CFG_TUD_TASK_STACK_SZ 150
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
@ -67,14 +63,6 @@
#define CFG_TUD_ENDOINT0_SIZE 64
/*------------- Descriptors -------------*/
/* Enable auto generated descriptor, tinyusb will try its best to create
* descriptor ( device, configuration, hid ) that matches enabled CFG_* in this file
*
* Note: All CFG_TUD_DESC_* are relevant only if CFG_TUD_DESC_AUTO is enabled
*/
#define CFG_TUD_DESC_AUTO 0
//------------- CLASS -------------//
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
@ -86,23 +74,6 @@
/* CLASS DRIVER
*------------------------------------------------------------------*/
/* TX is sent automatically on every Start of Frame event ~ 1ms.
* If not enabled, application must call tud_cdc_flush() periodically
* Note: Enabled this could overflow device task, if it does, define
* CFG_TUD_TASK_QUEUE_SZ with large value
*/
#define CFG_TUD_CDC_FLUSH_ON_SOF 0
/*------------- MSC -------------*/
// Number of supported Logical Unit Number (At least 1)
#define CFG_TUD_MSC_MAXLUN 1
// Number of Blocks
#define CFG_TUD_MSC_BLOCK_NUM (256*1024)/512
// Product revision string included in Inquiry response, max 4 bytes
#define CFG_TUD_MSC_PRODUCT_REV "1.0"

View File

@ -74,6 +74,10 @@ void usb_init(void) {
#endif
}
void usb_disconnect(void) {
tud_disconnect();
}
void usb_background(void) {
if (usb_enabled()) {
#if CFG_TUSB_OS == OPT_OS_NONE

View File

@ -129,8 +129,8 @@ ifndef USB_HID_DEVICES
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
endif
ifndef USB_MSC_MAX_PACKET_SIZE
USB_MSC_MAX_PACKET_SIZE = 64
ifndef USB_HIGHSPEED
USB_HIGHSPEED = 0
endif
ifndef USB_CDC_EP_NUM_NOTIFICATION
@ -178,7 +178,6 @@ USB_DESCRIPTOR_ARGS = \
--interface_name $(USB_INTERFACE_NAME)\
--devices $(USB_DEVICES)\
--hid_devices $(USB_HID_DEVICES)\
--msc_max_packet_size $(USB_MSC_MAX_PACKET_SIZE)\
--cdc_ep_num_notification $(USB_CDC_EP_NUM_NOTIFICATION)\
--cdc_ep_num_data_out $(USB_CDC_EP_NUM_DATA_OUT)\
--cdc_ep_num_data_in $(USB_CDC_EP_NUM_DATA_IN)\
@ -195,6 +194,10 @@ ifeq ($(USB_RENUMBER_ENDPOINTS), 0)
USB_DESCRIPTOR_ARGS += --no-renumber_endpoints
endif
ifeq ($(USB_HIGHSPEED), 1)
USB_DESCRIPTOR_ARGS += --highspeed
endif
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate

View File

@ -45,6 +45,7 @@ void init_usb_hardware(void);
// Shared implementation.
bool usb_enabled(void);
void usb_init(void);
void usb_disconnect(void);
// Propagate plug/unplug events to the MSC logic.
void usb_msc_mount(void);

View File

@ -6,7 +6,7 @@ class AsyncIteratorWrapper:
print('init')
self._it = iter(obj)
async def __aiter__(self):
def __aiter__(self):
print('aiter')
return self

View File

@ -1,4 +1,4 @@
# test waiting within "async for" aiter/anext functions
# test waiting within "async for" __anext__ function
import sys
if sys.implementation.name in ('micropython', 'circuitpython'):
@ -21,9 +21,8 @@ class ARange:
self.cur = 0
self.high = high
async def __aiter__(self):
def __aiter__(self):
print('aiter')
print('f returned:', await f(10))
return self
async def __anext__(self):

View File

@ -1,9 +1,5 @@
init
aiter
f start: 10
coro yielded: 11
coro yielded: 12
f returned: 13
anext
f start: 20
coro yielded: 21

View File

@ -5,6 +5,7 @@
# SPDX-License-Identifier: MIT
import os
import multiprocessing
import sys
import subprocess
import shutil
@ -27,6 +28,8 @@ sha, version = build_info.get_version_info()
languages = build_info.get_languages()
exit_status = 0
cores = multiprocessing.cpu_count()
print('building boards with parallelism {}'.format(cores))
for board in build_boards:
bin_directory = "../bin/{}/".format(board)
os.makedirs(bin_directory, exist_ok=True)
@ -41,8 +44,8 @@ for board in build_boards:
# But sometimes a particular language needs to be built from scratch, if, for instance,
# CFLAGS_INLINE_LIMIT is set for a particular language to make it fit.
clean_build_check_result = subprocess.run(
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
port = board_info["port"], language=language, board=board),
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} check-release-needs-clean-build -j {cores} | fgrep 'RELEASE_NEEDS_CLEAN_BUILD = 1'".format(
port = board_info["port"], language=language, board=board, cores=cores),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
clean_build = clean_build_check_result.returncode == 0
@ -51,8 +54,8 @@ for board in build_boards:
build_dir += "-{language}".format(language=language)
make_result = subprocess.run(
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build}".format(
port = board_info["port"], language=language, board=board, build=build_dir),
"make -C ../ports/{port} TRANSLATION={language} BOARD={board} BUILD={build} -j {cores}".format(
port = board_info["port"], language=language, board=board, build=build_dir, cores=cores),
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
build_duration = time.monotonic() - start_time

View File

@ -23,6 +23,8 @@ ALL_HID_DEVICES_SET=frozenset(ALL_HID_DEVICES.split(','))
DEFAULT_HID_DEVICES='KEYBOARD,MOUSE,CONSUMER,GAMEPAD'
parser = argparse.ArgumentParser(description='Generate USB descriptors.')
parser.add_argument('--highspeed', default=False, action='store_true',
help='descriptor for highspeed device')
parser.add_argument('--manufacturer', type=str,
help='manufacturer of the device')
parser.add_argument('--product', type=str,
@ -40,8 +42,6 @@ parser.add_argument('--hid_devices', type=lambda l: tuple(l.split(',')), default
parser.add_argument('--interface_name', type=str,
help='The name/prefix to use in the interface descriptions',
default=DEFAULT_INTERFACE_NAME)
parser.add_argument('--msc_max_packet_size', type=int, default=64,
help='Max packet size for MSC')
parser.add_argument('--no-renumber_endpoints', dest='renumber_endpoints', action='store_false',
help='use to not renumber endpoint')
parser.add_argument('--cdc_ep_num_notification', type=int, default=0,
@ -62,8 +62,8 @@ parser.add_argument('--midi_ep_num_out', type=int, default=0,
help='endpoint number of MIDI OUT')
parser.add_argument('--midi_ep_num_in', type=int, default=0,
help='endpoint number of MIDI IN')
parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True)
parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True)
parser.add_argument('--output_c_file', type=argparse.FileType('w', encoding='UTF-8'), required=True)
parser.add_argument('--output_h_file', type=argparse.FileType('w', encoding='UTF-8'), required=True)
args = parser.parse_args()
@ -185,11 +185,15 @@ cdc_data_interface = standard.InterfaceDescriptor(
standard.EndpointDescriptor(
description="CDC data out",
bEndpointAddress=args.cdc_ep_num_data_out | standard.EndpointDescriptor.DIRECTION_OUT,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=512 if args.highspeed else 64),
standard.EndpointDescriptor(
description="CDC data in",
bEndpointAddress=args.cdc_ep_num_data_in | standard.EndpointDescriptor.DIRECTION_IN,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=512 if args.highspeed else 64),
])
cdc_interfaces = [cdc_comm_interface, cdc_data_interface]
@ -207,13 +211,13 @@ msc_interfaces = [
bEndpointAddress=args.msc_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=args.msc_max_packet_size),
wMaxPacketSize=512 if args.highspeed else 64),
standard.EndpointDescriptor(
description="MSC out",
bEndpointAddress=(args.msc_ep_num_out | standard.EndpointDescriptor.DIRECTION_OUT),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=args.msc_max_packet_size)
wMaxPacketSize=512 if args.highspeed else 64),
]
)
]
@ -319,13 +323,16 @@ audio_midi_interface = standard.InterfaceDescriptor(
standard.EndpointDescriptor(
description="MIDI data out to {}".format(args.interface_name),
bEndpointAddress=args.midi_ep_num_out | standard.EndpointDescriptor.DIRECTION_OUT,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=512 if args.highspeed else 64),
midi.DataEndpointDescriptor(baAssocJack=[midi_in_jack_emb]),
standard.EndpointDescriptor(
description="MIDI data in from {}".format(args.interface_name),
bEndpointAddress=args.midi_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval = 0x0),
bInterval = 0x0,
wMaxPacketSize=512 if args.highspeed else 64),
midi.DataEndpointDescriptor(baAssocJack=[midi_out_jack_emb]),
])
@ -540,15 +547,15 @@ h_file.write("""\
#include <stdint.h>
extern const uint8_t usb_desc_dev[{device_length}];
// Make sure the control buffer is big enough to fit the descriptor.
#define CFG_TUD_ENUM_BUFFER_SIZE {max_configuration_length}
extern const uint8_t usb_desc_cfg[{configuration_length}];
extern uint16_t usb_serial_number[{serial_number_length}];
extern uint16_t const * const string_desc_arr [{string_descriptor_length}];
extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
#define USB_HID_NUM_DEVICES {hid_num_devices}
#define CFG_TUSB_RHPORT0_MODE ({rhport0_mode})
#define USB_HID_NUM_DEVICES {hid_num_devices}
// Vendor name included in Inquiry response, max 8 bytes
#define CFG_TUD_MSC_VENDOR "{msc_vendor}"
@ -563,6 +570,7 @@ extern const uint8_t hid_report_descriptor[{hid_report_descriptor_length}];
max_configuration_length=max(hid_descriptor_length, descriptor_length),
string_descriptor_length=len(pointers_to_strings),
hid_report_descriptor_length=len(bytes(combined_hid_report_descriptor)),
rhport0_mode='OPT_MODE_DEVICE | OPT_MODE_HIGH_SPEED' if args.highspeed else 'OPT_MODE_DEVICE',
hid_num_devices=len(args.hid_devices),
msc_vendor=args.manufacturer[:8],
msc_product=args.product[:16]))