Commit Graph

10375 Commits

Author SHA1 Message Date
Paul Sokolovsky b349479a49 tests/class_new: Add another testcase for __new__/__init__ interaction.
Similar to the existing testcase, but test that returning both value of
native type and instance of another user class from __new__ lead to
__init__ not being called, for better coverage.
2017-09-01 00:43:52 +03:00
Scott Shawcroft 4d0dc4b298 py: Add temporary expanded mpy mismatch message for switch to 2.0.0. (#218)
Fixes #214
2017-08-31 15:27:50 -04:00
Scott Shawcroft 17ec02a77d atmel-samd: Add SPI pin names to the Trinket. Fixes #213 (#217) 2017-08-31 15:05:43 -04:00
Dan Halbert 59faa05a10 Add ".frozen" to end of sys.path, so that internal frozen modules are visible on boot. 2017-08-31 11:38:00 -07:00
Dan Halbert fdb97eda09 Add microcontroller.cpu.temperature, for use as a simple sensor on minimal boards. (#211)
* Add microcontroller.cpu, the sole instance of microcontroller.Processor.
microcontroller.cpu.frequency is the clock frequency, in Hz.
microcontroller.cpu.temperature is the reading from the internal temperature sensor, in Celsius. None if not available.

* Squeeze firmware size by using -finline-limit. Otherwise non-Express builds were slightly too big.

* Update submodules.

* Fix documentation glitches
2017-08-31 13:48:30 -04:00
Damien George ca21aed0a1 py: Make m_malloc_fail() have void return type, since it doesn't return. 2017-08-31 17:00:14 +10:00
Damien George 6c9fca2aa9 py/map: Remove unused new/free functions.
Maps are always allocated "statically" and (de)initialised via mp_map_init
and mp_map_deinit.
2017-08-31 16:46:13 +10:00
Damien George 0e420d48ee py/map: Replace always-false condition with assertion. 2017-08-31 16:45:02 +10:00
Damien George 09547f0f51 extmod/modubinascii: Only include uzlib/tinf.h when it's really needed. 2017-08-31 14:10:49 +10:00
Paul Sokolovsky 4556bd2acd py/objtype: mp_obj_class_lookup: Improve debug logging.
Now traces more explicitly thru the lookup process.
2017-08-31 00:44:51 +03:00
Paul Sokolovsky 35be9e805f tests/class_new: Add checks for __init__ being called and other improvements. 2017-08-30 21:33:42 +03:00
Paul Sokolovsky b565c36963 tests/object_new: Better messages, check user __new__() method.
Make messages more verbose and easier to follow and check that user class'
__new__() is not called by object.__new__(user_class).
2017-08-30 21:29:23 +03:00
Paul Sokolovsky df6605eaba py/objtype: mp_obj_instance_make_new: Fix typos in comment. 2017-08-30 20:55:34 +03:00
Damien George 0102ee092b py: Change obsolete "///" comment formatting to normal comments.
This comment style is no longer used because the docs are written by hand,
not generated.
2017-08-30 21:02:00 +10:00
Carol Willing f3cd6b0232 Update README (#212)
* Add README navigation and minor edits
* Simplify links
* Clean up markdown style warnings
* Update links
* Edit grammar and style
2017-08-29 23:42:17 -07:00
Damien George 71c9cfb028 all: Convert remaining "mp_uint_t n_args" to "size_t n_args".
This is to have consistency across the whole repository.
2017-08-30 10:59:58 +10:00
Paul Sokolovsky 784909ce16 py/objtype: Handle NotImplemented return from binary special methods.
NotImplemented means "try other fallbacks (like calling __rop__
instead of __op__) and if nothing works, raise TypeError". As
MicroPython doesn't implement any fallbacks, signal to raise
TypeError right away.
2017-08-30 01:39:24 +03:00
Scott Shawcroft aa700a8b42 shared-bindings: Clarify that UART.read() is slow. (#209) 2017-08-29 14:06:59 -04:00
Damien George 8388ec4e35 stmhal: Update to new STM Cube HAL library.
This upgrades the HAL to the versions:
- F4 V1.16.0
- F7 V1.7.0
- L4 V1.8.1

The main changes were in the SD card driver.  The vendor changed the SD
read/write functions to accept block number intead of byte address, so
there is no longer any need for a custom patch for this in stm32lib.
The CardType values also changed, so pyb.SDCard().info() will return
different values for the 3rd element of the tuple, but this function was
never documented.
2017-08-29 17:03:28 +10:00
Damien George fe6f0354f6 docs/library/micropython: Fix typo in RST formatting. 2017-08-29 16:53:30 +10:00
Damien George e30ba2f1c7 docs/library: Add description of "index" parameter to uos.dupterm(). 2017-08-29 16:50:28 +10:00
Damien George 6568001c00 stmhal/Makefile: Automatically fetch stm32lib submodule if needed. 2017-08-29 13:50:24 +10:00
Damien George 293e81f31e stmhal: Remove cmsis and hal files, they are now a submodule. 2017-08-29 13:40:22 +10:00
Damien George 05eba60d84 stmhal/Makefile: Use lib/stm32lib instead of local cmsis and hal files. 2017-08-29 13:40:09 +10:00
Damien George 904eb2d9f3 lib: Add new submodule, stm32lib containing STM32 CMSIS and HAL source.
Linked to https://github.com/micropython/stm32lib
2017-08-29 13:39:09 +10:00
Damien George 58321dd985 all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate
The unary-op/binary-op enums are already defined, and there are no
arithmetic tricks used with these types, so it makes sense to use the
correct enum type for arguments that take these values.  It also reduces
code size quite a bit for nan-boxing builds.
2017-08-29 13:16:30 +10:00
Damien George be8e5744e6 py/nlrx86,x64: Replace #define of defined() with portable macro usage.
Using gcc -Wpedantic will warn that #define of defined() is non-portable
and this patch fixes this.
2017-08-29 12:52:18 +10:00
Damien George 613510bce8 drivers/memory/spiflash: Change from hard-coded soft SPI to generic SPI.
The SPI flash driver now supports using an arbitrary SPI object to
communicate with the flash chip, and in particular can use a hardware SPI
peripheral.
2017-08-29 11:37:18 +10:00
Paul Sokolovsky d5336ba136 docs/machine.Signal: Improve style/grammar and add usage example. 2017-08-29 00:08:40 +03:00
Paul Sokolovsky 37379a2974 py/objstr: startswith, endswith: Check arg to be a string.
Otherwise, it will silently get incorrect result on other values types,
including CPython tuple form like "foo.png".endswith(("png", "jpg"))
(which MicroPython doesn't support for unbloatedness).
2017-08-29 00:06:21 +03:00
Scott Shawcroft 447a4b1ecd Merge pull request #208 from adafruit/merge-v1.9.2
Merge MicroPython v1.9.2
2017-08-28 13:59:26 -07:00
Paul Sokolovsky c5c095690f docs/library/network: Fix ref to "socket" module (should be "usocket"). 2017-08-28 14:00:16 +03:00
Paul Sokolovsky 358a7ba014 docs: More xrefs to "MicroPython port" in glossary. 2017-08-28 13:51:05 +03:00
Dan Halbert c679c80c71 Modernize module and class static dicts; update freetouch 2017-08-27 15:02:50 -04:00
Scott Shawcroft 4e63d55d8d Fix blinky example
Thanks to @Kurticus and @scruffynerf from [discord](http://adafru.it/discord) for finding it.
2017-08-26 22:24:17 -07:00
Dan Halbert ef61b5ecb5 Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet
esp8266 not tested yet
2017-08-25 22:17:07 -04:00
Scott Shawcroft 266be30777 atmel-samd: Introduce a nvm module for non-volatile byte-level memory access. (#203)
* atmel-samd: Introduce a nvm module for non-volatile byte-level memory access.

This allows for persisting small configuration values even when the file system
is read-only from CircuitPython.

Fixes #160

* Review feedback:
* Add tests.
* Fix non-zero index.
* Fix len()
2017-08-25 16:00:27 -04:00
Damien George 7e6881cf7d stmhal/boards/pllvalues.py: Make script work with both Python 2 and 3. 2017-08-24 22:43:36 +10:00
Damien George 3e1412a1fb stmhal/Makefile: Use GEN_PINS_HDR var instead of writing it explicitly. 2017-08-24 13:09:35 +10:00
Damien George a8052d343c stmhal/modmachine: For F7 MCU, save power by reducing internal volt reg. 2017-08-24 12:20:26 +10:00
Damien George 41b4686dd7 stmhal: Compute PLL freq table during build instead of at run time.
Allows for simpler, smaller and faster code at run time when selecting the
boards frequency, and allows more customisation opportunities for the PLL
values depending on the target MCU.
2017-08-24 11:38:39 +10:00
Dan Halbert dd1c4fc8c7 Workaround readthedocs bug 2017-08-23 15:28:53 -07:00
Scott Shawcroft 774bf0cf0a tools: Always upload to Rosie from Travis. (#200)
This allows Rosie to automatically work for commits to forks.
2017-08-23 12:22:08 -07:00
Dan Halbert 74cfdeb316 Added ability to freeze multiple directories; freeze neopixel library in cpx build (#199)
Reworked frozen module support: clean up makefiles and handle multiple directories.
Modules to freeze are included as git submodules.

Add neopixel to circuitplayground express build.

Fixes #56
2017-08-23 11:05:59 -07:00
Damien George b84268d49c docs/pyboard/tutorial: Add "timeout=0" to UART in pass-through example.
Without this the pass-through will pause for 1 second at each character.
2017-08-23 17:01:43 +10:00
Damien George fc483706d3 stmhal/modmachine: Improve support for sleep/deepsleep on F7 MCUs.
Changes for F7 are:
- machine.reset_cause() now reports DEEPSLEEP_RESET correctly;
- machine.sleep() is further optimised to reduce power consumption;
- machine.deepsleep() is now implemented and working.
2017-08-23 17:00:02 +10:00
Damien George 49316b864b stmhal/modmachine: Make machine.bootloader() work when MPU is enabled. 2017-08-23 16:58:48 +10:00
Damien George 1f78e7a431 docs: Bump version to 1.9.2. 2017-08-23 11:46:35 +10:00
Damien George f9ecaa132f py/asmthumb: Use existing macro to properly clear the D-cache.
This macro is provided by stmhal/mphalport.h and makes sure the addr and
size arguments are correctly aligned.
2017-08-23 11:32:27 +10:00
Scott Shawcroft 16ef611b0b shared-bindings: Check that extra args aren't provided to digitalio.DigitalInOut on construction. (#189) 2017-08-22 15:54:01 -04:00