Commit Graph

12069 Commits

Author SHA1 Message Date
Limor "Ladyada" Fried 9fc0ec6af8
Merge pull request #934 from microbuilder/usbboot
[WIP] nRF52840 USB Bootloader
2018-06-15 09:35:30 -07:00
Scott Shawcroft 5ce1d71206
Merge pull request #932 from dhalbert/listdir_root
fix os.listdir() when current dir is '/'
2018-06-15 09:34:08 -07:00
Dan Halbert 327b0f76da fix os.listdir() when current dir is '/' 2018-06-15 10:51:03 -04:00
Damien George 1747d15c3a drivers/sdcard: Fix bug in computing number of sectors on SD Card.
This was a typo from the very first commit of this file.
2018-06-15 18:02:40 +10:00
Damien George 8b8c083625 drivers/sdcard: Change driver to use new block-device protocol. 2018-06-15 18:01:36 +10:00
Damien George 34b2f6b6fc esp32/modules: Include umqtt library in frozen modules. 2018-06-15 16:39:49 +10:00
Damien George d61d119c94 esp32: Update to latest ESP IDF. 2018-06-15 16:23:53 +10:00
sommersoft 23b6d33455 fixes #642; spi_init_gpio() is now bypassed for both construct and configure 2018-06-15 05:03:52 +00:00
Damien George 7be4a23c0c stm32/i2cslave: Fix ordering of event callbacks in slave IRQ handler.
It's possible (at least on F4 MCU's) to have RXNE and STOPF set at the same
time during a call to the slave IRQ handler.  In such cases RXNE should be
handled before STOPF so that all bytes are processed before
i2c_slave_process_rx_end() is called.
2018-06-15 14:15:31 +10:00
Damien George bc5e8a2cb6 stm32/i2c: Fix num_acks calculation in i2c_write for F0 and F7 MCU's.
Due to buffering of outgoing bytes on the I2C bus, detection of a NACK
using the ISR_NACKF flag needs to account for the case where ISR_NACKF
corresponds to the previous-to-previous byte.
2018-06-15 14:10:53 +10:00
Scott Shawcroft 720042f964
Merge pull request #930 from dhalbert/sd_card_audio_play
Fix playing audio from SD card
2018-06-14 18:57:24 -07:00
Dan Halbert fa814a32ce Make Trinket M0 build fit; make RAMFS in vfs_fat_* tests be compliant with expected API 2018-06-14 21:02:12 -04:00
Damien George 37a7257aff stm32/timer: Support TIM1 on F0 MCUs. 2018-06-15 10:50:08 +10:00
Dan Halbert e724bc1c4e Fix playing audio from SD card 2018-06-14 18:47:40 -04:00
Damien George b78ca32476 drivers/memory/spiflash: Add functions for direct erase/read/write.
These new API functions do not use the cache.
2018-06-14 16:52:56 +10:00
Damien George cc5a94044a drivers/memory/spiflash: Rename functions to indicate they use cache.
This patch renames the existing SPI flash API functions to reflect the fact
that the go through the cache:

    mp_spiflash_flush -> mp_spiflash_cache_flush
    mp_spiflash_read  -> mp_spiflash_cached_read
    mp_spiflash_write -> mp_spiflash_cached_write
2018-06-14 16:52:56 +10:00
Damien George 335d26b27d stm32/boards/STM32L476DISC: Update SPI flash config for cache change. 2018-06-14 16:52:56 +10:00
Damien George 86fe73beb9 drivers/memory/spiflash: Move cache buffer to user-provided config.
This patch removes the global cache variables from the SPI flash driver and
now requires the user to provide the cache memory themselves, via the SPI
flash configuration struct.  This allows to either have a shared cache for
multiple SPI flash devices (by sharing a mp_spiflash_cache_t struct), or
have a single cache per device (or a mix of these options).

To configure the cache use:

    mp_spiflash_cache_t spi_bdev_cache;

    const mp_spiflash_config_t spiflash_config =
        // any bus options
        .cache = &spi_bdev_cache,
    };
2018-06-14 16:52:56 +10:00
hathach 35d38dbfed update nrf52840 bootloader hex 2018-06-13 17:27:55 +07:00
Damien George cf1509c911 esp32/fatfs_port: Implement get_fattime so FAT files have a timestamp.
Fixes issue #3859.
2018-06-13 14:13:34 +10:00
Damien George d11fb09333 extmod/modussl_axtls: Fix __del__ to point to mp_stream_close_obj. 2018-06-13 13:16:21 +10:00
Scott Shawcroft 618943d90a
Merge pull request #926 from nickzoic/circuitpython-nickzoic-716-pulseio-esp8266
Implement pulseio.PulseIn and PulseOut for ESP8266 #716
2018-06-12 18:33:16 -07:00
Dan Halbert 144c0597e9
Merge pull request #928 from tannewt/fix_uart_timeout
Correct UART reads to return error on timeout.
2018-06-12 18:41:18 -04:00
Scott Shawcroft ee817a2fa8 Correct UART reads to return error on timeout.
This causes read to correctly return None instead of b''.

Fixes #874
2018-06-12 14:03:27 -07:00
Scott Shawcroft ab0bc1c2f8
Merge pull request #927 from dhalbert/pdmin_serializer_on_off
PDMIn: turn serializer on when starting DMA
2018-06-12 10:42:08 -07:00
Dan Halbert 4691b30c02 PDMIn: turn serializer on when starting DMA 2018-06-12 12:35:51 -04:00
Damien George 035906419d extmod/uos_dupterm: Use native C stream methods on dupterm object.
This patch changes dupterm to call the native C stream methods on the
connected stream objects, instead of calling the Python readinto/write
methods.  This is much more efficient for native stream objects like UART
and webrepl and doesn't require allocating a special dupterm array.

This change is a minor breaking change from the user's perspective because
dupterm no longer accepts pure user stream objects to duplicate on.  But
with the recent addition of uio.IOBase it is possible to still create such
classes just by inheriting from uio.IOBase, for example:

    import uio, uos

    class MyStream(uio.IOBase):
        def write(self, buf):
            # existing write implementation
        def readinto(self, buf):
            # existing readinto implementation

    uos.dupterm(MyStream())
2018-06-12 15:06:11 +10:00
Damien George 5042d98514 stm32/Makefile: Rebuild all qstrs when any board configuration changes. 2018-06-12 13:53:43 +10:00
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