Commit Graph

11741 Commits

Author SHA1 Message Date
Damien George 7ad04d17da py/mkrules.mk: Regenerate all qstrs when config files change.
A port can define QSTR_GLOBAL_DEPENDENCIES to add extra files.
2018-06-12 13:53:43 +10:00
Damien George 0501427907 esp32: Remove port-specific uhashlib implementation and use common one.
Now that the common module has mbedtls support for both SHA1 and SHA256 it
can now be used on this port.
2018-06-12 13:50:11 +10:00
Yonatan Goldschmidt c2fb725e72 extmod/moduhashlib: Make function objects STATIC.
These are not exported to anyone anyway.
2018-06-12 13:50:11 +10:00
Yonatan Goldschmidt 6963ee9075 extmod/moduhashlib: Allow using the sha256 implementation of mbedTLS. 2018-06-12 13:50:11 +10:00
Yonatan Goldschmidt 6630354ffe extmod/moduhashlib: Allow to disable the sha256 class.
Via the config value MICROPY_PY_UHASHLIB_SHA256.  Default to enabled to
keep backwards compatibility.

Also add default value for the sha1 class, to at least document its
existence.
2018-06-12 13:50:11 +10:00
Yonatan Goldschmidt 38682d4629 extmod/moduhashlib: Reorder funcs so that they are grouped by hash type.
Makes the code much more readable by reducing the number of #ifdefs and
keeping related functions close.
2018-06-12 13:47:20 +10:00
Yonatan Goldschmidt b045ebd354 extmod/moduhashlib: Prefix all Python methods and objects with uhashlib.
For consistency with other modules, and to help avoid clashes with the
actual underlying functions that do the hashing (eg
crypto-algorithms/sha256.c:sha256_update).
2018-06-12 13:44:09 +10:00
Dan Halbert d427ed64a2
Merge pull request #925 from tannewt/latest_asf4
Update to the latest ASF4 which includes an I2C timeout extension …
2018-06-11 23:05:24 -04:00
Damien George c901cc6862 tests/extmod: Add test for VFS and user-defined filesystem and files. 2018-06-12 12:29:26 +10:00
Damien George 9144b1f10c tests/io: Add simple IOBase test. 2018-06-12 12:29:26 +10:00
Damien George 565f590586 ports: Enable IOBase on unix, stm32, esp8266 and esp32.
It's a core feature, in particular required for user-streams with uasyncio.
2018-06-12 12:29:26 +10:00
Damien George af0932a779 py/modio: Add uio.IOBase class to allow to define user streams.
A user class derived from IOBase and implementing readinto/write/ioctl can
now be used anywhere a native stream object is accepted.

The mapping from C to Python is:

    stream_p->read  --> readinto(buf)
    stream_p->write --> write(buf)
    stream_p->ioctl --> ioctl(request, arg)

Among other things it allows the user to:

- create an object which can be passed as the file argument to print:
  print(..., file=myobj), and then print will pass all the data to the
  object via the objects write method (same as CPython)
- pass a user object to uio.BufferedWriter to buffer the writes (same as
  CPython)
- use select.select on a user object
- register user objects with select.poll, in particular so user objects can
  be used with uasyncio
- create user files that can be returned from user filesystems, and import
  can import scripts from these user files

For example:

    class MyOut(io.IOBase):
        def write(self, buf):
            print('write', repr(buf))
            return len(buf)

    print('hello', file=MyOut())

The feature is enabled via MICROPY_PY_IO_IOBASE which is disabled by
default.
2018-06-12 12:29:26 +10:00
Damien George 6a445b60fa py/lexer: Add support for underscores in numeric literals.
This is a very convenient feature introduced in Python 3.6 by PEP 515.
2018-06-12 12:17:43 +10:00
Damien George b2fa1b50ed ports: Call gc_sweep_all() when doing a soft reset.
This calls finalisers of things like files and sockets to cleanly close
them.
2018-06-12 11:56:25 +10:00
Damien George 522ea80f06 py/gc: Add gc_sweep_all() function to run all remaining finalisers.
This patch adds the gc_sweep_all() function which does a garbage collection
without tracing any root pointers, so frees all the memory, and most
importantly runs any remaining finalisers.

