Commit Graph

10000 Commits

Author SHA1 Message Date
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
Scott Shawcroft
f570b53d44 shared-bindings: Update DigitalIO.pull docs and validate that third (#188)
state is None and not anything.

Fixes #187
2017-08-22 15:41:04 -04:00
Scott Shawcroft
45a31b1c2a Fix ADC input def for PB07. (#195)
Fixes #194
2017-08-22 15:19:05 -04:00
Paul Sokolovsky
64a3c52f66 docs: Consistently link to micropython-lib in glossary. 2017-08-22 09:33:31 +03:00
Ein Terakawa
ab2c64cc76 esp8266: Fix UART stop bit constants.
As per the "ESP8266 Technical Reference".
2017-08-21 22:50:07 +10:00
Damien George
1c6b442d32 extmod/modubinascii: Don't post-increment variable that won't be used. 2017-08-21 22:05:39 +10:00
Damien George
f5309fc4ff py/formatfloat: Don't post-increment variable that won't be used again. 2017-08-21 22:04:23 +10:00
Damien George
103ae43f95 py/objcomplex: Remove unnecessary assignment of variable. 2017-08-21 22:03:27 +10:00
Damien George
ad6aae13a4 py/compile: Remove unused pn_colon code when compiling func params. 2017-08-21 22:00:34 +10:00
Damien George
4ec803a42a all: Make static dicts use mp_rom_map_elem_t type and MP_ROM_xxx macros. 2017-08-21 21:34:23 +10:00
Damien George
4c736ea8fc extmod,unix: For uos.stat interpret st_size member as an unsigned int.
This prevents large files (eg larger than 2gb on a 32-bit arch) from
showing up as having a negative size.  Fixes issue #3227.
2017-08-21 20:47:22 +10:00
Damien George
b16a755a0b py/mkrules.mk: Use "find -path" when searching for frozen obj files.
This allows the command to succeed without error even if there is no
$(BUILD)/build directory, which is the case for mpy-cross.
2017-08-21 20:32:30 +10:00
Paul Sokolovsky
e3383e9352 py/stream: seek: Consistently handle negative offset for SEEK_SET.
Per POSIX, this is EINVAL, so raises OSError(EINVAL).
2017-08-20 22:02:41 +03:00
Paul Sokolovsky
0cd9ab7755 py/objstringio: Fix regression with handling SEEK_SET.
For SEEK_SET, offset should be treated as unsigned, to allow full-width
stream sizes (e.g. 32-bit instead of 31-bit). This is now fully documented
in stream.h. Also, seek symbolic constants are added.
2017-08-20 22:02:41 +03:00
Tom Collins
168350cd98 py/objstringio: Prevent offset wraparound for io.BytesIO objects.
Too big positive, or too big negative offset values could lead to overflow
and address space wraparound and thus access to unrelated areas of memory
(a security issue).
2017-08-20 22:00:05 +03:00
Paul Sokolovsky
387a8d26f9 docs/glossary: Fix typos in micropython-lib paragraph. 2017-08-20 10:44:02 +03:00
Paul Sokolovsky
46583e9057 docs/glossary: Elaborate on possible MicroPython port differences.
State that this doc describes generic, "core" MicroPython functionality,
any particular port may diverge in both directions, by both omitting
some functionality, and adding more, both cases described outside the
generic documentation.
2017-08-20 10:11:44 +03:00
Paul Sokolovsky
3f91570483 docs/library/usocket: Describe complete information on address formats.
Describe that the only portable way to deal with addresses is by using
getaddrinfo(). Describe that some ports may support tuple addresses using
"socket" module (vs "usocket" of native MicroPython).
2017-08-20 09:49:12 +03:00
Paul Sokolovsky
ccaad53270 docs/library/usocket: Move socket.error to its own section.
It's too minor a point to start the module description with it.
2017-08-20 09:04:48 +03:00
Paul Sokolovsky
478887c62f zephyr/modzephyr: Add shell_net_iface() function.
Calls out to Zephyr's shell, submodule "net", command "iface", and shows
network interface information (if CONFIG_NET_SHELL is enabled).
2017-08-20 08:57:34 +03:00
Paul Sokolovsky
394c536675 zephyr/prj_96b_carbon.conf: Re-enable networking on Carbon.
The original issue leading to crash on startup if no default network
interface was presented, was resolved some time ago.

Note that this enables generic networking subsystem, not networking
on Carbon.
2017-08-19 11:55:18 +03:00
Paul Sokolovsky
09b561f108 zephyr/modusocket: Update struct sockaddr family field name.
Was changed to "sa_family" for POSIX compatibility.
2017-08-19 11:45:21 +03:00
Alex Robbins
0aa1d3f447 docs/library/ubinascii: Update base64 docs.
This clarifies return values and the handling of invalid (e.g. newline)
characters.

Encoding conforms to RFC 3548, but decoding does not, as it ignores invalid
characters in base64 input. Instead, it conforms to MIME handling of base64
(RFC 2045).

Note that CPython doesn't document handling of invalid characters in
a2b_base64() docs:
https://docs.python.org/3/library/binascii.html#binascii.a2b_base64 , so
we specify it more explicitly than it, based on CPython's actual behavior
(with which MicroPython now compliant).
2017-08-17 09:25:51 +03:00
Alex Robbins
c89254fd0f extmod/modubinascii: Rewrite mod_binascii_a2b_base64.
This implementation ignores invalid characters in the input. This allows
it to decode the output of b2a_base64, and also mimics the behavior of
CPython.
2017-08-17 09:25:51 +03:00
Damien George
025e5f2b33 py/binary: Change internal bytearray typecode from 0 to 1.
The value of 0 can't be used because otherwise mp_binary_get_size will let
a null byte through as the type code (intepreted as byterray).  This can
lead to invalid type-specifier strings being let through without an error
in the struct module, and even buffer overruns.
2017-08-17 16:19:35 +10:00
Tony DiCola
c281b44cbd Update docs README to mention requirement for recommonmark dependency. 2017-08-16 15:23:42 -07:00