Merge pull request #4 from adafruit/master
Get latest changes to translate
This commit is contained in:
commit
f6892ce3ff
|
@ -86,3 +86,15 @@
|
|||
[submodule "tools/adabot"]
|
||||
path = tools/adabot
|
||||
url = https://github.com/adafruit/adabot.git
|
||||
[submodule "tools/bitmap_font"]
|
||||
path = tools/bitmap_font
|
||||
url = https://github.com/adafruit/Adafruit_CircuitPython_BitmapFont.git
|
||||
[submodule "tools/Tecate-bitmap-fonts"]
|
||||
path = tools/Tecate-bitmap-fonts
|
||||
url = https://github.com/Tecate/bitmap-fonts.git
|
||||
[submodule "frozen/pew-pewpew-standalone-10.x"]
|
||||
path = frozen/pew-pewpew-standalone-10.x
|
||||
url = https://github.com/pewpew-game/pew-pewpew-standalone-10.x.git
|
||||
[submodule "frozen/circuitpython-stage"]
|
||||
path = frozen/circuitpython-stage
|
||||
url = https://github.com/python-ugame/circuitpython-stage.git
|
||||
|
|
37
.travis.yml
37
.travis.yml
|
@ -4,7 +4,7 @@ language: c
|
|||
compiler:
|
||||
- gcc
|
||||
git:
|
||||
depth: 1
|
||||
depth: 6
|
||||
|
||||
# Each item under 'env' is a separate Travis job to execute.
|
||||
# They run in separate environments, so each one must take the time
|
||||
|
@ -21,16 +21,16 @@ git:
|
|||
# that SDK is shortest and add it there. In the case of major re-organizations,
|
||||
# just try to make the builds "about equal in run time"
|
||||
env:
|
||||
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="feather_huzzah circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52832 feather_nrf52840_express makerdiary_nrf52840_mdk particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf:esp8266
|
||||
- TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal" TRAVIS_SDK=arm
|
||||
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf
|
||||
- TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo pybadge" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10" TRAVIS_SDK=arm
|
||||
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev" TRAVIS_SDK=arm
|
||||
|
||||
addons:
|
||||
artifacts:
|
||||
paths:
|
||||
- $(ls -d1 bin/*/* | tr "\n" ":")
|
||||
- $(ls -d1 bin/*/*/* | tr "\n" ":")
|
||||
target_paths: /
|
||||
|
||||
deploy:
|
||||
|
@ -38,9 +38,8 @@ deploy:
|
|||
api_key:
|
||||
secure: "jdqVFw6itRY4qwQF4ReXo0uaymT+Mob6RhYX0lw8KWFNqBgHnLVuKmKKcGMEuRvBVMPkvxF7bMuOQzSBOunqwlHFse3oMzdWvQODv1zwV7pSRXGwTdIvTPbBjKWxnBG9uSNRf2R5AMflJFUxy2CbtBpgvNzr+4VLREZDrrjEu8C1iTtXGpSm5AQ5iIp2fkMAWD85FP7CQPpkqRoxhSIFZmTdurfYRmenq1OZ/4SeD5TESKcyvqJNzVT9z210B3cg3eAkP6ukvelW4qE2zgIANqUkGqvDEnAvEII9M89kuwhCMAekdfwnUSPrry+g77i1dUZHoRN1+MFj+waYtPaqxdYo2G1sysa6enxlu4jHMR5MfMk9eKHgaNgL3PiyANusYSS44amh8QIiVaX5nw82myZDCpQOZW7YqJKE6WX70Lbs4mS+wIs+ig4KIXO1B0p9kMb0OeVjHRl+KcXsWGRu/ECG/ExpqlVIssSPU407LohMXT2cJ37CY/R/EeK2XSDsQ2M3L3EAGUjCJdBGuwsOJ+2lG+HQpAVu9vAB4kq5jy9Ye+MG+8Xlkly3XZZ5+FkXyYxKnXb26/QVv0e5sIG5OmdJCPYFaH2J1QdKo7CdhEcBtrf6DMPWaimGMldShFqzLjOz3b3qLysRxFF0aGb7ipKPa57vawNzYHoPAViOcXQ="
|
||||
file_glob: true
|
||||
file: "$TRAVIS_BUILD_DIR/bin/*/*"
|
||||
file: "$TRAVIS_BUILD_DIR/bin/*/*/*"
|
||||
skip_cleanup: true
|
||||
draft: true
|
||||
on:
|
||||
tags: true
|
||||
|
||||
|
@ -57,7 +56,6 @@ notifications:
|
|||
before_script:
|
||||
# Expand the git tree back to 4.0.0-alpha.1 and then fetch the latest tag.
|
||||
- LAST_TAG=`git ls-remote --quiet --tags --sort=version:refname | egrep -o "refs/tags/[0-9]+.*\$" | tail -n 1`
|
||||
- git fetch --shallow-exclude=4.0.0-alpha.1 || git fetch --unshallow
|
||||
- git fetch --depth 1 origin $LAST_TAG:$LAST_TAG
|
||||
- git describe --dirty --always --tags
|
||||
- function var_search () { case "$1" in *$2*) true;; *) false;; esac; }
|
||||
|
@ -66,9 +64,6 @@ before_script:
|
|||
|
||||
- (! var_search "${TRAVIS_SDK-}" arm || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
||||
|
||||
# For nrf builds
|
||||
- (! var_search "${TRAVIS_SDK-}" nrf || sudo ports/nrf/bluetooth/download_ble_stack.sh)
|
||||
|
||||
# For huzzah builds
|
||||
- (! var_search "${TRAVIS_SDK-}" esp8266 || (wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar -C .. -xaf xtensa-lx106-elf-standalone.tar.gz))
|
||||
- if var_search "${TRAVIS_SDK-}" esp8266 ; then PATH=$(readlink -f ../xtensa-lx106-elf/bin):$PATH; fi
|
||||
|
@ -89,7 +84,7 @@ before_script:
|
|||
script:
|
||||
# Build mpy-cross first because other builds depend on it.
|
||||
- echo 'Building mpy-cross' && echo 'travis_fold:start:mpy-cross'
|
||||
- make -C mpy-cross -j2 ; echo $? > status
|
||||
- make -C mpy-cross -j2 ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:mpy-cross' && tools/print_status.py status
|
||||
|
||||
# Use unbuffered output because building all the releases can take a long time.
|
||||
|
@ -98,7 +93,7 @@ script:
|
|||
- cd ..
|
||||
|
||||
- echo 'Building unix' && echo 'travis_fold:start:unix'
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; echo $? > status
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:unix' && tools/print_status.py status
|
||||
|
||||
# run tests without coverage info
|
||||
|
@ -107,27 +102,27 @@ script:
|
|||
|
||||
# run tests with coverage info
|
||||
- echo 'Test all' && echo 'travis_fold:start:test_all'
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; echo $? > status
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:test_all' && tools/print_status.py status
|
||||
|
||||
- echo 'Test threads' && echo 'travis_fold:start:test_threads'
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; echo $? >status
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:test_threads' && tools/print_status.py status
|
||||
|
||||
- echo 'Testing with native' && echo 'travis_fold:start:test_native'
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; echo $? >status
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:test_native' && tools/print_status.py status
|
||||
|
||||
- (echo 'Testing with mpy' && echo 'travis_fold:start:test_mpy')
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; echo $? >status
|
||||
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:test_mpy' && tools/print_status.py status
|
||||
|
||||
- (echo 'Building docs' && echo 'travis_fold:start:build_docs')
|
||||
- (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; echo $? >status
|
||||
- (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:build_docs' && tools/print_status.py status
|
||||
|
||||
- (echo 'Building translations' && echo 'travis_fold:start:build_translations')
|
||||
- (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; echo $? >status
|
||||
- (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; S=$? ; echo $S > status ; (exit $S)
|
||||
- echo 'travis_fold:end:build_translations' && tools/print_status.py status
|
||||
|
||||
# run coveralls coverage analysis (try to, even if some builds/tests failed)
|
||||
|
|
4
Makefile
4
Makefile
|
@ -194,10 +194,10 @@ pseudoxml:
|
|||
all-source:
|
||||
|
||||
locale/circuitpython.pot: all-source
|
||||
find . -iname "*.c" | xargs xgettext -L C --keyword=translate -F -o circuitpython.pot -p locale
|
||||
find . -iname "*.c" | xargs xgettext -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
|
||||
|
||||
translate: locale/circuitpython.pot
|
||||
for po in $(shell ls locale/*.po); do msgmerge -U -F $$po locale/circuitpython.pot; done
|
||||
for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done
|
||||
|
||||
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
|
||||
$(PYTHON) tools/check_translations.py $^
|
||||
|
|
|
@ -157,7 +157,7 @@ Behavior
|
|||
API
|
||||
~~~
|
||||
|
||||
- Unified hardware APIs: `audioio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/audioio/__init__.html>`_, `analogio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/analogio/__init__.html>`_, `busio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/busio/__init__.html>`_, `digitalio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/digitalio/__init__.html>`_, `pulseio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/pulseio/__init__.html>`_, `touchio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/touchio/__init__.html>`_, `microcontroller <https://circuitpython.readthedocs.io/en/latest/shared-bindings/microcontroller/__init__.html>`_, `board <https://circuitpython.readthedocs.io/en/latest/shared-bindings/board/__init__.html>`_, `bitbangio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/bitbangio/__init__.html>`_
|
||||
- Unified hardware APIs: `audioio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/audioio/__init__.html>`_, `analogio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/analogio/__init__.html>`_, `bleio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/bleio/__init__.html>`_, `busio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/busio/__init__.html>`_, `digitalio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/digitalio/__init__.html>`_, `pulseio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/pulseio/__init__.html>`_, `touchio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/touchio/__init__.html>`_, `microcontroller <https://circuitpython.readthedocs.io/en/latest/shared-bindings/microcontroller/__init__.html>`_, `board <https://circuitpython.readthedocs.io/en/latest/shared-bindings/board/__init__.html>`_, `bitbangio <https://circuitpython.readthedocs.io/en/latest/shared-bindings/bitbangio/__init__.html>`_
|
||||
- No ``machine`` API on Atmel SAMD21 port.
|
||||
|
||||
Modules
|
||||
|
@ -271,6 +271,6 @@ project.
|
|||
.. |Doc Status| image:: https://readthedocs.org/projects/circuitpython/badge/?version=latest
|
||||
:target: http://circuitpython.readthedocs.io/
|
||||
.. |Discord| image:: https://img.shields.io/discord/327254708534116352.svg
|
||||
:target: https://discord.gg/nBQh6qu
|
||||
:target: https://adafru.it/discord
|
||||
.. |License| image:: https://github.com/adafruit/circuitpython/blob/master/logo/license-MIT-brightgreen.svg
|
||||
:target: https://opensource.org/licenses/MIT
|
||||
|
|
|
@ -500,6 +500,8 @@ properties.
|
|||
+-----------------------+-----------------------+-------------------------------------------------------------------------+
|
||||
| ``value`` | int | 16-bit Analog value, unit-less |
|
||||
+-----------------------+-----------------------+-------------------------------------------------------------------------+
|
||||
| ``weight`` | float | grams (g) |
|
||||
+-----------------------+-----------------------+-------------------------------------------------------------------------+
|
||||
|
||||
Adding native modules
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
245
docs/drivers.rst
245
docs/drivers.rst
|
@ -1,16 +1,13 @@
|
|||
.. _adafruit-libndrivers:
|
||||
|
||||
Additional Adafruit Libraries and Drivers on GitHub
|
||||
===================================================
|
||||
Additional CircuitPython Libraries and Drivers on GitHub
|
||||
=========================================================
|
||||
|
||||
These are libraries and drivers available in separate GitHub repos. They are
|
||||
designed for use with CircuitPython and may or may not work with
|
||||
`MicroPython <https://micropython.org>`_.
|
||||
|
||||
.. _bundle_installation:
|
||||
|
||||
Bundle
|
||||
------
|
||||
Adafruit CircuitPython Library Bundle
|
||||
--------------------------------------
|
||||
|
||||
We provide a bundle of all our libraries to ease installation of drivers and
|
||||
their dependencies. The bundle is primarily geared to the Adafruit Express line
|
||||
|
@ -18,233 +15,19 @@ of boards which feature a relatively large external flash. With Express boards,
|
|||
its easy to copy them all onto the filesystem. However, if you don't have
|
||||
enough space simply copy things over as they are needed.
|
||||
|
||||
The bundles are available `on GitHub <https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases>`_.
|
||||
- The Adafruit bundles are available on GitHub: <https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases>.
|
||||
|
||||
To install them:
|
||||
- Documentation for the bundle, which includes links to documentation for all
|
||||
libraries, is available here: <https://circuitpython.readthedocs.io/projects/bundle/en/latest/>.
|
||||
|
||||
#. `Download <https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases>`_
|
||||
and unzip the latest zip that's not a source zip.
|
||||
#. Copy the ``lib`` folder to the ``CIRCUITPY`` or ``MICROPYTHON``.
|
||||
|
||||
Foundational
|
||||
------------
|
||||
CircuitPython Community Library Bundle
|
||||
---------------------------------------
|
||||
|
||||
These libraries provide critical functionality to many of the drivers below. It
|
||||
is recommended to always have them installed onto the CircuitPython file system in
|
||||
the ``lib/`` directory. Some drivers may not work without them.
|
||||
This bundle contains non-Adafruit sponsored libraries, that are written and submitted
|
||||
by members of the community.
|
||||
|
||||
.. toctree::
|
||||
- The Community bundles are available on GitHub: <https://github.com/adafruit/CircuitPython_Community_Bundle/releases>.
|
||||
|
||||
Register Library <https://circuitpython.readthedocs.io/projects/register/en/latest/>
|
||||
BusDevice Library <https://circuitpython.readthedocs.io/projects/busdevice/en/latest/>
|
||||
|
||||
Board-specific Helpers
|
||||
----------------------
|
||||
|
||||
These libraries tie lower-level libraries together to provide an easy, out-of-box experience for
|
||||
specific boards.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Adafruit CircuitPlayground Express <https://circuitpython.readthedocs.io/projects/circuitplayground/en/latest/>
|
||||
Adafruit FeatherWings <https://circuitpython.readthedocs.io/projects/featherwing/en/latest/>
|
||||
|
||||
Helper Libraries
|
||||
-----------------
|
||||
|
||||
These libraries build on top of the low level APIs to simplify common tasks.
|
||||
|
||||
.. toctree::
|
||||
|
||||
USB Human Interface Device (Keyboard and Mouse) <https://circuitpython.readthedocs.io/projects/hid/en/latest/>
|
||||
Waveform Generation <https://circuitpython.readthedocs.io/projects/waveform/en/latest/>
|
||||
OneWire <https://circuitpython.readthedocs.io/projects/onewire/en/latest/>
|
||||
Ring Tone Text Transfer Language (RTTTL) <https://circuitpython.readthedocs.io/projects/rtttl/en/latest/>
|
||||
InfraRed Remote <https://circuitpython.readthedocs.io/projects/irremote/en/latest/>
|
||||
Fancy LED (similar to FastLED) <https://circuitpython.readthedocs.io/projects/fancyled/en/latest/>
|
||||
SimpleIO <https://circuitpython.readthedocs.io/projects/simpleio/en/latest/>
|
||||
AVR programming <https://circuitpython.readthedocs.io/projects/avrprog/en/latest/>
|
||||
DC Motor and Servo <https://circuitpython.readthedocs.io/projects/motor/en/latest/>
|
||||
SD Card <https://circuitpython.readthedocs.io/projects/sd/en/latest/>
|
||||
Image Load <https://circuitpython.readthedocs.io/projects/imageload/en/latest/>
|
||||
miniQR Non-hardware QR code generator <https://circuitpython.readthedocs.io/projects/miniqr/en/latest/>
|
||||
Slideshow <https://circuitpython.readthedocs.io/projects/slideshow/en/latest/>
|
||||
LED Animation <https://circuitpython.readthedocs.io/projects/led-animation/en/latest/>
|
||||
|
||||
Blinky
|
||||
--------
|
||||
|
||||
Multi-color led drivers.
|
||||
|
||||
.. toctree::
|
||||
|
||||
NeoPixel <https://circuitpython.readthedocs.io/projects/neopixel/en/latest/>
|
||||
DotStar <https://circuitpython.readthedocs.io/projects/dotstar/en/latest/>
|
||||
WS2801 <https://circuitpython.readthedocs.io/projects/ws2801/en/latest/>
|
||||
Pixie <https://circuitpython.readthedocs.io/projects/pixie/en/latest/>
|
||||
|
||||
Displays
|
||||
-------------
|
||||
|
||||
Drivers used to display information. Either pixel or segment based.
|
||||
|
||||
.. toctree::
|
||||
|
||||
RGB Displays <https://circuitpython.readthedocs.io/projects/rgb_display/en/latest/>
|
||||
Character LCD <https://circuitpython.readthedocs.io/projects/charlcd/en/latest/>
|
||||
HT16K33 LED Matrices and Segment Displays <https://circuitpython.readthedocs.io/projects/ht16k33/en/latest/>
|
||||
IS31FL3731 Charlieplexed LED Matrix <https://circuitpython.readthedocs.io/projects/is31fl3731/en/latest/>
|
||||
MAX7219 LED Matrix <https://circuitpython.readthedocs.io/projects/max7219/en/latest/>
|
||||
SSD1306 OLED Driver <https://circuitpython.readthedocs.io/projects/ssd1306/en/latest/>
|
||||
E-Paper Display <https://circuitpython.readthedocs.io/projects/epd/en/latest/>
|
||||
|
||||
Real-time clocks
|
||||
-----------------
|
||||
|
||||
Chips that keep current calendar time with a backup battery. The current date and time is available
|
||||
through ``datetime``.
|
||||
|
||||
.. toctree::
|
||||
|
||||
DS1307 Real-time Clock (5V RTC Breakout) <https://circuitpython.readthedocs.io/projects/ds1307/en/latest/>
|
||||
DS3231 Real-time Clock (Precision RTC) <https://circuitpython.readthedocs.io/projects/ds3231/en/latest/>
|
||||
PCF8523 Real-time Clock (Adalogger RTC) <https://circuitpython.readthedocs.io/projects/pcf8523/en/latest/>
|
||||
|
||||
Motion Sensors
|
||||
----------------
|
||||
|
||||
Motion relating sensing including ``acceleration``, ``magnetic``, ``gyro``, and ``orientation``.
|
||||
|
||||
.. toctree::
|
||||
|
||||
ADXL34x 3 Axis Accelerometer <https://circuitpython.readthedocs.io/projects/adxl34x/en/latest/>
|
||||
BNO055 Accelerometer, Magnetometer, Gyroscope and Absolution Orientation <https://circuitpython.readthedocs.io/projects/bno055/en/latest/>
|
||||
FXAS21002C Gyroscope <https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/>
|
||||
FXOS8700 Accelerometer <https://circuitpython.readthedocs.io/projects/fxos8700/en/latest/>
|
||||
GPS Global Position <https://circuitpython.readthedocs.io/projects/gps/en/latest/>
|
||||
L3GD20 Gyroscope <https://circuitpython.readthedocs.io/projects/l3gd20/latest/>
|
||||
LIS3DH Accelerometer <https://circuitpython.readthedocs.io/projects/lis3dh/en/latest/>
|
||||
LSM303 Accelerometer and Magnetometer <https://circuitpython.readthedocs.io/projects/lsm303/en/latest/>
|
||||
LSM9DS0 Accelerometer, Magnetometer, Gyroscope and Temperature <https://circuitpython.readthedocs.io/projects/lsm9ds0/en/latest/>
|
||||
LSM9DS1 Accelerometer, Magnetometer, Gyroscope and Temperature <https://circuitpython.readthedocs.io/projects/lsm9ds1/en/latest/>
|
||||
MLX90390 3 Axis Mangetometer <https://circuitpython.readthedocs.io/projects/mlx90393/en/latest/>
|
||||
MMA8451 3 axis accelerometer <https://circuitpython.readthedocs.io/projects/mma8451/en/latest/>
|
||||
|
||||
Environmental Sensors
|
||||
----------------------
|
||||
|
||||
Sense attributes of the environment including ``temperature``, ``relative_humidity``, ``pressure``,
|
||||
equivalent carbon dioxide (``eco2`` / ``eCO2``), and total volatile organic compounds (``tvoc`` /
|
||||
``TVOC``).
|
||||
|
||||
.. toctree::
|
||||
|
||||
AM2320 Temperature and Humidity <https://circuitpython.readthedocs.io/projects/am2320/en/latest/>
|
||||
BME280 Temperature, Humidity and Pressure <https://circuitpython.readthedocs.io/projects/bme280/en/latest/>
|
||||
BME680 Temperature, Humidity, Pressure and Gas <https://circuitpython.readthedocs.io/projects/bme680/en/latest/>
|
||||
BMP280 Barometric Pressure and Altitude <https://circuitpython.readthedocs.io/projects/bmp280/en/latest/>
|
||||
BMP3xx Barometric Pressure and Altimeter <https://circuitpython.readthedocs.io/projects/bmp3xx/en/latest/>
|
||||
CCS811 Air Quality <https://circuitpython.readthedocs.io/projects/ccs811/en/latest/>
|
||||
DHT Temperature and Humidity <https://circuitpython.readthedocs.io/projects/dht/en/latest/>
|
||||
DS18x20 Temperature <https://circuitpython.readthedocs.io/projects/ds18x20/en/latest/>
|
||||
HTU21D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/htu21d/en/latest/>
|
||||
MAX31865 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31865/en/latest/>
|
||||
MAX31855 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31855/en/latest/>
|
||||
MAX31856 Thermocouple Amplifier, Temperature <https://circuitpython.readthedocs.io/projects/max31856/en/latest/>
|
||||
MCP9808 Temperature <https://circuitpython.readthedocs.io/projects/mcp9808/en/latest/>
|
||||
MP115A2 Barometric Pressure, Temperature <https://circuitpython.readthedocs.io/projects/mpl115a2/en/latest/>
|
||||
MPL3115A2 Barometric Pressure, Altitude and Temperature Sensor <https://circuitpython.readthedocs.io/projects/mpl3115a2/en/latest/>
|
||||
MPRLS Ported Absolute Pressure <https://circuitpython.readthedocs.io/projects/mprls/en/latest/>
|
||||
SGP30 Air Quality <https://circuitpython.readthedocs.io/projects/sgp30/en/latest/>
|
||||
SHT31-D Temperature and Humidity <https://circuitpython.readthedocs.io/projects/sht31d/en/latest/>
|
||||
Si7021 Temperature and Humidity <https://circuitpython.readthedocs.io/projects/si7021/en/latest/>
|
||||
Thermistor Temperature <https://circuitpython.readthedocs.io/projects/thermistor/en/latest/>
|
||||
TMP007 Contactless Temperature <https://circuitpython.readthedocs.io/projects/tmp007/en/latest/>
|
||||
MLX90614 Contactless Temperature <https://circuitpython.readthedocs.io/projects/mlx90614/en/latest/>
|
||||
|
||||
Light Sensors
|
||||
---------------
|
||||
|
||||
These sensors detect light related attributes such as ``color``, ``light`` (unit-less), and
|
||||
``lux`` (light in SI lux).
|
||||
|
||||
.. toctree::
|
||||
|
||||
APDS9960 Proximity, Light, RGB, and Gesture <https://circuitpython.readthedocs.io/projects/apds9960/en/latest/>
|
||||
AS726x Color Spectrum Sensor <https://circuitpython.readthedocs.io/projects/as726x/en/latest/>
|
||||
TCS34725 Color Sensor <https://circuitpython.readthedocs.io/projects/tcs34725/en/latest/>
|
||||
TSL2561 Light Sensor <https://circuitpython.readthedocs.io/projects/tsl2561/en/latest/>
|
||||
TSL2591 High Dynamic Range Light Sensor <https://circuitpython.readthedocs.io/projects/tsl2591/en/latest/>
|
||||
VCNL4010 Proximity and Light <https://circuitpython.readthedocs.io/projects/vcnl4010/en/latest/>
|
||||
VEML6070 UV Index <https://circuitpython.readthedocs.io/projects/veml6070/en/latest/>
|
||||
VEML6075 UV Index <https://circuitpython.readthedocs.io/projects/veml6075/en/latest/>
|
||||
|
||||
Distance Sensors
|
||||
------------------
|
||||
|
||||
These sensors measure the ``distance`` to another object and may also measure light level (``light`` and ``lux``).
|
||||
|
||||
.. toctree::
|
||||
|
||||
Garmin LIDARLite I2C <https://circuitpython.readthedocs.io/projects/lidarlite/en/latest/>
|
||||
TFmini IR Time of Flight ~30cm - 12m <https://circuitpython.readthedocs.io/projects/tfmini/en/latest/>
|
||||
VL6180x 5 - 100 mm <https://circuitpython.readthedocs.io/projects/vl6180x/en/latest/>
|
||||
VL53L0x ~30 - 1000 mm <https://circuitpython.readthedocs.io/projects/vl53l0x/en/latest/>
|
||||
HC-SR04 Ultrasonic Range Sensors <https://circuitpython.readthedocs.io/projects/hcsr04/en/latest/>
|
||||
|
||||
Radio
|
||||
--------
|
||||
|
||||
These chips communicate to other's over radio.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Adafruit Bluefruit LE SPI Friend <https://circuitpython.readthedocs.io/projects/bluefruitspi/en/latest/>
|
||||
RFM9x LoRa <https://circuitpython.readthedocs.io/projects/rfm9x/en/latest/>
|
||||
RFM69 Packet Radio <https://circuitpython.readthedocs.io/projects/rfm69/en/latest/>
|
||||
PN532 NFC/RFID <https://circuitpython.readthedocs.io/projects/pn532/en/latest/>
|
||||
|
||||
IO Expansion
|
||||
--------------
|
||||
|
||||
These provide functionality similar to `analogio`, `digitalio`, `pulseio`, and `touchio`.
|
||||
|
||||
.. toctree::
|
||||
|
||||
Adafruit SeeSaw <https://circuitpython.readthedocs.io/projects/seesaw/en/latest/>
|
||||
ADS1x15 Analog-to-Digital Converter <https://circuitpython.readthedocs.io/projects/ads1x15/en/latest/>
|
||||
Crickit Robotics Boards <<https://circuitpython.readthedocs.io/projects/crickit/en/latest/>
|
||||
DS2413 OneWire GPIO Expander <https://circuitpython.readthedocs.io/projects/ds2413/en/latest/>
|
||||
FocalTech Capacitive Touch <https://circuitpython.readthedocs.io/projects/focaltouch/en/latest/>
|
||||
MCP230xx GPIO Expander <https://circuitpython.readthedocs.io/projects/mcp230xx/en/latest/>
|
||||
MCP4725 Digital-to-Analog Converter <https://circuitpython.readthedocs.io/projects/mcp4725/en/latest/>
|
||||
PCA9685 16 x 12-bit PWM Driver <https://circuitpython.readthedocs.io/projects/pca9685/en/latest/>
|
||||
TLC5947 24 x 12-bit PWM Driver <https://circuitpython.readthedocs.io/projects/tlc5947/en/latest/>
|
||||
TLC59711 12 x 16-bit PWM Driver <https://circuitpython.readthedocs.io/projects/tlc59711/en/latest/>
|
||||
MPR121 Capacitive Touch Sensor <https://circuitpython.readthedocs.io/projects/mpr121/en/latest/>
|
||||
TCA9548 I2C Multiplexer <https://circuitpython.readthedocs.io/projects/tca9548a/en/latest/>
|
||||
MCP3xxx SPI ADC <https://circuitpython.readthedocs.io/projects/mcp3xxx/en/latest/>
|
||||
|
||||
Miscellaneous
|
||||
----------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
CAP1188 8-Key Capacitive Touch <https://circuitpython.readthedocs.io/projects/cap1188/en/latest/>
|
||||
Si4713 Stereo FM Transmitter <https://circuitpython.readthedocs.io/projects/si4713/en/latest/>
|
||||
AMG88xx Grid-Eye IR Camera <https://circuitpython.readthedocs.io/projects/amg88xx/en/latest/>
|
||||
Trellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/trellis/en/latest/>
|
||||
NeoTrellis 4x4 Keypad <https://circuitpython.readthedocs.io/projects/neotrellis/en/latest/>
|
||||
NeoTrellis M4 4x8 Keypad <https://circuitpython.readthedocs.io/projects/trellism4/en/latest/>
|
||||
DRV2605 Haptic Motor Controller <https://circuitpython.readthedocs.io/projects/drv2605/en/latest/>
|
||||
MAX9744 Audio Amplifier <https://circuitpython.readthedocs.io/projects/max9744/en/latest/>
|
||||
Si5351 Clock Generator <https://circuitpython.readthedocs.io/projects/si5351/en/latest/>
|
||||
Thermal Printer <https://circuitpython.readthedocs.io/projects/thermal_printer/en/latest/>
|
||||
VC0706 TTL Camera <https://circuitpython.readthedocs.io/projects/vc0706/en/latest/>
|
||||
INA219 High Side Current <https://circuitpython.readthedocs.io/projects/ina219/en/latest/>
|
||||
Fingerprint <https://circuitpython.readthedocs.io/projects/fingerprint/en/latest/>
|
||||
STMPE610 Resistive Touchscreen <https://circuitpython.readthedocs.io/projects/stmpe610/en/latest/>
|
||||
Matrix Keypad <https://circuitpython.readthedocs.io/projects/matrixkeypad/en/latest/>
|
||||
VS1053 Audio Codec <https://circuitpython.readthedocs.io/projects/vs1053/en/latest/>
|
||||
FRAM Non-Volatile Memory <https://circuitpython.readthedocs.io/projects/fram/en/latest/>
|
||||
74HC595 Shift Register <https://circuitpython.readthedocs.io/projects/74hc595/en/latest/>
|
||||
- Documentation is not available on ReadTheDocs at this time. See each library for any
|
||||
included documentation.
|
||||
|
|
|
@ -78,12 +78,12 @@ Not all of these functions and types are turned on in all CircuitPython ports, f
|
|||
|
||||
.. classmethod:: from_bytes(bytes, byteorder)
|
||||
|
||||
In CircuitPython, `byteorder` parameter must be positional (this is
|
||||
In CircuitPython, ``byteorder`` parameter must be positional (this is
|
||||
compatible with CPython).
|
||||
|
||||
.. method:: to_bytes(size, byteorder)
|
||||
|
||||
In CircuitPython, `byteorder` parameter must be positional (this is
|
||||
In CircuitPython, ``byteorder`` parameter must be positional (this is
|
||||
compatible with CPython).
|
||||
|
||||
.. function:: isinstance()
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//! <2012/12/20> V1.1.0
|
||||
//! 1. Optimize code
|
||||
//! 2. Add reg_dhcp_cbfunc()
|
||||
//! 3. Add DHCP_stop()
|
||||
//! 3. Add DHCP_stop()
|
||||
//! 4. Integrate check_DHCP_state() & DHCP_run() to DHCP_run()
|
||||
//! 5. Don't care system endian
|
||||
//! 6. Add comments
|
||||
|
@ -22,30 +22,30 @@
|
|||
//!
|
||||
//! Copyright (c) 2013, WIZnet Co., LTD.
|
||||
//! All rights reserved.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//!
|
||||
//! Redistribution and use in source and binary forms, with or without
|
||||
//! modification, are permitted provided that the following conditions
|
||||
//! are met:
|
||||
//!
|
||||
//! * Redistributions of source code must retain the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer.
|
||||
//! * Redistributions in binary form must reproduce the above copyright
|
||||
//! notice, this list of conditions and the following disclaimer in the
|
||||
//! documentation and/or other materials provided with the distribution.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! documentation and/or other materials provided with the distribution.
|
||||
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
||||
//! contributors may be used to endorse or promote products derived
|
||||
//! from this software without specific prior written permission.
|
||||
//!
|
||||
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
//! THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* DHCP state machine. */
|
||||
#define STATE_DHCP_INIT 0 ///< Initialize
|
||||
|
@ -70,7 +70,7 @@
|
|||
#define STATE_DHCP_RELEASE 5 ///< No use
|
||||
#define STATE_DHCP_STOP 6 ///< Stop processing DHCP
|
||||
|
||||
#define DHCP_FLAGSBROADCAST 0x8000 ///< The broadcast value of flags in @ref RIP_MSG
|
||||
#define DHCP_FLAGSBROADCAST 0x8000 ///< The broadcast value of flags in @ref RIP_MSG
|
||||
#define DHCP_FLAGSUNICAST 0x0000 ///< The unicast value of flags in @ref RIP_MSG
|
||||
|
||||
/* DHCP message OP code */
|
||||
|
@ -99,7 +99,7 @@
|
|||
#define OPT_SIZE 312 /// Max OPT size of @ref RIP_MSG
|
||||
#define RIP_MSG_SIZE (236+OPT_SIZE) /// Max size of @ref RIP_MSG
|
||||
|
||||
/*
|
||||
/*
|
||||
* @brief DHCP option and value (cf. RFC1533)
|
||||
*/
|
||||
enum
|
||||
|
@ -171,7 +171,7 @@ enum
|
|||
|
||||
/*
|
||||
* @brief DHCP message format
|
||||
*/
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t op; ///< @ref DHCP_BOOTREQUEST or @ref DHCP_BOOTREPLY
|
||||
uint8_t htype; ///< @ref DHCP_HTYPE10MB or @ref DHCP_HTYPE100MB
|
||||
|
@ -182,7 +182,7 @@ typedef struct {
|
|||
uint16_t flags; ///< @ref DHCP_FLAGSBROADCAST or @ref DHCP_FLAGSUNICAST
|
||||
uint8_t ciaddr[4]; ///< @ref Request IP to DHCP sever
|
||||
uint8_t yiaddr[4]; ///< @ref Offered IP from DHCP server
|
||||
uint8_t siaddr[4]; ///< No use
|
||||
uint8_t siaddr[4]; ///< No use
|
||||
uint8_t giaddr[4]; ///< No use
|
||||
uint8_t chaddr[16]; ///< DHCP client 6bytes MAC address. Others is filled to zero
|
||||
uint8_t sname[64]; ///< No use
|
||||
|
@ -205,7 +205,7 @@ uint8_t DHCP_allocated_dns[4] = {0, }; // DNS address from DHCP
|
|||
|
||||
|
||||
int8_t dhcp_state = STATE_DHCP_INIT; // DHCP state
|
||||
int8_t dhcp_retry_count = 0;
|
||||
int8_t dhcp_retry_count = 0;
|
||||
|
||||
uint32_t dhcp_lease_time = INFINITE_LEASETIME;
|
||||
volatile uint32_t dhcp_tick_1s = 0; // unit 1 second
|
||||
|
@ -215,7 +215,7 @@ uint32_t DHCP_XID; // Any number
|
|||
|
||||
RIP_MSG* pDHCPMSG; // Buffer pointer for DHCP processing
|
||||
|
||||
uint8_t HOST_NAME[] = DCHP_HOST_NAME;
|
||||
uint8_t HOST_NAME[] = DCHP_HOST_NAME;
|
||||
|
||||
uint8_t DHCP_CHADDR[6]; // DHCP Client MAC address.
|
||||
|
||||
|
@ -306,9 +306,9 @@ void makeDHCPMSG(void)
|
|||
*(ptmp+0) = (uint8_t)((DHCP_XID & 0xFF000000) >> 24);
|
||||
*(ptmp+1) = (uint8_t)((DHCP_XID & 0x00FF0000) >> 16);
|
||||
*(ptmp+2) = (uint8_t)((DHCP_XID & 0x0000FF00) >> 8);
|
||||
*(ptmp+3) = (uint8_t)((DHCP_XID & 0x000000FF) >> 0);
|
||||
*(ptmp+3) = (uint8_t)((DHCP_XID & 0x000000FF) >> 0);
|
||||
pDHCPMSG->secs = DHCP_SECS;
|
||||
ptmp = (uint8_t*)(&pDHCPMSG->flags);
|
||||
ptmp = (uint8_t*)(&pDHCPMSG->flags);
|
||||
*(ptmp+0) = (uint8_t)((DHCP_FLAGSBROADCAST & 0xFF00) >> 8);
|
||||
*(ptmp+1) = (uint8_t)((DHCP_FLAGSBROADCAST & 0x00FF) >> 0);
|
||||
|
||||
|
@ -356,16 +356,16 @@ void send_DHCP_DISCOVER(void)
|
|||
uint16_t i;
|
||||
uint8_t ip[4];
|
||||
uint16_t k = 0;
|
||||
|
||||
|
||||
makeDHCPMSG();
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
|
||||
// Option Request Param
|
||||
pDHCPMSG->OPT[k++] = dhcpMessageType;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
pDHCPMSG->OPT[k++] = DHCP_DISCOVER;
|
||||
|
||||
|
||||
// Client identifier
|
||||
pDHCPMSG->OPT[k++] = dhcpClientIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x07;
|
||||
|
@ -376,10 +376,10 @@ void send_DHCP_DISCOVER(void)
|
|||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
|
||||
|
||||
// host name
|
||||
pDHCPMSG->OPT[k++] = hostName;
|
||||
pDHCPMSG->OPT[k++] = 0; // fill zero length of hostname
|
||||
pDHCPMSG->OPT[k++] = 0; // fill zero length of hostname
|
||||
for(i = 0 ; HOST_NAME[i] != 0; i++)
|
||||
pDHCPMSG->OPT[k++] = HOST_NAME[i];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
|
@ -432,18 +432,18 @@ void send_DHCP_REQUEST(void)
|
|||
ip[0] = DHCP_SIP[0];
|
||||
ip[1] = DHCP_SIP[1];
|
||||
ip[2] = DHCP_SIP[2];
|
||||
ip[3] = DHCP_SIP[3];
|
||||
ip[3] = DHCP_SIP[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
ip[0] = 255;
|
||||
ip[1] = 255;
|
||||
ip[2] = 255;
|
||||
ip[3] = 255;
|
||||
ip[3] = 255;
|
||||
}
|
||||
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
|
||||
// Option Request Param.
|
||||
pDHCPMSG->OPT[k++] = dhcpMessageType;
|
||||
pDHCPMSG->OPT[k++] = 0x01;
|
||||
|
@ -467,7 +467,7 @@ void send_DHCP_REQUEST(void)
|
|||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[1];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[2];
|
||||
pDHCPMSG->OPT[k++] = DHCP_allocated_ip[3];
|
||||
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpServerIdentifier;
|
||||
pDHCPMSG->OPT[k++] = 0x04;
|
||||
pDHCPMSG->OPT[k++] = DHCP_SIP[0];
|
||||
|
@ -485,7 +485,7 @@ void send_DHCP_REQUEST(void)
|
|||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
pDHCPMSG->OPT[k - (i+3+1)] = i+3; // length of hostname
|
||||
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpParamRequest;
|
||||
pDHCPMSG->OPT[k++] = 0x08;
|
||||
pDHCPMSG->OPT[k++] = subnetMask;
|
||||
|
@ -503,7 +503,7 @@ void send_DHCP_REQUEST(void)
|
|||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Send DHCP_REQUEST\r\n");
|
||||
#endif
|
||||
|
||||
|
||||
WIZCHIP_EXPORT(sendto)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, RIP_MSG_SIZE, ip, DHCP_SERVER_PORT);
|
||||
|
||||
}
|
||||
|
@ -514,11 +514,11 @@ void send_DHCP_DECLINE(void)
|
|||
int i;
|
||||
uint8_t ip[4];
|
||||
uint16_t k = 0;
|
||||
|
||||
|
||||
makeDHCPMSG();
|
||||
|
||||
k = 4; // because MAGIC_COOKIE already made by makeDHCPMSG()
|
||||
|
||||
|
||||
*((uint8_t*)(&pDHCPMSG->flags)) = ((DHCP_FLAGSUNICAST & 0xFF00)>> 8);
|
||||
*((uint8_t*)(&pDHCPMSG->flags)+1) = (DHCP_FLAGSUNICAST & 0x00FF);
|
||||
|
||||
|
@ -577,15 +577,15 @@ int8_t parseDHCPMSG(void)
|
|||
|
||||
uint8_t * p;
|
||||
uint8_t * e;
|
||||
uint8_t type;
|
||||
uint8_t type = 0;
|
||||
uint8_t opt_len;
|
||||
|
||||
|
||||
if((len = getSn_RX_RSR(DHCP_SOCKET)) > 0)
|
||||
{
|
||||
len = WIZCHIP_EXPORT(recvfrom)(DHCP_SOCKET, (uint8_t *)pDHCPMSG, len, svr_addr, &svr_port);
|
||||
#ifdef _DHCP_DEBUG_
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("DHCP message : %d.%d.%d.%d(%d) %d received. \r\n",svr_addr[0],svr_addr[1],svr_addr[2], svr_addr[3],svr_port, len);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else return 0;
|
||||
if (svr_port == DHCP_SERVER_PORT) {
|
||||
|
@ -624,7 +624,7 @@ int8_t parseDHCPMSG(void)
|
|||
break;
|
||||
case routersOnSubnet :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
opt_len = *p++;
|
||||
DHCP_allocated_gw[0] = *p++;
|
||||
DHCP_allocated_gw[1] = *p++;
|
||||
DHCP_allocated_gw[2] = *p++;
|
||||
|
@ -632,8 +632,8 @@ int8_t parseDHCPMSG(void)
|
|||
p = p + (opt_len - 4);
|
||||
break;
|
||||
case dns :
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
p++;
|
||||
opt_len = *p++;
|
||||
DHCP_allocated_dns[0] = *p++;
|
||||
DHCP_allocated_dns[1] = *p++;
|
||||
DHCP_allocated_dns[2] = *p++;
|
||||
|
@ -647,7 +647,7 @@ int8_t parseDHCPMSG(void)
|
|||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
dhcp_lease_time = (dhcp_lease_time << 8) + *p++;
|
||||
#ifdef _DHCP_DEBUG_
|
||||
#ifdef _DHCP_DEBUG_
|
||||
dhcp_lease_time = 10;
|
||||
#endif
|
||||
break;
|
||||
|
@ -740,7 +740,7 @@ uint8_t DHCP_run(void)
|
|||
case STATE_DHCP_LEASED :
|
||||
ret = DHCP_IP_LEASED;
|
||||
if ((dhcp_lease_time != INFINITE_LEASETIME) && ((dhcp_lease_time/2) < dhcp_tick_1s)) {
|
||||
|
||||
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf("> Maintains the IP address \r\n");
|
||||
#endif
|
||||
|
@ -750,7 +750,7 @@ uint8_t DHCP_run(void)
|
|||
OLD_allocated_ip[1] = DHCP_allocated_ip[1];
|
||||
OLD_allocated_ip[2] = DHCP_allocated_ip[2];
|
||||
OLD_allocated_ip[3] = DHCP_allocated_ip[3];
|
||||
|
||||
|
||||
DHCP_XID++;
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
|
@ -765,21 +765,21 @@ uint8_t DHCP_run(void)
|
|||
ret = DHCP_IP_LEASED;
|
||||
if (type == DHCP_ACK) {
|
||||
dhcp_retry_count = 0;
|
||||
if (OLD_allocated_ip[0] != DHCP_allocated_ip[0] ||
|
||||
if (OLD_allocated_ip[0] != DHCP_allocated_ip[0] ||
|
||||
OLD_allocated_ip[1] != DHCP_allocated_ip[1] ||
|
||||
OLD_allocated_ip[2] != DHCP_allocated_ip[2] ||
|
||||
OLD_allocated_ip[3] != DHCP_allocated_ip[3])
|
||||
OLD_allocated_ip[3] != DHCP_allocated_ip[3])
|
||||
{
|
||||
ret = DHCP_IP_CHANGED;
|
||||
dhcp_ip_update();
|
||||
#ifdef _DHCP_DEBUG_
|
||||
printf(">IP changed.\r\n");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
#ifdef _DHCP_DEBUG_
|
||||
else printf(">IP is continued.\r\n");
|
||||
#endif
|
||||
#endif
|
||||
reset_DHCP_timeout();
|
||||
dhcp_state = STATE_DHCP_LEASED;
|
||||
} else if (type == DHCP_NAK) {
|
||||
|
@ -809,7 +809,7 @@ void DHCP_stop(void)
|
|||
uint8_t check_DHCP_timeout(void)
|
||||
{
|
||||
uint8_t ret = DHCP_RUNNING;
|
||||
|
||||
|
||||
if (dhcp_retry_count < MAX_DHCP_RETRY) {
|
||||
if (dhcp_tick_next < dhcp_tick_1s) {
|
||||
|
||||
|
@ -818,7 +818,7 @@ uint8_t check_DHCP_timeout(void)
|
|||
// printf("<<timeout>> state : STATE_DHCP_DISCOVER\r\n");
|
||||
send_DHCP_DISCOVER();
|
||||
break;
|
||||
|
||||
|
||||
case STATE_DHCP_REQUEST :
|
||||
// printf("<<timeout>> state : STATE_DHCP_REQUEST\r\n");
|
||||
|
||||
|
@ -827,10 +827,10 @@ uint8_t check_DHCP_timeout(void)
|
|||
|
||||
case STATE_DHCP_REREQUEST :
|
||||
// printf("<<timeout>> state : STATE_DHCP_REREQUEST\r\n");
|
||||
|
||||
|
||||
send_DHCP_REQUEST();
|
||||
break;
|
||||
|
||||
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ int8_t check_DHCP_leasedIP(void)
|
|||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf)
|
||||
{
|
||||
|
@ -903,11 +903,11 @@ void DHCP_init(uint8_t s, DHCP_INIT_BUFFER_TYPE* buf)
|
|||
// assign temporary mac address, you should be set SHAR before call this function.
|
||||
DHCP_CHADDR[0] = 0x00;
|
||||
DHCP_CHADDR[1] = 0x08;
|
||||
DHCP_CHADDR[2] = 0xdc;
|
||||
DHCP_CHADDR[2] = 0xdc;
|
||||
DHCP_CHADDR[3] = 0x00;
|
||||
DHCP_CHADDR[4] = 0x00;
|
||||
DHCP_CHADDR[5] = 0x00;
|
||||
setSHAR(DHCP_CHADDR);
|
||||
DHCP_CHADDR[5] = 0x00;
|
||||
setSHAR(DHCP_CHADDR);
|
||||
}
|
||||
|
||||
DHCP_SOCKET = s; // SOCK_DHCP
|
||||
|
@ -941,7 +941,7 @@ void getIPfromDHCP(uint8_t* ip)
|
|||
{
|
||||
ip[0] = DHCP_allocated_ip[0];
|
||||
ip[1] = DHCP_allocated_ip[1];
|
||||
ip[2] = DHCP_allocated_ip[2];
|
||||
ip[2] = DHCP_allocated_ip[2];
|
||||
ip[3] = DHCP_allocated_ip[3];
|
||||
}
|
||||
|
||||
|
@ -950,7 +950,7 @@ void getGWfromDHCP(uint8_t* ip)
|
|||
ip[0] =DHCP_allocated_gw[0];
|
||||
ip[1] =DHCP_allocated_gw[1];
|
||||
ip[2] =DHCP_allocated_gw[2];
|
||||
ip[3] =DHCP_allocated_gw[3];
|
||||
ip[3] =DHCP_allocated_gw[3];
|
||||
}
|
||||
|
||||
void getSNfromDHCP(uint8_t* ip)
|
||||
|
@ -958,7 +958,7 @@ void getSNfromDHCP(uint8_t* ip)
|
|||
ip[0] = DHCP_allocated_sn[0];
|
||||
ip[1] = DHCP_allocated_sn[1];
|
||||
ip[2] = DHCP_allocated_sn[2];
|
||||
ip[3] = DHCP_allocated_sn[3];
|
||||
ip[3] = DHCP_allocated_sn[3];
|
||||
}
|
||||
|
||||
void getDNSfromDHCP(uint8_t* ip)
|
||||
|
@ -966,14 +966,10 @@ void getDNSfromDHCP(uint8_t* ip)
|
|||
ip[0] = DHCP_allocated_dns[0];
|
||||
ip[1] = DHCP_allocated_dns[1];
|
||||
ip[2] = DHCP_allocated_dns[2];
|
||||
ip[3] = DHCP_allocated_dns[3];
|
||||
ip[3] = DHCP_allocated_dns[3];
|
||||
}
|
||||
|
||||
uint32_t getDHCPLeasetime(void)
|
||||
{
|
||||
return dhcp_lease_time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -287,14 +287,14 @@ STATIC void machine_i2c_obj_init_helper(machine_i2c_obj_t *self, size_t n_args,
|
|||
mp_hal_i2c_init(self, args[ARG_freq].u_int);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
// check the id argument, if given
|
||||
if (n_args > 0) {
|
||||
if (args[0] != MP_OBJ_NEW_SMALL_INT(-1)) {
|
||||
#if defined(MICROPY_PY_MACHINE_I2C_MAKE_NEW)
|
||||
// dispatch to port-specific constructor
|
||||
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, n_kw, args);
|
||||
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args);
|
||||
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, args, kw_args);
|
||||
#else
|
||||
mp_raise_ValueError(translate("invalid I2C peripheral"));
|
||||
#endif
|
||||
|
@ -306,9 +306,7 @@ STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, s
|
|||
// create new soft I2C object
|
||||
machine_i2c_obj_t *self = m_new_obj(machine_i2c_obj_t);
|
||||
self->base.type = &machine_i2c_type;
|
||||
mp_map_t kw_args;
|
||||
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
|
||||
machine_i2c_obj_init_helper(self, n_args, args, &kw_args);
|
||||
machine_i2c_obj_init_helper(self, n_args, args, kw_args);
|
||||
return (mp_obj_t)self;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ STATIC const mp_pinbase_t pinbase_singleton = {
|
|||
.base = { &machine_pinbase_type },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
(void)type;
|
||||
(void)n_args;
|
||||
(void)n_kw;
|
||||
(void)args;
|
||||
(void)kw_args;
|
||||
return MP_OBJ_FROM_PTR(&pinbase_singleton);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef struct _machine_signal_t {
|
|||
bool invert;
|
||||
} machine_signal_t;
|
||||
|
||||
STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_obj_t pin = args[0];
|
||||
bool invert = false;
|
||||
|
||||
|
@ -96,9 +96,9 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
|
|||
// Otherwise there should be 1 or 2 args
|
||||
{
|
||||
if (n_args == 1) {
|
||||
if (n_kw == 0) {
|
||||
} else if (n_kw == 1 && args[1] == MP_OBJ_NEW_QSTR(MP_QSTR_invert)) {
|
||||
invert = mp_obj_is_true(args[2]);
|
||||
if (kw_args == NULL || kw_args->used == 0) {
|
||||
} else if (kw_args->used == 1 && kw_args->table[0].key == MP_OBJ_NEW_QSTR(MP_QSTR_invert)) {
|
||||
invert = mp_obj_is_true(kw_args->table[0].value);
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ STATIC mp_uint_t signal_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg
|
|||
|
||||
// fast method for getting/setting signal value
|
||||
STATIC mp_obj_t signal_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, false);
|
||||
mp_arg_check_num_kw_array(n_args, n_kw, 0, 1, false);
|
||||
if (n_args == 0) {
|
||||
// get pin
|
||||
return MP_OBJ_NEW_SMALL_INT(mp_virtual_pin_read(self_in));
|
||||
|
|
|
@ -43,16 +43,16 @@
|
|||
/******************************************************************************/
|
||||
// MicroPython bindings for generic machine.SPI
|
||||
|
||||
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
|
||||
mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
// check the id argument, if given
|
||||
if (n_args > 0) {
|
||||
if (args[0] != MP_OBJ_NEW_SMALL_INT(-1)) {
|
||||
#if defined(MICROPY_PY_MACHINE_SPI_MAKE_NEW)
|
||||
// dispatch to port-specific constructor
|
||||
extern mp_obj_t MICROPY_PY_MACHINE_SPI_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
|
||||
return MICROPY_PY_MACHINE_SPI_MAKE_NEW(type, n_args, n_kw, args);
|
||||
extern mp_obj_t MICROPY_PY_MACHINE_SPI_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
return MICROPY_PY_MACHINE_SPI_MAKE_NEW(type, n_args, args, kw_args);
|
||||
#else
|
||||
mp_raise_ValueError(translate("invalid SPI peripheral"));
|
||||
#endif
|
||||
|
@ -62,7 +62,7 @@ mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
|||
}
|
||||
|
||||
// software SPI
|
||||
return mp_machine_soft_spi_make_new(type, n_args, n_kw, args);
|
||||
return mp_machine_soft_spi_make_new(type, n_args, args, kw_args);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
|
@ -180,7 +180,7 @@ STATIC void mp_machine_soft_spi_print(const mp_print_t *print, mp_obj_t self_in,
|
|||
mp_hal_pin_name(self->spi.sck), mp_hal_pin_name(self->spi.mosi), mp_hal_pin_name(self->spi.miso));
|
||||
}
|
||||
|
||||
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) {
|
||||
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_sck, ARG_mosi, ARG_miso };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 500000} },
|
||||
|
@ -193,7 +193,7 @@ STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n
|
|||
{ MP_QSTR_miso, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
mp_arg_parse_all(n_args, all_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
// create new object
|
||||
mp_machine_soft_spi_obj_t *self = m_new_obj(mp_machine_soft_spi_obj_t);
|
||||
|
|
|
@ -259,8 +259,8 @@ STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, u
|
|||
formats[fb->format].fill_rect(fb, x, y, xend - x, yend - y, col);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 4, 5, false);
|
||||
STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 4, 5, false);
|
||||
|
||||
mp_obj_framebuf_t *o = m_new_obj(mp_obj_framebuf_t);
|
||||
o->base.type = type;
|
||||
|
|
|
@ -122,8 +122,8 @@ STATIC NORETURN void syntax_error(void) {
|
|||
mp_raise_TypeError(translate("syntax error in uctypes descriptor"));
|
||||
}
|
||||
|
||||
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 2, 3, false);
|
||||
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 2, 3, false);
|
||||
mp_obj_uctypes_struct_t *o = m_new_obj(mp_obj_uctypes_struct_t);
|
||||
o->base.type = type;
|
||||
o->addr = (void*)(uintptr_t)mp_obj_int_get_truncated(args[0]);
|
||||
|
|
|
@ -66,8 +66,8 @@ STATIC mp_obj_t uhashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);
|
|||
|
||||
#if MICROPY_SSL_MBEDTLS
|
||||
|
||||
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, false);
|
||||
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 1, false);
|
||||
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(mbedtls_sha256_context));
|
||||
o->base.type = type;
|
||||
mbedtls_sha256_init((mbedtls_sha256_context*)&o->state);
|
||||
|
@ -104,8 +104,8 @@ static void check_not_unicode(const mp_obj_t arg) {
|
|||
#endif
|
||||
}
|
||||
|
||||
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, false);
|
||||
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 1, false);
|
||||
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
|
||||
o->base.type = type;
|
||||
sha256_init((CRYAL_SHA256_CTX*)o->state);
|
||||
|
@ -155,8 +155,8 @@ STATIC const mp_obj_type_t uhashlib_sha256_type = {
|
|||
STATIC mp_obj_t uhashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg);
|
||||
|
||||
#if MICROPY_SSL_AXTLS
|
||||
STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, false);
|
||||
STATIC mp_obj_t uhashlib_sha1_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 1, false);
|
||||
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(SHA1_CTX));
|
||||
o->base.type = type;
|
||||
SHA1_Init((SHA1_CTX*)o->state);
|
||||
|
|
|
@ -292,7 +292,11 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
|
|||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_loads_obj, mod_ujson_loads);
|
||||
|
||||
STATIC const mp_rom_map_elem_t mp_module_ujson_globals_table[] = {
|
||||
#if CIRCUITPY
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_json) },
|
||||
#else
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ujson) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_ujson_dump_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_dumps), MP_ROM_PTR(&mod_ujson_dumps_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_load), MP_ROM_PTR(&mod_ujson_load_obj) },
|
||||
|
|
240
extmod/modure.c
240
extmod/modure.c
|
@ -77,8 +77,83 @@ STATIC mp_obj_t match_group(mp_obj_t self_in, mp_obj_t no_in) {
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(match_group_obj, match_group);
|
||||
|
||||
#if MICROPY_PY_URE_MATCH_GROUPS
|
||||
|
||||
STATIC mp_obj_t match_groups(mp_obj_t self_in) {
|
||||
mp_obj_match_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->num_matches <= 1) {
|
||||
return mp_const_empty_tuple;
|
||||
}
|
||||
mp_obj_tuple_t *groups = MP_OBJ_TO_PTR(mp_obj_new_tuple(self->num_matches - 1, NULL));
|
||||
for (int i = 1; i < self->num_matches; ++i) {
|
||||
groups->items[i - 1] = match_group(self_in, MP_OBJ_NEW_SMALL_INT(i));
|
||||
}
|
||||
return MP_OBJ_FROM_PTR(groups);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(match_groups_obj, match_groups);
|
||||
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_URE_MATCH_SPAN_START_END
|
||||
|
||||
STATIC void match_span_helper(size_t n_args, const mp_obj_t *args, mp_obj_t span[2]) {
|
||||
mp_obj_match_t *self = MP_OBJ_TO_PTR(args[0]);
|
||||
|
||||
mp_int_t no = 0;
|
||||
if (n_args == 2) {
|
||||
no = mp_obj_get_int(args[1]);
|
||||
if (no < 0 || no >= self->num_matches) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, args[1]));
|
||||
}
|
||||
}
|
||||
|
||||
mp_int_t s = -1;
|
||||
mp_int_t e = -1;
|
||||
const char *start = self->caps[no * 2];
|
||||
if (start != NULL) {
|
||||
// have a match for this group
|
||||
const char *begin = mp_obj_str_get_str(self->str);
|
||||
s = start - begin;
|
||||
e = self->caps[no * 2 + 1] - begin;
|
||||
}
|
||||
|
||||
span[0] = mp_obj_new_int(s);
|
||||
span[1] = mp_obj_new_int(e);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t match_span(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_t span[2];
|
||||
match_span_helper(n_args, args, span);
|
||||
return mp_obj_new_tuple(2, span);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_span_obj, 1, 2, match_span);
|
||||
|
||||
STATIC mp_obj_t match_start(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_t span[2];
|
||||
match_span_helper(n_args, args, span);
|
||||
return span[0];
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_start_obj, 1, 2, match_start);
|
||||
|
||||
STATIC mp_obj_t match_end(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_t span[2];
|
||||
match_span_helper(n_args, args, span);
|
||||
return span[1];
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(match_end_obj, 1, 2, match_end);
|
||||
|
||||
#endif
|
||||
|
||||
STATIC const mp_rom_map_elem_t match_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_group), MP_ROM_PTR(&match_group_obj) },
|
||||
#if MICROPY_PY_URE_MATCH_GROUPS
|
||||
{ MP_ROM_QSTR(MP_QSTR_groups), MP_ROM_PTR(&match_groups_obj) },
|
||||
#endif
|
||||
#if MICROPY_PY_URE_MATCH_SPAN_START_END
|
||||
{ MP_ROM_QSTR(MP_QSTR_span), MP_ROM_PTR(&match_span_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_start), MP_ROM_PTR(&match_start_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_end), MP_ROM_PTR(&match_end_obj) },
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table);
|
||||
|
@ -103,6 +178,35 @@ STATIC mp_obj_t ure_exec(bool is_anchored, uint n_args, const mp_obj_t *args) {
|
|||
size_t len;
|
||||
subj.begin = mp_obj_str_get_data(args[1], &len);
|
||||
subj.end = subj.begin + len;
|
||||
#if MICROPY_PY_URE_MATCH_SPAN_START_END
|
||||
if (n_args > 2) {
|
||||
const mp_obj_type_t *self_type = mp_obj_get_type(args[1]);
|
||||
mp_int_t str_len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len_maybe(args[1]));
|
||||
const byte *begin = (const byte *)subj.begin;
|
||||
|
||||
int pos = mp_obj_get_int(args[2]);
|
||||
if (pos >= str_len) {
|
||||
return mp_const_none;
|
||||
}
|
||||
if (pos < 0) {
|
||||
pos = 0;
|
||||
}
|
||||
const byte *pos_ptr = str_index_to_ptr(self_type, begin, len, MP_OBJ_NEW_SMALL_INT(pos), true);
|
||||
|
||||
const byte *endpos_ptr = (const byte *)subj.end;
|
||||
if (n_args > 3) {
|
||||
int endpos = mp_obj_get_int(args[3]);
|
||||
if (endpos <= pos) {
|
||||
return mp_const_none;
|
||||
}
|
||||
// Will cap to length
|
||||
endpos_ptr = str_index_to_ptr(self_type, begin, len, args[3], true);
|
||||
}
|
||||
|
||||
subj.begin = (const char *)pos_ptr;
|
||||
subj.end = (const char *)endpos_ptr;
|
||||
}
|
||||
#endif
|
||||
int caps_num = (self->re.sub + 1) * 2;
|
||||
mp_obj_match_t *match = m_new_obj_var(mp_obj_match_t, char*, caps_num);
|
||||
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
|
||||
|
@ -174,17 +278,138 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) {
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_split_obj, 2, 3, re_split);
|
||||
|
||||
#if MICROPY_PY_URE_SUB
|
||||
|
||||
STATIC mp_obj_t re_sub_helper(mp_obj_t self_in, size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_re_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_obj_t replace = args[1];
|
||||
mp_obj_t where = args[2];
|
||||
mp_int_t count = 0;
|
||||
if (n_args > 3) {
|
||||
count = mp_obj_get_int(args[3]);
|
||||
// Note: flags are currently ignored
|
||||
}
|
||||
|
||||
size_t where_len;
|
||||
const char *where_str = mp_obj_str_get_data(where, &where_len);
|
||||
Subject subj;
|
||||
subj.begin = where_str;
|
||||
subj.end = subj.begin + where_len;
|
||||
int caps_num = (self->re.sub + 1) * 2;
|
||||
|
||||
vstr_t vstr_return;
|
||||
vstr_return.buf = NULL; // We'll init the vstr after the first match
|
||||
mp_obj_match_t *match = mp_local_alloc(sizeof(mp_obj_match_t) + caps_num * sizeof(char*));
|
||||
match->base.type = &match_type;
|
||||
match->num_matches = caps_num / 2; // caps_num counts start and end pointers
|
||||
match->str = where;
|
||||
|
||||
for (;;) {
|
||||
// cast is a workaround for a bug in msvc: it treats const char** as a const pointer instead of a pointer to pointer to const char
|
||||
memset((char*)match->caps, 0, caps_num * sizeof(char*));
|
||||
int res = re1_5_recursiveloopprog(&self->re, &subj, match->caps, caps_num, false);
|
||||
|
||||
// If we didn't have a match, or had an empty match, it's time to stop
|
||||
if (!res || match->caps[0] == match->caps[1]) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Initialise the vstr if it's not already
|
||||
if (vstr_return.buf == NULL) {
|
||||
vstr_init(&vstr_return, match->caps[0] - subj.begin);
|
||||
}
|
||||
|
||||
// Add pre-match string
|
||||
vstr_add_strn(&vstr_return, subj.begin, match->caps[0] - subj.begin);
|
||||
|
||||
// Get replacement string
|
||||
const char* repl = mp_obj_str_get_str((mp_obj_is_callable(replace) ? mp_call_function_1(replace, MP_OBJ_FROM_PTR(match)) : replace));
|
||||
|
||||
// Append replacement string to result, substituting any regex groups
|
||||
while (*repl != '\0') {
|
||||
if (*repl == '\\') {
|
||||
++repl;
|
||||
bool is_g_format = false;
|
||||
if (*repl == 'g' && repl[1] == '<') {
|
||||
// Group specified with syntax "\g<number>"
|
||||
repl += 2;
|
||||
is_g_format = true;
|
||||
}
|
||||
|
||||
if ('0' <= *repl && *repl <= '9') {
|
||||
// Group specified with syntax "\g<number>" or "\number"
|
||||
unsigned int match_no = 0;
|
||||
do {
|
||||
match_no = match_no * 10 + (*repl++ - '0');
|
||||
} while ('0' <= *repl && *repl <= '9');
|
||||
if (is_g_format && *repl == '>') {
|
||||
++repl;
|
||||
}
|
||||
|
||||
if (match_no >= (unsigned int)match->num_matches) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_IndexError, MP_OBJ_NEW_SMALL_INT(match_no)));
|
||||
}
|
||||
|
||||
const char *start_match = match->caps[match_no * 2];
|
||||
if (start_match != NULL) {
|
||||
// Add the substring matched by group
|
||||
const char *end_match = match->caps[match_no * 2 + 1];
|
||||
vstr_add_strn(&vstr_return, start_match, end_match - start_match);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Just add the current byte from the replacement string
|
||||
vstr_add_byte(&vstr_return, *repl++);
|
||||
}
|
||||
}
|
||||
|
||||
// Move start pointer to end of last match
|
||||
subj.begin = match->caps[1];
|
||||
|
||||
// Stop substitutions if count was given and gets to 0
|
||||
if (count > 0 && --count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mp_local_free(match);
|
||||
|
||||
if (vstr_return.buf == NULL) {
|
||||
// Optimisation for case of no substitutions
|
||||
return where;
|
||||
}
|
||||
|
||||
// Add post-match string
|
||||
vstr_add_strn(&vstr_return, subj.begin, subj.end - subj.begin);
|
||||
|
||||
return mp_obj_new_str_from_vstr(mp_obj_get_type(where), &vstr_return);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t re_sub(size_t n_args, const mp_obj_t *args) {
|
||||
return re_sub_helper(args[0], n_args, args);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(re_sub_obj, 3, 5, re_sub);
|
||||
|
||||
#endif
|
||||
|
||||
STATIC const mp_rom_map_elem_t re_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&re_match_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_search), MP_ROM_PTR(&re_search_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_split), MP_ROM_PTR(&re_split_obj) },
|
||||
#if MICROPY_PY_URE_SUB
|
||||
{ MP_ROM_QSTR(MP_QSTR_sub), MP_ROM_PTR(&re_sub_obj) },
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table);
|
||||
|
||||
STATIC const mp_obj_type_t re_type = {
|
||||
{ &mp_type_type },
|
||||
#if CIRCUITPY
|
||||
.name = MP_QSTR_re,
|
||||
#else
|
||||
.name = MP_QSTR_ure,
|
||||
#endif
|
||||
.print = re_print,
|
||||
.locals_dict = (void*)&re_locals_dict,
|
||||
};
|
||||
|
@ -232,11 +457,26 @@ STATIC mp_obj_t mod_re_search(size_t n_args, const mp_obj_t *args) {
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_search_obj, 2, 4, mod_re_search);
|
||||
|
||||
#if MICROPY_PY_URE_SUB
|
||||
STATIC mp_obj_t mod_re_sub(size_t n_args, const mp_obj_t *args) {
|
||||
mp_obj_t self = mod_re_compile(1, args);
|
||||
return re_sub_helper(self, n_args, args);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_sub_obj, 3, 5, mod_re_sub);
|
||||
#endif
|
||||
|
||||
STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
|
||||
#if CIRCUITPY
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_re) },
|
||||
#else
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ure) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_compile), MP_ROM_PTR(&mod_re_compile_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_match), MP_ROM_PTR(&mod_re_match_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_search), MP_ROM_PTR(&mod_re_search_obj) },
|
||||
#if MICROPY_PY_URE_SUB
|
||||
{ MP_ROM_QSTR(MP_QSTR_sub), MP_ROM_PTR(&mod_re_sub_obj) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_DEBUG), MP_ROM_INT(FLAG_DEBUG) },
|
||||
};
|
||||
|
||||
|
|
|
@ -76,8 +76,8 @@ STATIC bool time_less_than(struct qentry *item, struct qentry *parent) {
|
|||
return res && res < (MODULO / 2);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t utimeq_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 1, 1, false);
|
||||
STATIC mp_obj_t utimeq_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 1, false);
|
||||
mp_uint_t alloc = mp_obj_get_int(args[0]);
|
||||
mp_obj_utimeq_t *o = m_new_obj_var(mp_obj_utimeq_t, struct qentry, alloc);
|
||||
o->base.type = type;
|
||||
|
|
|
@ -69,8 +69,8 @@ STATIC int read_src_stream(TINF_DATA *data) {
|
|||
return c;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 1, 2, false);
|
||||
STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 2, false);
|
||||
mp_get_stream_raise(args[0], MP_STREAM_OP_READ);
|
||||
mp_obj_decompio_t *o = m_new_obj(mp_obj_decompio_t);
|
||||
o->base.type = type;
|
||||
|
|
|
@ -57,8 +57,8 @@ typedef struct _mp_obj_websocket_t {
|
|||
|
||||
STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode);
|
||||
|
||||
STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 1, 2, false);
|
||||
STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 2, false);
|
||||
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
|
||||
mp_obj_websocket_t *o = m_new_obj(mp_obj_websocket_t);
|
||||
o->base.type = type;
|
||||
|
|
|
@ -10,6 +10,29 @@
|
|||
#define EMIT(at, byte) (code ? (code[at] = byte) : (at))
|
||||
#define PC (prog->bytelen)
|
||||
|
||||
|
||||
static char unescape(char c) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
return '\a';
|
||||
case 'b':
|
||||
return '\b';
|
||||
case 'f':
|
||||
return '\f';
|
||||
case 'n':
|
||||
return '\n';
|
||||
case 'r':
|
||||
return '\r';
|
||||
case 'v':
|
||||
return '\v';
|
||||
case 'x':
|
||||
return '\\';
|
||||
default:
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
|
||||
{
|
||||
char *code = sizecode ? NULL : prog->insts;
|
||||
|
@ -22,13 +45,16 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
|
|||
case '\\':
|
||||
re++;
|
||||
if (!*re) return NULL; // Trailing backslash
|
||||
term = PC;
|
||||
if ((*re | 0x20) == 'd' || (*re | 0x20) == 's' || (*re | 0x20) == 'w') {
|
||||
term = PC;
|
||||
EMIT(PC++, NamedClass);
|
||||
EMIT(PC++, *re);
|
||||
prog->len++;
|
||||
break;
|
||||
} else {
|
||||
EMIT(PC++, Char);
|
||||
EMIT(PC++, unescape(*re));
|
||||
}
|
||||
prog->len++;
|
||||
break;
|
||||
default:
|
||||
term = PC;
|
||||
EMIT(PC++, Char);
|
||||
|
@ -54,11 +80,21 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
|
|||
prog->len++;
|
||||
for (cnt = 0; *re != ']'; re++, cnt++) {
|
||||
if (!*re) return NULL;
|
||||
EMIT(PC++, *re);
|
||||
if (*re == '\\') {
|
||||
re += 1;
|
||||
EMIT(PC++, unescape(*re));
|
||||
} else {
|
||||
EMIT(PC++, *re);
|
||||
}
|
||||
if (re[1] == '-' && re[2] != ']') {
|
||||
re += 2;
|
||||
}
|
||||
EMIT(PC++, *re);
|
||||
if (*re == '\\') {
|
||||
re += 1;
|
||||
EMIT(PC++, unescape(*re));
|
||||
} else {
|
||||
EMIT(PC++, *re);
|
||||
}
|
||||
}
|
||||
EMIT(term + 1, cnt);
|
||||
break;
|
||||
|
|
|
@ -176,7 +176,7 @@ mp_obj_t mp_vfs_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args
|
|||
// auto-detect the filesystem and create the corresponding VFS entity.
|
||||
// (At the moment we only support FAT filesystems.)
|
||||
#if MICROPY_VFS_FAT
|
||||
vfs_obj = mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, 0, &vfs_obj);
|
||||
vfs_obj = mp_fat_vfs_type.make_new(&mp_fat_vfs_type, 1, &vfs_obj, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "lib/oofatfs/ff.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "lib/timeutils/timeutils.h"
|
||||
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
#if _MAX_SS == _MIN_SS
|
||||
|
@ -65,8 +65,8 @@ mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) {
|
|||
return MP_IMPORT_STAT_NO_EXIST;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 1, 1, false);
|
||||
STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 1, 1, false);
|
||||
|
||||
// create new object
|
||||
fs_user_mount_t *vfs = m_new_obj(fs_user_mount_t);
|
||||
|
@ -99,6 +99,12 @@ STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
|||
return MP_OBJ_FROM_PTR(vfs);
|
||||
}
|
||||
|
||||
STATIC void verify_fs_writable(fs_user_mount_t *vfs) {
|
||||
if (!filesystem_is_writable_by_python(vfs)) {
|
||||
mp_raise_OSError(MP_EROFS);
|
||||
}
|
||||
}
|
||||
|
||||
#if _FS_REENTRANT
|
||||
STATIC mp_obj_t fat_vfs_del(mp_obj_t self_in) {
|
||||
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
@ -111,7 +117,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_del_obj, fat_vfs_del);
|
|||
|
||||
STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
|
||||
// create new object
|
||||
fs_user_mount_t *vfs = MP_OBJ_TO_PTR(fat_vfs_make_new(&mp_fat_vfs_type, 1, 0, &bdev_in));
|
||||
fs_user_mount_t *vfs = MP_OBJ_TO_PTR(fat_vfs_make_new(&mp_fat_vfs_type, 1, &bdev_in, NULL));
|
||||
|
||||
// make the filesystem
|
||||
uint8_t working_buf[_MAX_SS];
|
||||
|
@ -201,6 +207,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(fat_vfs_ilistdir_obj, 1, 2, fat_vfs_i
|
|||
|
||||
STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_int_t attr) {
|
||||
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
|
||||
verify_fs_writable(self);
|
||||
const char *path = mp_obj_str_get_str(path_in);
|
||||
|
||||
FILINFO fno;
|
||||
|
@ -235,9 +242,26 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_rmdir_obj, fat_vfs_rmdir);
|
|||
|
||||
STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_out) {
|
||||
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
|
||||
verify_fs_writable(self);
|
||||
const char *old_path = mp_obj_str_get_str(path_in);
|
||||
const char *new_path = mp_obj_str_get_str(path_out);
|
||||
FRESULT res = f_rename(&self->fatfs, old_path, new_path);
|
||||
|
||||
// Check to see if we're moving a directory into itself. This occurs when we're moving a
|
||||
// directory where the old path is a prefix of the new and the next character is a "/" and thus
|
||||
// preserves the original directory name.
|
||||
FILINFO fno;
|
||||
FRESULT res = f_stat(&self->fatfs, old_path, &fno);
|
||||
if (res != FR_OK) {
|
||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||
}
|
||||
if ((fno.fattrib & AM_DIR) != 0 &&
|
||||
strlen(new_path) > strlen(old_path) &&
|
||||
new_path[strlen(old_path)] == '/' &&
|
||||
strncmp(old_path, new_path, strlen(old_path)) == 0) {
|
||||
mp_raise_OSError(MP_EINVAL);
|
||||
}
|
||||
|
||||
res = f_rename(&self->fatfs, old_path, new_path);
|
||||
if (res == FR_EXIST) {
|
||||
// if new_path exists then try removing it (but only if it's a file)
|
||||
fat_vfs_remove_internal(vfs_in, path_out, 0); // 0 == file attribute
|
||||
|
@ -255,6 +279,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_rename_obj, fat_vfs_rename);
|
|||
|
||||
STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) {
|
||||
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(vfs_in);
|
||||
verify_fs_writable(self);
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
FRESULT res = f_mkdir(&self->fatfs, path);
|
||||
if (res == FR_OK) {
|
||||
|
@ -419,6 +444,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
|
|||
|
||||
STATIC mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) {
|
||||
fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
verify_fs_writable(self);
|
||||
const char *label_str = mp_obj_str_get_str(label_in);
|
||||
FRESULT res = f_setlabel(&self->fatfs, label_str);
|
||||
if (res != FR_OK) {
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#define FSUSER_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it
|
||||
// Device is writable over USB and read-only to MicroPython.
|
||||
#define FSUSER_USB_WRITABLE (0x0010)
|
||||
// Bit set when the above flag is checked before opening a file for write.
|
||||
#define FSUSER_CONCURRENT_WRITE_PROTECTED (0x0020)
|
||||
|
||||
typedef struct _fs_user_mount_t {
|
||||
mp_obj_base_t base;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "py/mperrno.h"
|
||||
#include "lib/oofatfs/ff.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
// this table converts from FRESULT to POSIX errno
|
||||
const byte fresult_to_errno_table[20] = {
|
||||
|
@ -186,17 +187,37 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
|
|||
break;
|
||||
}
|
||||
}
|
||||
assert(vfs != NULL);
|
||||
if ((mode & FA_WRITE) != 0 && !filesystem_is_writable_by_python(vfs)) {
|
||||
mp_raise_OSError(MP_EROFS);
|
||||
}
|
||||
|
||||
pyb_file_obj_t *o = m_new_obj_with_finaliser(pyb_file_obj_t);
|
||||
o->base.type = type;
|
||||
|
||||
const char *fname = mp_obj_str_get_str(args[0].u_obj);
|
||||
assert(vfs != NULL);
|
||||
FRESULT res = f_open(&vfs->fatfs, &o->fp, fname, mode);
|
||||
if (res != FR_OK) {
|
||||
m_del_obj(pyb_file_obj_t, o);
|
||||
mp_raise_OSError(fresult_to_errno_table[res]);
|
||||
}
|
||||
// If we're reading, turn on fast seek.
|
||||
if (mode == FA_READ) {
|
||||
// one call to determine how much space we need.
|
||||
DWORD temp_table[2];
|
||||
temp_table[0] = 2;
|
||||
o->fp.cltbl = temp_table;
|
||||
f_lseek(&o->fp, CREATE_LINKMAP);
|
||||
DWORD size = (temp_table[0] + 1) * 2;
|
||||
o->fp.cltbl = m_malloc_maybe(size * sizeof(DWORD), false);
|
||||
if (o->fp.cltbl != NULL) {
|
||||
o->fp.cltbl[0] = size;
|
||||
res = f_lseek(&o->fp, CREATE_LINKMAP);
|
||||
if (res != FR_OK) {
|
||||
o->fp.cltbl = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for 'a' mode, we must begin at the end of the file
|
||||
if ((mode & FA_OPEN_ALWAYS) != 0) {
|
||||
|
@ -206,9 +227,9 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar
|
|||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t file_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t file_obj_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_val_t arg_vals[FILE_OPEN_NUM_ARGS];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, args, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals);
|
||||
mp_arg_parse_all(n_args, args, kw_args, FILE_OPEN_NUM_ARGS, file_open_args, arg_vals);
|
||||
return file_open(NULL, type, arg_vals);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ STATIC mp_import_stat_t mp_vfs_posix_import_stat(void *self_in, const char *path
|
|||
return MP_IMPORT_STAT_NO_EXIST;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, false);
|
||||
STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 1, false);
|
||||
|
||||
mp_obj_vfs_posix_t *vfs = m_new_obj(mp_obj_vfs_posix_t);
|
||||
vfs->base.type = type;
|
||||
|
|
|
@ -109,14 +109,14 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
|
|||
return MP_OBJ_FROM_PTR(o);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t vfs_posix_file_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t vfs_posix_file_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
|
||||
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_QSTR(MP_QSTR_r)} },
|
||||
};
|
||||
|
||||
mp_arg_val_t arg_vals[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, args, MP_ARRAY_SIZE(allowed_args), allowed_args, arg_vals);
|
||||
mp_arg_parse_all(n_args, args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, arg_vals);
|
||||
return mp_vfs_posix_file_open(type, arg_vals[0].u_obj, arg_vals[1].u_obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d86fc7e81d51465ca1eae6f8c1141f81f065f5aa
|
||||
Subproject commit 6b3402965999d068316882d63fae3ab26006477c
|
|
@ -1 +1 @@
|
|||
Subproject commit f4ee725fb93fd1a31666d3f71d10c94eb96df7c8
|
||||
Subproject commit 1d38fd81edd30f1bd70c0cfe77819ab610ea89a3
|
|
@ -1 +1 @@
|
|||
Subproject commit 412392c8bdb6b4378e007eb7974c76b92fa9ff1d
|
||||
Subproject commit a1686803566793ec2de7e043bf6822e47cfa31d1
|
|
@ -1 +1 @@
|
|||
Subproject commit 03c24157d46672c723021686f7a838cfeb2db2ba
|
||||
Subproject commit 409e90902ac49720c4add985e8e1a1660bbe63a0
|
|
@ -1 +1 @@
|
|||
Subproject commit f5e70e09250f2a25ebb6487a30a763041644c5d3
|
||||
Subproject commit 836bb9843fd793683061c15150944f8897d806e9
|
|
@ -1 +1 @@
|
|||
Subproject commit ec11164ec6682094a48d0f9848d2c4c89c08f3bc
|
||||
Subproject commit aa4428f304b982aa19a5800822e78c47dc8a3b6c
|
|
@ -1 +1 @@
|
|||
Subproject commit 6298cd363811ad6ac10d4325c898be87a70d7bb2
|
||||
Subproject commit a03f9011279f9e630549432589463912831fcee1
|
|
@ -1 +1 @@
|
|||
Subproject commit 4421e79661002ff8da6c0c4f22940ec843ee300b
|
||||
Subproject commit 98563ab65800aac6464f671c0d005df56ecaa6c6
|
|
@ -1 +1 @@
|
|||
Subproject commit 72e8f3855ecd136641d536a49311c38ee4f76f33
|
||||
Subproject commit c0ed34813a608b64ed044826553918ddbad12f0c
|
|
@ -1 +1 @@
|
|||
Subproject commit eae584918e72ff5fa323825470f276b31829ef9f
|
||||
Subproject commit 893c5ec6a9aeef38284985074c2058e87754ad3d
|
|
@ -1 +1 @@
|
|||
Subproject commit c92c22ff029ee05bd392299cf25887e9af48903a
|
||||
Subproject commit 1d12cfc0b729b4ae0a2f3f4e7c1933a0fbd3b166
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d8a9d8c1d73041e4cc5669c5441f531ecba517fc
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 87755e088150cc9bce42f4104cbd74d91b923c6f
|
|
@ -125,13 +125,13 @@ double pow(double x, double y)
|
|||
else if (iy >= 0x3ff00000) {
|
||||
k = (iy>>20) - 0x3ff; /* exponent */
|
||||
if (k > 20) {
|
||||
uint32_t j = ly>>(52-k);
|
||||
if ((j<<(52-k)) == ly)
|
||||
yisint = 2 - (j&1);
|
||||
uint32_t j2 = ly>>(52-k);
|
||||
if ((j2<<(52-k)) == ly)
|
||||
yisint = 2 - (j2&1);
|
||||
} else if (ly == 0) {
|
||||
uint32_t j = iy>>(20-k);
|
||||
if ((j<<(20-k)) == iy)
|
||||
yisint = 2 - (j&1);
|
||||
uint32_t j2 = iy>>(20-k);
|
||||
if ((j2<<(20-k)) == (uint32_t)iy)
|
||||
yisint = 2 - (j2&1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_FASTSEEK 0
|
||||
#define _USE_FASTSEEK 1
|
||||
/* This option switches fast seek function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 3bb53273cd3770328f55ba317af3df0cce4333c1
|
||||
Subproject commit 547cc045fa1d8862e7e00c1d7b4a0026531d0098
|
|
@ -89,6 +89,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
|
|||
}
|
||||
// source is a lexer, parse and compile the script
|
||||
qstr source_name = lex->source_name;
|
||||
if (input_kind == MP_PARSE_FILE_INPUT) {
|
||||
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
|
||||
}
|
||||
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
|
||||
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
|
||||
// Clear the parse tree because it has a heap pointer we don't need anymore.
|
||||
|
|
|
@ -53,12 +53,12 @@ STATIC const sys_stdio_obj_t stdio_buffer_obj;
|
|||
#endif
|
||||
|
||||
void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
sys_stdio_obj_t *self = self_in;
|
||||
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_printf(print, "<io.FileIO %d>", self->fd);
|
||||
}
|
||||
|
||||
STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
|
||||
sys_stdio_obj_t *self = self_in;
|
||||
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->fd == STDIO_FD_IN) {
|
||||
for (uint i = 0; i < size; i++) {
|
||||
int c = mp_hal_stdin_rx_chr();
|
||||
|
@ -75,7 +75,7 @@ STATIC mp_uint_t stdio_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *er
|
|||
}
|
||||
|
||||
STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
|
||||
sys_stdio_obj_t *self = self_in;
|
||||
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->fd == STDIO_FD_OUT || self->fd == STDIO_FD_ERR) {
|
||||
mp_hal_stdout_tx_strn_cooked(buf, size);
|
||||
return size;
|
||||
|
@ -85,6 +85,19 @@ STATIC mp_uint_t stdio_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
|
|||
}
|
||||
}
|
||||
|
||||
STATIC mp_uint_t stdio_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
||||
sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
(void) self;
|
||||
|
||||
// For now, pretend we actually flush the stdio stream.
|
||||
if (request == MP_STREAM_FLUSH) {
|
||||
return 0;
|
||||
} else {
|
||||
*errcode = MP_EINVAL;
|
||||
return MP_STREAM_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC mp_obj_t stdio_obj___exit__(size_t n_args, const mp_obj_t *args) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
@ -112,6 +125,7 @@ STATIC MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
|
|||
STATIC const mp_stream_p_t stdio_obj_stream_p = {
|
||||
.read = stdio_read,
|
||||
.write = stdio_write,
|
||||
.ioctl = stdio_ioctl,
|
||||
.is_text = true,
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
5076
locale/de_DE.po
5076
locale/de_DE.po
File diff suppressed because it is too large
Load Diff
4494
locale/en_US.po
4494
locale/en_US.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
5241
locale/es.po
5241
locale/es.po
File diff suppressed because it is too large
Load Diff
4897
locale/fil.po
4897
locale/fil.po
File diff suppressed because it is too large
Load Diff
5256
locale/fr.po
5256
locale/fr.po
File diff suppressed because it is too large
Load Diff
5120
locale/it_IT.po
5120
locale/it_IT.po
File diff suppressed because it is too large
Load Diff
4953
locale/pt_BR.po
4953
locale/pt_BR.po
File diff suppressed because it is too large
Load Diff
47
main.c
47
main.c
|
@ -44,11 +44,13 @@
|
|||
#include "lib/utils/pyexec.h"
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "supervisor/cpu.h"
|
||||
#include "supervisor/memory.h"
|
||||
#include "supervisor/port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/autoreload.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
#include "supervisor/shared/rgb_led_status.h"
|
||||
#include "supervisor/shared/safe_mode.h"
|
||||
|
@ -56,7 +58,7 @@
|
|||
#include "supervisor/shared/stack.h"
|
||||
#include "supervisor/serial.h"
|
||||
|
||||
#ifdef MICROPY_PY_NETWORK
|
||||
#if CIRCUITPY_NETWORK
|
||||
#include "shared-module/network/__init__.h"
|
||||
#endif
|
||||
|
||||
|
@ -116,15 +118,28 @@ void start_mp(supervisor_allocation* heap) {
|
|||
|
||||
mp_obj_list_init(mp_sys_argv, 0);
|
||||
|
||||
#if MICROPY_PY_NETWORK
|
||||
#if CIRCUITPY_NETWORK
|
||||
network_module_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void stop_mp(void) {
|
||||
#if MICROPY_PY_NETWORK
|
||||
#if CIRCUITPY_NETWORK
|
||||
network_module_deinit();
|
||||
#endif
|
||||
|
||||
#if MICROPY_VFS
|
||||
mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table);
|
||||
|
||||
// Unmount all heap allocated vfs mounts.
|
||||
while (gc_nbytes(vfs) > 0) {
|
||||
vfs = vfs->next;
|
||||
}
|
||||
MP_STATE_VM(vfs_mount_table) = vfs;
|
||||
MP_STATE_VM(vfs_cur) = vfs;
|
||||
#endif
|
||||
|
||||
gc_deinit();
|
||||
}
|
||||
|
||||
#define STRING_LIST(...) {__VA_ARGS__, ""}
|
||||
|
@ -183,8 +198,8 @@ bool run_code_py(safe_mode_t safe_mode) {
|
|||
} else {
|
||||
new_status_color(MAIN_RUNNING);
|
||||
|
||||
const char *supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
|
||||
const char *double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
|
||||
static const char *supported_filenames[] = STRING_LIST("code.txt", "code.py", "main.py", "main.txt");
|
||||
static const char *double_extension_filenames[] = STRING_LIST("code.txt.py", "code.py.txt", "code.txt.txt","code.py.py",
|
||||
"main.txt.py", "main.py.txt", "main.txt.txt","main.py.py");
|
||||
|
||||
stack_resize();
|
||||
|
@ -198,10 +213,17 @@ bool run_code_py(safe_mode_t safe_mode) {
|
|||
serial_write_compressed(translate("WARNING: Your code filename has two extensions\n"));
|
||||
}
|
||||
}
|
||||
// Turn off the display and flush the fileystem before the heap disappears.
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
reset_displays();
|
||||
#endif
|
||||
filesystem_flush();
|
||||
stop_mp();
|
||||
free_memory(heap);
|
||||
supervisor_move_memory();
|
||||
|
||||
reset_port();
|
||||
reset_board_busses();
|
||||
reset_board();
|
||||
reset_status_led();
|
||||
|
||||
|
@ -211,6 +233,10 @@ bool run_code_py(safe_mode_t safe_mode) {
|
|||
}
|
||||
|
||||
// Wait for connection or character.
|
||||
if (!serial_connected_at_start) {
|
||||
serial_write_compressed(translate("\nCode done running. Waiting for reload.\n"));
|
||||
}
|
||||
|
||||
bool serial_connected_before_animation = false;
|
||||
rgb_status_animation_t animation;
|
||||
prep_rgb_status_animation(&result, found_main, safe_mode, &animation);
|
||||
|
@ -219,6 +245,7 @@ bool run_code_py(safe_mode_t safe_mode) {
|
|||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
if (reload_requested) {
|
||||
reload_requested = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -296,12 +323,12 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
|||
mp_hal_delay_ms(1500);
|
||||
|
||||
// USB isn't up, so we can write the file.
|
||||
filesystem_writable_by_python(true);
|
||||
filesystem_set_internal_writable_by_usb(false);
|
||||
f_open(fs, boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_WRITE | FA_CREATE_ALWAYS);
|
||||
|
||||
// Switch the filesystem back to non-writable by Python now instead of later,
|
||||
// since boot.py might change it back to writable.
|
||||
filesystem_writable_by_python(false);
|
||||
filesystem_set_internal_writable_by_usb(true);
|
||||
|
||||
// Write version info to boot_out.txt.
|
||||
mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO);
|
||||
|
@ -332,6 +359,7 @@ void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
|
|||
reset_board();
|
||||
stop_mp();
|
||||
free_memory(heap);
|
||||
supervisor_move_memory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,10 +376,12 @@ int run_repl(void) {
|
|||
} else {
|
||||
exit_code = pyexec_friendly_repl();
|
||||
}
|
||||
filesystem_flush();
|
||||
reset_port();
|
||||
reset_board();
|
||||
stop_mp();
|
||||
free_memory(heap);
|
||||
supervisor_move_memory();
|
||||
autoreload_resume();
|
||||
return exit_code;
|
||||
}
|
||||
|
@ -387,7 +417,8 @@ int __attribute__((used)) main(void) {
|
|||
|
||||
// By default our internal flash is readonly to local python code and
|
||||
// writable over USB. Set it here so that boot.py can change it.
|
||||
filesystem_writable_by_python(false);
|
||||
filesystem_set_internal_concurrent_write_protection(true);
|
||||
filesystem_set_internal_writable_by_usb(true);
|
||||
|
||||
run_boot_py(safe_mode);
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ endif
|
|||
SRC_C = \
|
||||
main.c \
|
||||
gccollect.c \
|
||||
supervisor/stub/safe_mode.c \
|
||||
supervisor/stub/stack.c \
|
||||
supervisor/shared/translate.c
|
||||
|
||||
|
|
|
@ -1,3 +1,27 @@
|
|||
# This file is part of the MicroPython project, http://micropython.org/
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2019 Dan Halbert 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.
|
||||
|
||||
# Select the board to build for.
|
||||
ifeq ($(BOARD),)
|
||||
$(error You must provide a BOARD parameter)
|
||||
|
@ -7,13 +31,16 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
|
||||
# If the build directory is not given, make it reflect the board name.
|
||||
BUILD ?= build-$(BOARD)
|
||||
|
||||
include ../../py/mkenv.mk
|
||||
# Board-specific
|
||||
include boards/$(BOARD)/mpconfigboard.mk
|
||||
-include mpconfigport.mk
|
||||
# Port-specific
|
||||
include mpconfigport.mk
|
||||
# CircuitPython-specific
|
||||
include $(TOP)/py/circuitpy_mpconfig.mk
|
||||
|
||||
# qstr definitions (must come before including py.mk)
|
||||
QSTR_DEFS = qstrdefsport.h
|
||||
|
@ -23,9 +50,10 @@ include $(TOP)/py/py.mk
|
|||
|
||||
include $(TOP)/supervisor/supervisor.mk
|
||||
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
# Include make rules and variables common across CircuitPython builds.
|
||||
include $(TOP)/py/circuitpy_defns.mk
|
||||
|
||||
BOSSAC := tools/bossac_osx
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
|
||||
HAL_DIR=hal/$(MCU_SERIES)
|
||||
|
||||
|
@ -54,48 +82,19 @@ INC += -I. \
|
|||
-I../../supervisor/shared/usb \
|
||||
-I$(BUILD)
|
||||
|
||||
BASE_CFLAGS = \
|
||||
-fsingle-precision-constant \
|
||||
-fno-strict-aliasing \
|
||||
-Wdouble-promotion \
|
||||
-Wno-endif-labels \
|
||||
-Wstrict-prototypes \
|
||||
-Werror-implicit-function-declaration \
|
||||
-Wfloat-equal \
|
||||
-Wundef \
|
||||
-Wshadow \
|
||||
-Wwrite-strings \
|
||||
-Wsign-compare \
|
||||
-Wmissing-format-attribute \
|
||||
-Wno-deprecated-declarations \
|
||||
-Wnested-externs \
|
||||
-Wunreachable-code \
|
||||
-Wcast-align \
|
||||
-Wno-error=lto-type-mismatch \
|
||||
-D__$(CHIP_VARIANT)__ \
|
||||
-ffunction-sections \
|
||||
-fdata-sections \
|
||||
-fshort-enums \
|
||||
-DCIRCUITPY_SOFTWARE_SAFE_MODE=0x0ADABEEF \
|
||||
-DCIRCUITPY_CANARY_WORD=0xADAF00 \
|
||||
-DCIRCUITPY_SAFE_RESTART_WORD=0xDEADBEEF \
|
||||
--param max-inline-insns-single=500
|
||||
|
||||
# Use these flags to debug build times and header includes.
|
||||
# -ftime-report
|
||||
# -H
|
||||
# NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt.
|
||||
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD21 -DCFG_TUD_CDC_RX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=128 -DCFG_TUD_MSC_BUFSIZE=512
|
||||
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)
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAMD51 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
|
||||
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
|
||||
|
||||
#Debugging/Optimization
|
||||
|
@ -113,7 +112,7 @@ else
|
|||
# -finline-limit can shrink the image size.
|
||||
# -finline-limit=80 or so is similar to not having it on.
|
||||
# There is no simple default value, though.
|
||||
ifdef INTERNAL_FLASH_FILESYSTEM
|
||||
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
||||
CFLAGS += -finline-limit=50
|
||||
endif
|
||||
ifdef CFLAGS_INLINE_LIMIT
|
||||
|
@ -143,22 +142,7 @@ CFLAGS += \
|
|||
-DSAMD51
|
||||
endif
|
||||
|
||||
ifneq ($(FROZEN_DIR),)
|
||||
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
|
||||
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
|
||||
CFLAGS += -DMICROPY_MODULE_FROZEN_STR
|
||||
CFLAGS += -Wno-error=lto-type-mismatch
|
||||
endif
|
||||
|
||||
# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and
|
||||
# then invoke make with FROZEN_MPY_DIR=frozen or FROZEN_MPY_DIRS="dir1 dir2"
|
||||
# (be sure to build from scratch).
|
||||
|
||||
ifneq ($(FROZEN_MPY_DIRS),)
|
||||
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
|
||||
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||
CFLAGS += -Wno-error=lto-type-mismatch
|
||||
endif
|
||||
|
||||
LDFLAGS = $(CFLAGS) -nostartfiles -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
|
||||
LIBS := -lgcc -lc
|
||||
|
@ -168,20 +152,6 @@ ifndef INTERNAL_LIBM
|
|||
LIBS += -lm
|
||||
endif
|
||||
|
||||
# Propagate longint choice from .mk to C. There's no easy string comparison
|
||||
# in cpp coniditionals, so we #define separate names for each.
|
||||
ifeq ($(LONGINT_IMPL),NONE)
|
||||
CFLAGS += -DLONGINT_IMPL_NONE
|
||||
endif
|
||||
|
||||
ifeq ($(LONGINT_IMPL),MPZ)
|
||||
CFLAGS += -DLONGINT_IMPL_MPZ
|
||||
endif
|
||||
|
||||
ifeq ($(LONGINT_IMPL),LONGLONG)
|
||||
CFLAGS += -DLONGINT_IMPL_LONGLONG
|
||||
endif
|
||||
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
LDFLAGS += -mthumb -mcpu=cortex-m0plus -Lasf/thirdparty/CMSIS/Lib/GCC/
|
||||
BOOTLOADER_SIZE := 0x2000
|
||||
|
@ -237,17 +207,26 @@ SRC_ASF := $(addprefix asf4/$(CHIP_FAMILY)/, $(SRC_ASF))
|
|||
|
||||
SRC_C = \
|
||||
audio_dma.c \
|
||||
board_busses.c \
|
||||
background.c \
|
||||
bindings/samd/Clock.c \
|
||||
bindings/samd/__init__.c \
|
||||
boards/$(BOARD)/board.c \
|
||||
boards/$(BOARD)/pins.c \
|
||||
fatfs_port.c \
|
||||
freetouch/adafruit_ptc.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
lib/oofatfs/ff.c \
|
||||
lib/oofatfs/option/ccsbcs.c \
|
||||
lib/timeutils/timeutils.c \
|
||||
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \
|
||||
lib/utils/buffer_helper.c \
|
||||
lib/utils/context_manager_helpers.c \
|
||||
lib/utils/interrupt_char.c \
|
||||
lib/utils/pyexec.c \
|
||||
lib/utils/stdout_helpers.c \
|
||||
lib/utils/sys_stdio_mphal.c \
|
||||
mphalport.c \
|
||||
reset.c \
|
||||
peripherals/samd/clocks.c \
|
||||
peripherals/samd/dma.c \
|
||||
peripherals/samd/events.c \
|
||||
peripherals/samd/external_interrupts.c \
|
||||
peripherals/samd/sercom.c \
|
||||
peripherals/samd/timers.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/adc.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/cache.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/clocks.c \
|
||||
|
@ -257,28 +236,19 @@ SRC_C = \
|
|||
peripherals/samd/$(CHIP_FAMILY)/pins.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/sercom.c \
|
||||
peripherals/samd/$(CHIP_FAMILY)/timers.c \
|
||||
peripherals/samd/clocks.c \
|
||||
peripherals/samd/dma.c \
|
||||
peripherals/samd/events.c \
|
||||
peripherals/samd/external_interrupts.c \
|
||||
peripherals/samd/sercom.c \
|
||||
peripherals/samd/timers.c \
|
||||
reset.c \
|
||||
supervisor/shared/memory.c \
|
||||
tick.c \
|
||||
bindings/samd/__init__.c \
|
||||
bindings/samd/Clock.c \
|
||||
boards/$(BOARD)/board.c \
|
||||
boards/$(BOARD)/pins.c \
|
||||
lib/oofatfs/ff.c \
|
||||
lib/oofatfs/option/ccsbcs.c \
|
||||
lib/timeutils/timeutils.c \
|
||||
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c \
|
||||
lib/tinyusb/src/portable/microchip/$(CHIP_FAMILY)/hal_$(CHIP_FAMILY).c \
|
||||
lib/utils/buffer_helper.c \
|
||||
lib/utils/context_manager_helpers.c \
|
||||
lib/utils/interrupt_char.c \
|
||||
lib/utils/pyexec.c \
|
||||
lib/utils/stdout_helpers.c \
|
||||
lib/utils/sys_stdio_mphal.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
freetouch/adafruit_ptc.c \
|
||||
supervisor/shared/memory.c
|
||||
timer_handler.c \
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK),1)
|
||||
|
||||
ifeq ($(CIRCUITPY_NETWORK),1)
|
||||
CFLAGS += -DMICROPY_PY_NETWORK=1
|
||||
|
||||
SRC_MOD += lib/netutils/netutils.c
|
||||
|
@ -296,140 +266,17 @@ SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
|
|||
)
|
||||
|
||||
endif # MICROPY_PY_WIZNET5K
|
||||
endif # MICROPY_PY_NETWORK
|
||||
endif # CIRCUITPY_NETWORK
|
||||
|
||||
SRC_COMMON_HAL = \
|
||||
board/__init__.c \
|
||||
busio/__init__.c \
|
||||
busio/I2C.c \
|
||||
busio/SPI.c \
|
||||
busio/UART.c \
|
||||
digitalio/__init__.c \
|
||||
digitalio/DigitalInOut.c \
|
||||
displayio/FourWire.c \
|
||||
i2cslave/__init__.c \
|
||||
i2cslave/I2CSlave.c \
|
||||
microcontroller/__init__.c \
|
||||
microcontroller/Pin.c \
|
||||
microcontroller/Processor.c \
|
||||
neopixel_write/__init__.c \
|
||||
os/__init__.c \
|
||||
rotaryio/__init__.c \
|
||||
rotaryio/IncrementalEncoder.c \
|
||||
rtc/__init__.c \
|
||||
rtc/RTC.c \
|
||||
supervisor/__init__.c \
|
||||
supervisor/Runtime.c \
|
||||
time/__init__.c \
|
||||
analogio/__init__.c \
|
||||
analogio/AnalogIn.c \
|
||||
analogio/AnalogOut.c \
|
||||
nvm/__init__.c \
|
||||
nvm/ByteArray.c \
|
||||
pulseio/__init__.c \
|
||||
pulseio/PulseIn.c \
|
||||
pulseio/PulseOut.c \
|
||||
pulseio/PWMOut.c \
|
||||
touchio/__init__.c \
|
||||
touchio/TouchIn.c
|
||||
|
||||
ifeq ($(INTERNAL_LIBM),1)
|
||||
SRC_LIBM = $(addprefix lib/,\
|
||||
libm/math.c \
|
||||
libm/roundf.c \
|
||||
libm/fmodf.c \
|
||||
libm/nearbyintf.c \
|
||||
libm/ef_sqrt.c \
|
||||
libm/kf_rem_pio2.c \
|
||||
libm/kf_sin.c \
|
||||
libm/kf_cos.c \
|
||||
libm/kf_tan.c \
|
||||
libm/ef_rem_pio2.c \
|
||||
libm/sf_sin.c \
|
||||
libm/sf_cos.c \
|
||||
libm/sf_tan.c \
|
||||
libm/sf_frexp.c \
|
||||
libm/sf_modf.c \
|
||||
libm/sf_ldexp.c \
|
||||
libm/asinfacosf.c \
|
||||
libm/atanf.c \
|
||||
libm/atan2f.c \
|
||||
)
|
||||
endif
|
||||
|
||||
# These don't have corresponding files in each port but are still located in
|
||||
# shared-bindings to make it clear what the contents of the modules are.
|
||||
SRC_BINDINGS_ENUMS = \
|
||||
digitalio/Direction.c \
|
||||
digitalio/DriveMode.c \
|
||||
digitalio/Pull.c \
|
||||
microcontroller/RunMode.c \
|
||||
help.c \
|
||||
math/__init__.c \
|
||||
supervisor/__init__.c \
|
||||
util.c
|
||||
|
||||
|
||||
SRC_SHARED_MODULE = \
|
||||
bitbangio/__init__.c \
|
||||
bitbangio/I2C.c \
|
||||
bitbangio/OneWire.c \
|
||||
bitbangio/SPI.c \
|
||||
busio/OneWire.c \
|
||||
displayio/__init__.c \
|
||||
displayio/Bitmap.c \
|
||||
displayio/ColorConverter.c \
|
||||
displayio/Group.c \
|
||||
displayio/OnDiskBitmap.c \
|
||||
displayio/Palette.c \
|
||||
displayio/Sprite.c \
|
||||
gamepad/__init__.c \
|
||||
gamepad/GamePad.c \
|
||||
_stage/__init__.c \
|
||||
_stage/Layer.c \
|
||||
_stage/Text.c \
|
||||
storage/__init__.c \
|
||||
os/__init__.c \
|
||||
random/__init__.c \
|
||||
struct/__init__.c \
|
||||
uheap/__init__.c \
|
||||
ustack/__init__.c \
|
||||
usb_hid/__init__.c \
|
||||
usb_hid/Device.c
|
||||
|
||||
# usb_midi/__init__.c
|
||||
# usb_midi/Port.c
|
||||
|
||||
ifeq ($(MICROPY_PY_NETWORK),1)
|
||||
SRC_SHARED_MODULE += socket/__init__.c network/__init__.c
|
||||
ifeq ($(CIRCUITPY_NETWORK),1)
|
||||
ifneq ($(MICROPY_PY_WIZNET5K),0)
|
||||
SRC_SHARED_MODULE += wiznet/__init__.c wiznet/wiznet5k.c
|
||||
endif
|
||||
endif
|
||||
|
||||
# SAMRs don't have a DAC
|
||||
ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||
SRC_COMMON_HAL += \
|
||||
audioio/__init__.c \
|
||||
audioio/AudioOut.c
|
||||
SRC_SHARED_MODULE += \
|
||||
audioio/__init__.c \
|
||||
audioio/Mixer.c \
|
||||
audioio/RawSample.c \
|
||||
audioio/WaveFile.c
|
||||
endif
|
||||
|
||||
# The smallest SAMD51 packages don't have I2S. Everything else does.
|
||||
ifneq ($(CHIP_VARIANT),SAMD51G18A)
|
||||
ifneq ($(CHIP_VARIANT),SAMD51G19A)
|
||||
ifneq ($(CHIP_VARIANT),SAMR21G18A)
|
||||
SRC_COMMON_HAL += \
|
||||
audiobusio/__init__.c \
|
||||
audiobusio/I2SOut.c \
|
||||
audiobusio/PDMIn.c
|
||||
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
|
||||
endif
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_AUDIOBUSIO),1)
|
||||
SRC_C += peripherals/samd/i2s.c peripherals/samd/$(CHIP_FAMILY)/i2s.c
|
||||
endif
|
||||
|
||||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||
|
@ -451,7 +298,7 @@ endif
|
|||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
|
||||
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) $(STM_SRC_C)
|
||||
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
||||
# Sources that only hold QSTRs after pre-processing.
|
||||
SRC_QSTR_PREPROCESSOR += peripherals/samd/$(CHIP_FAMILY)/clocks.c
|
||||
|
||||
|
@ -470,20 +317,9 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin
|
|||
$(STEPECHO) "Create $@"
|
||||
$(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^
|
||||
|
||||
deploy: $(BUILD)/firmware.bin
|
||||
$(ECHO) "Writing $< to the board"
|
||||
$(BOSSAC) -u $<
|
||||
|
||||
# Run emulation build on a POSIX system with suitable terminal settings
|
||||
run:
|
||||
stty raw opost -echo
|
||||
build/firmware.elf
|
||||
@echo Resetting terminal...
|
||||
# This sleep is useful to spot segfaults
|
||||
sleep 1
|
||||
reset
|
||||
|
||||
test: $(BUILD)/firmware.elf
|
||||
$(Q)/bin/echo -e "print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\\r\\n\\x04" | $(BUILD)/firmware.elf | tail -n2 | grep "^hello world! \\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\]eol"
|
||||
|
||||
include $(TOP)/py/mkrules.mk
|
||||
|
||||
# Print out the value of a make variable.
|
||||
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
||||
print-%:
|
||||
@echo $* = $($*)
|
||||
|
|
|
@ -22,51 +22,51 @@ different names. The table below matches the pin order in
|
|||
and omits the pins only available on the largest package because all supported
|
||||
boards use smaller version.
|
||||
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
|
||||
`microcontroller.pin` `board`
|
||||
--------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Datasheet arduino_mkrzero arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express trinket_m0
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
|
||||
PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
|
||||
PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
|
||||
PA02 ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``D1`` / ``A0``
|
||||
--------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
Datasheet arduino_mkrzero arduino_zero circuitplayground_express feather_m0_adalogger feather_m0_basic feather_m0_express gemma_m0 metro_m0_express sparkfun_samd21_mini sparkfun_samd21_dev trinket_m0
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
|
||||
PA00 ``ACCELEROMETER_SDA`` ``APA102_MOSI`` ``APA102_MOSI``
|
||||
PA01 ``ACCELEROMETER_SCL`` ``APA102_SCK`` ``APA102_SCK``
|
||||
PA02 ``A0`` ``A0`` ``A0`` / ``SPEAKER`` ``A0`` ``A0`` ``A0`` ``A0`` / ``D1`` ``A0`` ``A0`` ``A0`` ``D1`` / ``A0``
|
||||
PA03
|
||||
PB08 ``L`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1``
|
||||
PB09 ``BATTERY`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2``
|
||||
PA04 ``A3`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3``
|
||||
PA05 ``A4`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4``
|
||||
PA06 ``A5`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D4`` / ``TX``
|
||||
PA07 ``A6`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
|
||||
PA08 ``D11`` / ``SDA`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D0`` / ``SDA``
|
||||
PA09 ``D12`` / ``SCL`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D2`` / ``SCL``
|
||||
PA10 ``D2`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
|
||||
PA11 ``D3`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
|
||||
PB10 ``D4`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
|
||||
PB11 ``D5`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
|
||||
PA12 ``SD_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
|
||||
PA13 ``SD_SCK`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS``
|
||||
PA14 ``SD_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2``
|
||||
PA15 ``SD_MISO`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5``
|
||||
PA16 ``D8`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11``
|
||||
PA17 ``D9`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13``
|
||||
PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
|
||||
PA19 ``D10`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12``
|
||||
PA20 ``D6`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6``
|
||||
PA21 ``D7`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7``
|
||||
PA22 ``D0`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
|
||||
PA23 ``D1`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL``
|
||||
PB08 ``L`` ``A1`` ``A7`` / ``TX`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1`` ``A1``
|
||||
PB09 ``BATTERY`` ``A2`` ``A6`` / ``RX`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2`` ``A2``
|
||||
PA04 ``A3`` ``A3`` ``IR_PROXIMITY`` ``A3`` ``A3`` ``A3`` ``D0`` / ``TX`` / ``SDA`` ``A3`` ``A3`` ``A3``
|
||||
PA05 ``A4`` ``A4`` ``A1`` ``A4`` ``A4`` ``A4`` ``D2`` / ``RX`` / ``SCL`` ``A4`` ``A4``
|
||||
PA06 ``A5`` ``D8`` ``A2`` ``D8`` / ``GREEN_LED`` ``NEOPIXEL`` ``D8`` ``D8`` ``D8`` ``D4`` / ``TX``
|
||||
PA07 ``A6`` ``D9`` ``A3`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D9`` ``D3`` / ``RX``
|
||||
PA08 ``D11`` / ``SDA`` ``D4`` ``MICROPHONE_DO`` ``D4`` / ``SD_CS`` ``D4`` ``D4`` ``D4`` ``D0`` / ``SDA``
|
||||
PA09 ``D12`` / ``SCL`` ``D3`` ``TEMPERATURE`` / ``A9`` ``D3`` ``D3`` ``D3`` ``D2`` / ``SCL``
|
||||
PA10 ``D2`` ``D1`` / ``TX`` ``MICROPHONE_SCK`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D1`` / ``TX`` ``D13``
|
||||
PA11 ``D3`` ``D0`` / ``RX`` ``LIGHT`` / ``A8`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX`` ``D0`` / ``RX``
|
||||
PB10 ``D4`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI`` ``MOSI``
|
||||
PB11 ``D5`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK`` ``SCK``
|
||||
PA12 ``SD_MOSI`` ``MISO`` ``REMOTEIN`` / ``IR_RX`` ``MISO`` ``MISO`` ``MISO`` ``MISO`` ``MISO``
|
||||
PA13 ``SD_SCK`` ``ACCELEROMETER_INTERRUPT`` ``FLASH_CS`` ``D38``
|
||||
PA14 ``SD_CS`` ``D2`` ``BUTTON_B`` / ``D5`` ``D2`` ``D2`` ``D2``
|
||||
PA15 ``SD_MISO`` ``D5`` ``SLIDE_SWITCH`` / ``D7`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5`` ``D5``
|
||||
PA16 ``D8`` / ``MOSI`` ``D11`` ``MISO`` ``D11`` ``D11`` ``D11`` ``D11`` ``D11`` / ``MOSI`` ``D11``
|
||||
PA17 ``D9`` / ``SCK`` ``D13`` ``D13`` ``D13`` / ``RED_LED`` ``D13`` ``D13`` ``D13`` ``D13`` / ``SCK`` / ``BLUE_LED`` ``D13`` / ``BLUE_LED``
|
||||
PA18 ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10`` ``D10``
|
||||
PA19 ``D10`` / ``MISO`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` ``D12`` / ``MISO`` ``D12``
|
||||
PA20 ``D6`` ``D6`` ``MOSI`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6`` ``D6``
|
||||
PA21 ``D7`` ``D7`` ``SCK`` ``D7`` / ``SD_CD`` ``D7`` ``D7`` ``D7``
|
||||
PA22 ``D0`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA`` ``SDA``
|
||||
PA23 ``D1`` ``SCL`` ``REMOTEOUT`` / ``IR_TX`` ``SCL`` ``SCL`` ``SCL`` ``L`` / ``D13`` ``SCL`` ``SCL`` ``SCL``
|
||||
PA24
|
||||
PA25
|
||||
PB22 ``D14`` / ``TX`` ``FLASH_CS``
|
||||
PB23 ``D13`` / ``RX`` ``NEOPIXEL`` / ``D8``
|
||||
PA27 ``SD_CD``
|
||||
PB22 ``D14`` / ``TX`` ``FLASH_CS`` ``D30`` / ``TX1``
|
||||
PB23 ``D13`` / ``RX`` ``NEOPIXEL`` / ``D8`` ``D31`` / ``RX1``
|
||||
PA27 ``SD_CD`` ``GREEN_LED`` ``GREEN_LED``
|
||||
PA28 ``BUTTON_A`` / ``D4``
|
||||
PA29
|
||||
PA30 ``SPEAKER_ENABLE`` ``NEOPIXEL``
|
||||
PA31
|
||||
PB02 ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5``
|
||||
PB03 ``A2`` ``A4`` / ``SCL``
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================
|
||||
PB02 ``A1`` ``A5`` ``A5`` / ``SDA`` ``A5`` ``A5`` ``A5`` ``A5`` ``A5``
|
||||
PB03 ``A2`` ``A4`` / ``SCL`` ``YELLOW_LED`` ``YELLOW_LED``
|
||||
===================== =================== =============== =========================== ====================== ================ ================== ========================= ================ ================================ ====================== ================
|
||||
|
||||
Here is a table about which pins can do what in CircuitPython terms. However,
|
||||
just because something is listed, doesn't mean it will always work. Existing use
|
||||
|
|
|
@ -27,13 +27,17 @@
|
|||
|
||||
#include "audio_dma.h"
|
||||
#include "tick.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/usb.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/network/__init__.h"
|
||||
#include "supervisor/shared/stack.h"
|
||||
|
||||
#ifdef CIRCUITPY_DISPLAYIO
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#endif
|
||||
|
||||
volatile uint64_t last_finished_tick = 0;
|
||||
|
||||
bool stack_ok_so_far = true;
|
||||
|
@ -43,13 +47,14 @@ void run_background_tasks(void) {
|
|||
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
|
||||
audio_dma_background();
|
||||
#endif
|
||||
#ifdef CIRCUITPY_DISPLAYIO
|
||||
displayio_refresh_display();
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
displayio_refresh_displays();
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_NETWORK
|
||||
#if CIRCUITPY_NETWORK
|
||||
network_module_background();
|
||||
#endif
|
||||
filesystem_background();
|
||||
usb_background();
|
||||
assert_heap_ok();
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_PB23)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Arduino"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Arduino"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_PA15) },
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#define MICROPY_PORT_B (PORT_PB03)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Arduino"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -33,12 +33,6 @@
|
|||
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
#ifdef CIRCUITPY_DISPLAYIO
|
||||
#include "common-hal/displayio/FourWire.h"
|
||||
|
||||
extern displayio_fourwire_obj_t board_display_obj;
|
||||
#endif
|
||||
|
||||
// Initializes board related state once on start up.
|
||||
void board_init(void);
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA19)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA18)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA22)
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define IGNORE_PIN_PA00 1
|
||||
#define IGNORE_PIN_PA01 1
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Electronic Cats"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21E18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA30) },
|
||||
|
|
|
@ -9,6 +9,11 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
|
|||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# Make room for frozen libs.
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_PA17)
|
||||
|
||||
// No framebuf on CRICKit version to save space.
|
||||
#define MICROPY_PY_FRAMEBUF (0)
|
||||
|
||||
// Don't allow touch on A0 (PA02), because it's connected to the speaker.
|
||||
#define PA02_NO_TOUCH (true)
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
|||
# Turn off longints for Crickit build to make room for additional frozen libs.
|
||||
LONGINT_IMPL = NONE
|
||||
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -8,5 +8,10 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "W25Q128JV_PM"
|
||||
|
||||
# No I2S on SAMD51G
|
||||
CIRCUITPY_AUDIOBUSIO = 0
|
||||
# No touch on SAMD51 yet
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
|
||||
CHIP_VARIANT = SAMD51G19A
|
||||
CHIP_FAMILY = samd51
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
|
|
|
@ -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) {
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#define MICROPY_HW_BOARD_NAME "TG-Boards' Datalore IP M4"
|
||||
#define MICROPY_HW_MCU_NAME "samd51j19"
|
||||
|
||||
#define CIRCUITPY_MCU_FAMILY samd51
|
||||
|
||||
// This is for Rev F which is green
|
||||
|
||||
#define MICROPY_HW_LED_TX (&pin_PA27)
|
||||
#define MICROPY_HW_LED_RX (&pin_PB06)
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_PA16)
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_PB22)
|
||||
|
||||
// These are pins not to reset.
|
||||
// QSPI Data pins
|
||||
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
|
||||
// QSPI CS, QSPI SCK and NeoPixel pin
|
||||
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11 | PORT_PB22)
|
||||
#define MICROPY_PORT_C (0)
|
||||
#define MICROPY_PORT_D (0)
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 8192
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA14)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA23)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA22)
|
||||
|
||||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
|
@ -0,0 +1,20 @@
|
|||
LD_FILE = boards/samd51x19-bootloader-external-flash.ld
|
||||
USB_VID = 0x4097
|
||||
USB_PID = 0x0001
|
||||
USB_PRODUCT = "Datalore IP M4"
|
||||
USB_MANUFACTURER = "TG-Boards"
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 3
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JV_IQ, W25Q16JV_IM"
|
||||
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CHIP_VARIANT = SAMD51J19A
|
||||
CHIP_FAMILY = samd51
|
||||
|
||||
# No touch on SAMD51 yet
|
||||
CIRCUITPY_TOUCHIO = 0
|
||||
|
||||
CIRCUITPY_NETWORK = 1
|
||||
MICROPY_PY_WIZNET5K = 5500
|
|
@ -0,0 +1,48 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
// This mapping only includes functional names because pins broken
|
||||
// out on connectors are labeled with their MCU name available from
|
||||
// microcontroller.pin.
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB09) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB17) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB16) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB13) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB12) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA21) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PA27) },
|
||||
{ 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
|
@ -8,9 +8,9 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA22)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA23)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -37,5 +37,3 @@
|
|||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
||||
|
||||
#define CIRCUITPY_I2CSLAVE
|
||||
|
|
|
@ -12,5 +12,4 @@ LONGINT_IMPL = MPZ
|
|||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
MICROPY_PY_NETWORK = 1
|
||||
MICROPY_PY_WIZNET5K = 5500
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -9,10 +9,15 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
|
|||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# Make space for frozen libs
|
||||
CIRCUITPY_DISPLAYIO = 0
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CFLAGS_INLINE_LIMIT = 55
|
||||
CFLAGS_INLINE_LIMIT = 50
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "board_busses.h"
|
||||
#include "supervisor/shared/board_busses.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
|
||||
#define CIRCUITPY_INTERNAL_NVM_SIZE 256
|
||||
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
|
||||
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
|
|
@ -6,6 +6,9 @@ USB_MANUFACTURER = "Adafruit Industries LLC"
|
|||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_SMALL_BUILD = 1
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
CIRCUITPY_FREQUENCYIO = 0
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue