Commit Graph

8333 Commits

Author SHA1 Message Date
Damien George 81d2ca2b12 py/objtuple: Add support for inplace add (same as normal add). 2017-04-05 12:38:02 +10:00
Damien George dcd8f52766 tests/basics: Add tests for raising ValueError when range() gets 0 step. 2017-04-05 10:52:29 +10:00
Damien George de9b53695d py: Raise a ValueError if range() step is zero.
Following CPython.  Otherwise one gets either an infinite loop (if code is
optimised by the uPy compiler) or possibly a divide-by-zero CPU exception.
2017-04-05 10:50:26 +10:00
Paul Sokolovsky 546ef301a1 tools/pyboard: execpty: Use shell=False to workaround some curdir issues.
Without this, Zephyr's port "make test" doesn't work.
2017-04-05 00:46:12 +03:00
Paul Sokolovsky a9e6f08adb zephyr/Makefile: Add "test" target, runs testsuite in QEMU. 2017-04-05 00:46:00 +03:00
Glenn Ruben Bakke a4173c467f nrf5/bluetooth: Adding webbluetooth REPL template. Alternating advertisment of eddystone URL and UART BLE service every 500 ms. Adding new config parameter to bluetooth_conf.h to enable webbluetooth repl. Has to be configured in combination with BLE_NUS. Eddystone URL not pointing to a valid WebBluetooth application at the moment, but rather to micropython.org as a placeholder for now. 2017-04-04 22:31:17 +02:00
Glenn Ruben Bakke 587c6277c4 nrf5/modules/ubluepy: Adding method Peripheral object to stop any ongoing advertisment. Adding compile guard to only include advertise and advertise_stop if peripheral role is compiled in. 2017-04-04 21:25:28 +02:00
Glenn Ruben Bakke 31feea4511 nrf5/bluetooth: Adding function to stop advertisment if onging 2017-04-04 21:22:49 +02:00
Glenn Ruben Bakke 46c21ff6ba nrf5/modules/ubluepy: Adding support for starting advertisment from BLE UART REPL, by delaying registration of gatt/gatts and gattc handlers until needed in advertise or connect. If non connectable advertisment is selected, handlers in peripheral new is not anymore overriding the other peripheral instances which has set the callbacks. 2017-04-04 20:24:43 +02:00
Paul Sokolovsky 647e72ca63 tools/pyboard: Add "exec" and "execpty" pseudo-devices support.
This allows to execute a command and communicate with its stdin/stdout
via pipes ("exec") or with command-created pseudo-terminal ("execpty"),
to emulate serial access. Immediate usecase is controlling a QEMU process
which emulates board's serial via normal console, but it could be used
e.g. with helper binaries to access real board over other hadware
protocols, etc.

An example of device specification for these cases is:

	--device exec:../zephyr/qemu.sh
	--device execpty:../zephyr/qemu2.sh

Where qemu.sh contains long-long qemu startup line, or calls another
command. There's a special support in this patch for running the command
in a new terminal session, to support shell wrappers like that (without
new terminal session, only wrapper script would be terminated, but its
child processes would continue to run).
2017-04-04 17:46:02 +03:00
Paul Sokolovsky 58168c8e6b zephyr/zephyr_getchar: Explicitly yield to other threads on char availability.
Without this, if there's a large chunk of data coming from hardware (e.g.
clipboard paste, or fed programmatically from the other side of the console),
there's a behavior of initial mass fill-in of the buffer without any
consumption, which starts much later and doesn't catch up with further
filling, leading to buffer overflow.
2017-04-04 17:14:53 +03:00
Peter Hinch 468c6f9da1 extmod/modframebuf: Make monochrome bitmap formats start with MONO_.
MONO_xxx is much easier to read if you're not familiar with the code.
MVLSB is deprecated but kept for backwards compatibility, for the time
being.

