Commit Graph

308 Commits

Author SHA1 Message Date
Paul Sokolovsky 67d52d8cb9 extmod/uzlib/: Update uzlib to v2.0.3.
Fixes for more pedantic warnings.
2016-09-24 16:07:18 +03:00
Paul Sokolovsky 7b901d6fb7 extmod/moduzlib: DecompIO: Add support for gzip-formatted streams.
This uses extension introduced in CPython 3.5: if wbits (dictionary size
code) has value 16 + 8..15, it means that gzip-formatted stream expected.
2016-09-24 15:30:11 +03:00
Paul Sokolovsky d8a4d9d67c extmod/uzlib: Add tinfgzip.c (gzip header parsing) from upstream. 2016-09-24 15:28:51 +03:00
Paul Sokolovsky 46ab042230 extmod/modussl_mbedtls: Add server_hostname param for wrap_socket().
In CPython, module-level .wrap_socket() function actually doesn't accept
(or document) this param, only SSLContext.wrap_socket() has.
2016-09-23 01:44:23 +03:00
Radomir Dopieralski ec078af985 extmod/machine_i2c: Add clock stretching support.
When the clock is too fast for the i2c slave, it can temporarily hold
down the scl line to signal to the master that it needs to wait. The
master should check the scl line when it is releasing it after
transmitting data, and wait for it to be released.

This change has been tested with a logic analyzer and an i2c slace
implemented on an atmega328p using its twi peripheral, clocked at 8Mhz.
Without the change, the i2c communication works up to aboy 150kHz
frequency, and above that results in the slave stuck in an unresponsive
state. With this change, communication has been tested to work up to
400kHz.
2016-09-22 14:10:02 +10:00
Paul Sokolovsky 080e4d44f3 extmod/modussl_mbedtls: Use 2-component include paths.
This is required to use mbedTLS versions from various sources, e.g.
mainline vs embedded into Zephyr RTOS.
2016-09-22 01:30:48 +03:00
Paul Sokolovsky 5f0ecb72c2 extmod/modussl_mbedtls: Implement key= and cert= args to wrap_socket().
Unlike standard keyfile= and certfile=, these accept byte buffer objects
(to not depend on FS implementation).
2016-09-22 00:17:44 +03:00
Pavol Rusnak 7f5a541b84 extmod/modubinascii: Fix crc32() function on 32-bit platforms. 2016-09-21 21:40:18 +03:00
Stefan Agner b84e1231c9 extmod/uctypes: Allow full 32-bit address range.
Use mp_obj_int_get_truncated to allow the full 32-bit address range
as first parameter.
2016-09-21 21:37:08 +03:00
Paul Sokolovsky 9ea2882317 extmod/modussl_mbedtls: Initial implementation of mbedTLS ussl module. 2016-09-21 21:25:33 +03:00
Damien George 93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Radomir Dopieralski 778729c597 extmod/framebuf: Add the xstep!=0 case to scroll() method.
Adds horizontal scrolling. Right now, I'm just leaving the margins
created by the scrolling as they were -- so they will repeat the
edge of the framebuf. This is fast, and the user can always fill
the margins themselves.
2016-09-05 12:06:56 +10:00
Paul Sokolovsky 1bc5cb4312 extmod/moduzlib: Support wbits arg to DecompIO. 2016-09-04 14:44:12 +03:00
Damien George 47899a1ab8 extmod/modframebuf: Include font from stmhal directory explicitly.
So that users of framebuf don't need to have stmhal directory in their
path.  (Eventually the font can be moved elsewhere.)
2016-09-04 16:39:28 +10:00
Paul Sokolovsky f7c4611523 extmod/moduzlib: Use mperrno.h for error constants. 2016-09-03 00:34:57 +03:00
Paul Sokolovsky a6864a13c7 extmod/moduzlib: Implement zlib stream decompressor class, DecompIO. 2016-09-03 00:19:35 +03:00
Radomir Dopieralski 41ec22632d extmod/modframebuf: Fix fill and scroll when height not divisible by 8.
There was a bug in `framebuf1_fill` function, that makes it leave a few
lines unfilled at the bottom if the height is not divisible by 8.

A similar bug is fixed in the scroll method.
2016-09-02 23:58:34 +10:00
Damien George 0823c1baf8 extmod: Add machine_spi with generic SPI C-protocol and helper methods.
The idea is that all ports can use these helper methods and only need to
provide initialisation of the SPI bus, as well as a single transfer
function.  The coding pattern follows the stream protocol and helper
methods.
2016-09-01 15:07:20 +10:00
Damien George 531217a06b extmod/modframebuf: Fix pixel accessor to return a 1-bit result. 2016-08-27 18:31:58 +10:00
Radomir Dopieralski d29ca28288 esp8266/modous: Add os.umount method to unmount a filesystem.
This is an object-oriented approach, where uos is only a proxy for the
methods on the vfs object.  Some internals had to be exposed (the STATIC
keyword removed) for this to work.