This helps primarily for soft reset: it will close any open files, any open
sockets, and help to get the system back to a clean state upon soft reset.
2018-06-12 11:55:29 +10:00
Scott Shawcroft 73dadb0669 Update to the latest ASF4 which includes an I2C timeout extension while waiting for clock stretching.
Fixes #778
2018-06-11 18:37:48 -07:00
Kattni 1e6363cbcc
Merge pull request #917 from dglaude/patch-1
Update README.rst
2018-06-11 12:46:54 -04:00
Dan Halbert 6a0fc96af3
Merge pull request #922 from tannewt/rosie_tweak
Add trailing dash so that the exact board is matched.
2018-06-10 18:19:38 -04:00
Scott Shawcroft 85c5e88e17 Add trailing dash so that the exact board is matched. 2018-06-10 14:24:47 -07:00
David Glaude df4d40471a
Update README.rst
https://learn.adafruit.com/introducing-itsy-bitsy-m0/circuitpython
2018-06-10 23:07:03 +02:00
Scott Shawcroft 83b0f620c6
Merge pull request #921 from jepler/travis-build-esp
Build for feather huzzah on travis-ci
2018-06-10 13:43:20 -07:00
Jeff Epler 52c0fc421b travis.yml: Enable building feather huzzah 2018-06-10 14:56:55 -05:00
Jeff Epler bbba3e505f build_adafruit_bins: feather_huzzah need not be a special case 2018-06-10 14:56:55 -05:00
Dan Halbert 068ffd04a6
Merge pull request #919 from adafruit/jerryneedell-patch-2
fix #918
2018-06-10 09:17:49 -04:00
Dan Halbert a250224c66
Merge pull request #920 from adafruit/jerryneedell-patch-3
return "false" for stub call
2018-06-10 09:14:37 -04:00
Nick Moore f72dcc64e6 Fixes #918 (PulseIn.get_paused) ... 2018-06-10 22:37:15 +10:00
Nick Moore b25cbd340b Merge commit '2129bbe160278f7cd2cece939f81900a41f8aa86' into circuitpython-nickzoic-716-pulseio-esp8266 2018-06-10 22:08:58 +10:00
Nick Moore 972b03850f Merge branch 'master' into circuitpython-nickzoic-716-pulseio-esp8266 2018-06-10 22:01:35 +10:00
jerryneedell 8150150a24
return "false" for stub call
See #918 for discussion
2018-06-10 07:11:44 -04:00
jerryneedell 2129bbe160
Update PulseIn.c 2018-06-10 07:08:56 -04:00
jerryneedell 5724fd795a
fix #918
Add stub for common_hal_pulseio_pulsein_get_paused  to make ESP8266 build compatible with PR #901
2018-06-10 05:59:20 -04:00
David Glaude c903fc8e20
Update README.rst
Apparently there is a CircuitPython Guide for ItsyBitsy M0 too...
It just contain "kattni' in the name and I don't know if this is finished and similar to the other guide.
2018-06-09 12:46:17 +02:00
Dan Halbert b2d98edb4e
Merge pull request #901 from tannewt/pulseio_too_fast
Prevent freezing USB during high frequency PulseIn.
2018-06-08 17:59:06 -04:00
Scott Shawcroft 8fb34a5846 Use bool not int. 2018-06-08 14:57:20 -07:00
Scott Shawcroft 4e4d795da5
Merge pull request #916 from dhalbert/pdmin_hack_fix
Check for PDMIn DMA getting stuck.
2018-06-08 14:03:53 -07:00
Scott Shawcroft 8195df1b55 Stub out get_paused in nrf builds. 2018-06-08 14:01:54 -07:00
Scott Shawcroft 66b79723b6 Add code size analysis tool and shrink samd.clock a smidge. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 769788d3c7 Turn off USB pin objects since they are always used for USB. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 383bf9a59e Wait for the DFLL to be stable. 2018-06-08 12:56:32 -07:00
Scott Shawcroft 07a8899c72 Support M4 2018-06-08 12:56:32 -07:00
Scott Shawcroft 2fbab8067a Prevent freezing USB during high frequency PulseIn.
We now track the last time the background task ran and bail on the
PulseIn if it starves the background work. In practice, this
happens after the numbers from pulsein are no longer accurate.

This also adjusts interrupt priorities so most are the lowest level
except for the tick and USB interrupts.

Fixes #516 and #876
2018-06-08 12:56:32 -07:00
Dan Halbert 218930d18b Check for PDMIn DMA getting stuck. 2018-06-08 08:23:52 -04:00
hathach 418e28c7dc update nrf52840 bootloader hex and target 2018-06-08 16:10:49 +07:00
hathach 2b3436e87c add feather nrf52 uart rts, cts support 2018-06-08 15:59:38 +07:00
hathach c10899d13f allow to flash feather52 and feather52840 with jlink
add crc bypass magic to bootloader settting
2018-06-08 15:11:17 +07:00
Nick Moore 6af1fbacc9 Work on pulseio.PulseOut for #716 ESP8266
Switch to ets_delay_us but the PWM is still way too slow to be useful.
2018-06-08 16:41:42 +10:00
Damien George 8fb95d6520 tools/pydfu.py: Increase download packet size to full 2048 bytes.
The ST DFU bootloader supports a transfer size up to 2048 bytes, so send
that much data on each download (to device) packet.  This almost halves
total download time.
2018-06-08 15:32:49 +10:00
Nick Moore 011edf2472 Clean up interrupt handling for pulseio.PulseIn implementation for #716 ESP8266 2018-06-08 15:31:16 +10:00
Damien George 24c416cc66 stm32/mboot: Increase USB rx_buf and DFU buf sizes to full 2048 bytes.
The DFU USB config descriptor returns 0x0800=2048 for the supported
transfer size, and this applies to both TX (IN) and RX (OUT).  So increase
the rx_buf to support this size without having a buffer overflow on
received data.

With this patch mboot in USB DFU mode now works with dfu-util.
2018-06-08 15:29:52 +10:00
Nick Moore c4cf1c5221 Initial pulseio.PulseOut implementation for #716 ESP8266 2018-06-08 15:28:05 +10:00