This patch also updates the associated docs and tests.
2017-04-04 17:38:33 +10:00
Damien George fc245d1ca4 py/objint: Consolidate mp_obj_new_int_from_float to one implementation.
This reduces code duplication and allows to make mp_classify_fp_as_int
static, which reduces code size.
2017-04-04 16:45:49 +10:00
Damien George 3b447ede78 stmhal/usbd_cdc_interface: Change CDC RX to use a circular buffer.
This should be a little more efficient (since we anyway scan the input
packet for the interrupt char), and it should also fix any non-atomic read
issues with the buffer state being changed during an interrupt.

Throughput tests show that RX rate is unchanged by this patch.
2017-04-04 16:23:25 +10:00
Damien George 9a8e7f7a8e stmhal/usbd_cdc_interface: Increase in-endpoint timeout to 500ms.
The previous timeout value of 150ms could lead to data being lost (ie never
received by the host) in some rare cases, eg when the host is under load.
A value of 500ms is quite conservative and allows the host plenty of time
to read our data.
2017-04-04 15:18:58 +10:00
Paul Sokolovsky 2908c3ca41 zephyr/modusocket: Factor out socket_new() function.
It will be reused e.g. for accept() implementation.
2017-04-04 06:28:14 +03:00
Paul Sokolovsky 6e99a8c94e zephyr/modusocket: Be sure to use MP_OBJ_FROM_PTR. 2017-04-04 06:21:09 +03:00
Damien George 805b1c8bc3 tests/run-tests: Update names of tests that may need skipping. 2017-04-04 12:26:43 +10:00
Damien George 677fb31015 tests/float: Add tests for hashing float and complex numbers. 2017-04-04 12:14:34 +10:00
Damien George 19f2e47d59 py: Add very simple but correct hashing for float and complex numbers.
Hashing of float and complex numbers that are exact (real) integers should
return the same integer hash value as hashing the corresponding integer
value.  Eg hash(1), hash(1.0) and hash(1+0j) should all be the same (this
is how Python is specified: if x==y then hash(x)==hash(y)).