Fixes #2338.
2016-08-26 12:45:21 +10:00
Paul Sokolovsky c428367543 extmod/modubinascii: Make crc32() support configurable.
Disable by default, enable in unix port.
2016-08-24 18:28:43 +03:00
Pavol Rusnak 39799f7564
extmod/modubinascii: implement binascii.crc32 2016-08-24 10:42:46 +02:00
Krzysztof Blazewicz 5a5449d4eb extmod/modbtree: do CHECK_ERROR after __bt_seq()
In `btree_seq()`, when `__bt_seq()` gets called with invalid
`flags` argument it will return `RET_ERROR` and it won't
initialize `val`. If field `data` of uninitialized `val`
is passed to `mp_obj_new_bytes()` it causes a segfault.
2016-08-24 01:31:16 +03:00
Paul Sokolovsky 49dd532180 extmod/uzlib/: Update uzlib to v2.0.2.
Consistently use stdint types. Fixes stmhal build.
2016-08-17 14:47:30 +03:00
Paul Sokolovsky 244332df9f extmod/uzlib/: Update uzlib to v2.0.1.
Fixes for pedantic compiler warnings.
2016-08-17 06:24:12 +03:00
Paul Sokolovsky ed4ce196ed extmod/moduzlib: Refactor to new stream-compatible uzlib 2.0 API. 2016-08-17 06:06:34 +03:00
Paul Sokolovsky ff1c2b03a9 extmod/uzlib/: Update uzlib to v2.0.
New API supporting stream decompression.
2016-08-17 06:06:33 +03:00
Paul Sokolovsky d2cc7c720b extmod/modwebrepl: set_password(): Raise exception for too long password. 2016-08-16 17:02:04 +03:00
Paul Sokolovsky e15fb33e10 extmod/modwebrepl: Add GET_VER operation to query MicroPython version. 2016-08-07 00:01:25 +03:00
Paul Sokolovsky cbef0dba2e extmod/modwebsocket: Use mp_rom_map_elem_t and friends. 2016-08-06 16:18:03 +03:00
Paul Sokolovsky e0d49b7e1b extmod/modwebsocket: Make compatible with non-default object models. 2016-08-06 15:53:16 +03:00
Paul Sokolovsky a931c4eeec extmod/modwebsocket: Add readline method.
This goes bit against websocket nature (message-based communication),
as it ignores boundaries bertween messages, but may be very practical
to do simple things with websockets.
2016-08-06 15:13:26 +03:00
Paul Sokolovsky d79342d33e extmod/modbtree: open(): Add option kwargs.
Namely: flags, cachesize, pagesize, minkeypage.
2016-08-06 00:10:22 +03:00
Paul Sokolovsky ed500e4987 extmod/modwebrepl: Make GET_FILE operation non-blocking.
In the sense that while GET_FILE transfers its data, REPL still works.
This is done by requiring client to send 1-byte block before WebREPL
server transfers next block of data.
2016-08-05 22:57:50 +03:00
Paul Sokolovsky c16612ee87 extmod/modwebrepl: Factor out "GET" iteration to write_file_chunk(). 2016-08-05 22:53:10 +03:00
Paul Sokolovsky 3eb532e974 extmod/modbtree: Implement __contains__ operation. 2016-08-02 00:24:59 +03:00
Paul Sokolovsky 99061d1dcb extmod/modbtree: Switch to accepting stream object instead of filename.
Requires "embedded" BerkeleyDB BTree implementation.
2016-07-31 00:40:35 +03:00
Paul Sokolovsky 4f1b0292db py/stream: Add adapter methods with POSIX-compatible signatures.
Previoussly such read() and write() methods were used by modussl_axtls,
move to py/stream for reuse.
2016-07-30 00:25:06 +03:00
Paul Sokolovsky 25df419c67 extmod/modbtree: Check __bt_open() return value for error. 2016-07-24 00:29:32 +03:00
Paul Sokolovsky 2dd21d9a68 extmod/modwebrepl: Use mp_stream_close() method. 2016-07-23 00:52:35 +03:00
Paul Sokolovsky a53e0e59f3 extmod/modussl_axtls: Use mp_stream_close() method. 2016-07-23 00:38:56 +03:00
Paul Sokolovsky 0a6f599cf2 extmod/vfs_fat: Implement rmdir() method.
Shares the code with remove() method due to the same underlying f_unlink()
FatFs operation.
2016-07-16 03:46:42 +03:00
Paul Sokolovsky 780114e398 extmod/modussl_axtls: Add dummy setblocking() method.
Accepts only value of True.
2016-07-15 01:05:06 +03:00
Paul Sokolovsky 20283aec10 extmod/modussl_axtls: Further changes to allow alternative SSL modules.
Make variable MICROPY_SSL_AXTLS=1 should be defined to activate modussl_axtls
and link with -laxtls.
2016-07-13 01:49:38 +03:00
Paul Sokolovsky e32d1e17bb extmod/modussl: Rename to modussl_axtls.c, to allow impl using other SSL libs. 2016-07-13 01:35:59 +03:00
Paul Sokolovsky a4c8a1ffe8 extmod/moduos_dupterm: Reuse dupterm_arr_obj for write operations.
Instead of allocating new array object header again and again, causing
memory fragmentation.
2016-07-07 02:16:24 +03:00
Paul Sokolovsky 426112ce88 extmod/moduos_dupterm: Reserve buffer bytearray object for dupterm.
Allocating it for each read/write operation is a memory fragmentation
hazard.
2016-07-04 13:32:30 +03:00
Paul Sokolovsky 417dc0c05d extmod/modbtree: Fixes for nanbox build. 2016-07-02 15:58:13 +03:00
Paul Sokolovsky b09cd0e1ec extmod/modbtree: Fix unused argument warning. 2016-07-02 15:21:54 +03:00
Paul Sokolovsky c880f91ac0 extmod/modwebrepl: Add readinto() method. 2016-07-02 14:05:37 +03:00