This patch implements the simplest way of doing float/complex hashing by
just converting the value to int and returning that value.
2017-04-04 11:57:21 +10:00
Paul Sokolovsky bb296482c3 docs/library/btree: Add btree module docs. 2017-04-04 00:29:23 +03:00
Paul Sokolovsky 4c392243ae zephyr/prj_base.conf: Add config for net_buf logging.
Disabled by default.
2017-04-03 12:07:56 +03:00
Paul Sokolovsky 831e157226 tests/run-tests: Introduce generic "minimal" target.
Used e.g. by Zephyr port.
2017-04-03 10:20:48 +03:00
Damien George 7df4558df8 esp8266: Remove unused entry in port root pointers. 2017-04-03 16:10:46 +10:00
Paul Sokolovsky 806c07c898 tests/micropython/heapalloc_iter: Improve skippability. 2017-04-03 00:27:01 +03:00
Paul Sokolovsky 28876d3902 tests/float/byte*_construct: Skip on missing array module. 2017-04-03 00:17:43 +03:00
Paul Sokolovsky 499ea8b253 tests/extmod/vfs_fat_fileio*: Improve skippability.
Should be skipped on missing uso, uerrno modules.
2017-04-03 00:14:57 +03:00
Paul Sokolovsky b099aeb3ca run-tests: Add feature check for "const" keyword and skip related tests. 2017-04-02 22:52:18 +03:00
Paul Sokolovsky b9e9cfcfc1 tests: vfs_fat_fileio.py is too big to be parsed in 16K heap, split in 2.
This restores ability to run testsuite with 16K heap.
2017-04-02 22:02:11 +03:00
Paul Sokolovsky 9a973977bb py/objstr: Use MICROPY_FULL_CHECKS for range checking when constructing bytes.
Split this setting from MICROPY_CPYTHON_COMPAT. The idea is to be able to
keep MICROPY_CPYTHON_COMPAT disabled, but still pass more of regression
testsuite. In particular, this fixes last failing test in basics/ for
Zephyr port.
2017-04-02 21:20:07 +03:00
Paul Sokolovsky 5b2db4bb51 tests/run-tests: Be sure to close Pyboard object on completion.
So underlying device was properly closed too.
2017-04-02 20:49:16 +03:00
Paul Sokolovsky 9b3f423c14 tools/pyboard: Tighten up Pyboard object closure on errors.
Some "device" implementations may be sensitive to this.
2017-04-02 20:48:53 +03:00
Glenn Ruben Bakke 0559be4ffc nrf5/bluetooth: Adding possibility to configure whether advertisment should be connectable or not. 2017-04-02 18:34:56 +02:00
Glenn Ruben Bakke ce6221ef61 nrf5/bluetooth: Removing legacy advertise function in the bluetooth driver, which only did a hardcoded eddystone beacone advertisment. 2017-04-02 16:55:47 +02:00
Glenn Ruben Bakke e5fc082366 nrf5/help: Updating ble module help description to also include the address method. 2017-04-02 16:44:37 +02:00
Glenn Ruben Bakke 6fcb0a40e9 nrf5/bluetooth: Renaming the ble module method address_print() to address(), as it will now return a string of the resolved local address. Updating the function to create a string out the local address and return this. 2017-04-02 16:43:16 +02:00
Glenn Ruben Bakke 7e52da7ccb nrf5/bluetooth: Update ble_drv_address_get to new api which pass in a address struct to fill by reference. Updating implementation to copy the address data. Also ensuring that the bluetooth stack has been enabled before fetching the address from the bluetooth stack. 2017-04-02 16:41:08 +02:00
Glenn Ruben Bakke 1402574b7d nrf5/bluetooth: Adding new structure which can hold local address. Updating api prototype for ble_drv_address_get with a address structure by reference. 2017-04-02 16:39:14 +02:00
Glenn Ruben Bakke e3773e899f nrf5/bluetooth: Updating help text for ble module to also list up enabled() function which queries the bluetooth stack on whether it is enabled or not. 2017-04-02 16:17:39 +02:00
Glenn Ruben Bakke c7f0069aac nrf5/bluetooth: Removing advertise from ble module. Removing help text as well. 2017-04-02 16:14:48 +02:00
Glenn Ruben Bakke c8097eb470 nrf5/examples: Adding python eddystone example using ubluepy api. 2017-04-02 15:51:00 +02:00
Glenn Ruben Bakke f7fbf55a45 nrf5/modules/ubluepy: Open up Peripheral advertise method to pass custom data to the bluetooth driver. Allowing method to allow kwargs only if no args is set. To support setting data kwarg only. 2017-04-02 15:50:07 +02:00
Glenn Ruben Bakke 58238a43b3 nrf5/modules/ubluepy: Adding new members to the ublupy advertisment parameters, to hold custom data payload if set. 2017-04-02 15:48:32 +02:00
Glenn Ruben Bakke 52c07e7cb2 nrf5/bluetooth: Cleaning up stack enable function, to not set device name twice. Also, adding support for setting custom advertisment data. 2017-04-02 15:45:02 +02:00
Paul Sokolovsky ca81c3ab0b zephyr/modusocket: Implement recv() for TCP sockets.
Short read approach is taken - at most, the remaining data in the current
fragment will be returned.
2017-04-02 16:27:09 +03:00
Damien George bf51e2ff98 tests/basics: Add tests for list and bytearray growing using themselves. 2017-04-02 17:31:32 +10:00
Damien George a5500a8aad py/obj.h: Make sequence grow more efficient and support overlapping.
The first memmove now copies less bytes in some cases (because len_adj <=
slice_len), and the memcpy is replaced with memmove to support the
possibility that dest and slice regions are overlapping.
2017-04-02 17:28:24 +10:00
Glenn Ruben Bakke 5f645b6c8e nrf5/modules/ubluepy: Adding compile guard for UBLUEPY_CENTRAL around the char_read() call to ble_drv_attr_c_read(). 2017-04-02 00:31:28 +02:00
Glenn Ruben Bakke 84e5b828ea nrf5/bluetooth: Moving central code inside central bluetooth stack defines to make peripheral only code compile again. 2017-04-02 00:30:16 +02:00
Glenn Ruben Bakke 460f6dee50 nrf5/examples: Updating ubluepy scan example to use constant value from ubluepy instead of hardcoded value. 2017-04-01 22:50:37 +02:00