Commit Graph

8597 Commits

Author SHA1 Message Date
Paul Sokolovsky
f1c0676a70 zephyr/modusocket: Implement listen(). 2017-04-07 16:47:10 +03:00
Paul Sokolovsky
e5278b98fe docs/esp8266/general: Start explicit "Known Issues", mentioned RTC inaccuracy. 2017-04-07 10:52:50 +03:00
Damien George
d7310fabc2 drivers/nrf24l01: Update to work on newer ports, using machine, utime.
Changes made are:
- Use the time module in place of the pyb module for delays.
- Use spi.read/spi.write instead of spi.send/spi.receive.
- Drop some non-portable parameters to spi and pin initialization.

Thanks to @deshipu for the original patch.
2017-04-07 15:54:21 +10:00
Paul Sokolovsky
3e1310d6e2 tools/pyboard: Provide more details when expected reply not received.
When trying to execute a command via raw REPL and expected "OK" reply
not received, show what was received instead.
2017-04-07 01:04:47 +03:00
Paul Sokolovsky
1da8404647 modusocket: Handle a case when recv_q is empty when EOF is signaled.
In this case, we can mark socket as closed directly.
2017-04-06 10:12:14 +03:00
Paul Sokolovsky
faf333c04f zephyr/modusocket: Factor out "extended k_fifo API".
Internal structure of k_fifo changed between 1.7 and 1.8, so we need
to abstract it away. This adds more functions than currently used, for
future work.
2017-04-05 13:39:16 +03:00
Paul Sokolovsky
390d5a3bf1 docs/machine.Pin: Move wipy-specific methods to its docs. 2017-04-05 13:05:04 +03:00
Paul Sokolovsky
2cbe997834 tools/pyboard: ProcessPtyToTerminal: Add workaround for PySerial bug.
When working with a "virtual" port, like PTY. The issue described in
http://stackoverflow.com/questions/34831131/pyserial-does-not-play-well-with-virtual-port
2017-04-05 12:30:39 +03:00
Paul Sokolovsky
d46899626e docs/machine.Pin: Move wipy-specific details to its own docs. 2017-04-05 12:09:36 +03:00
Paul Sokolovsky
9a38b7afe0 cc3200/modmachine: Return frequency value directly, like other ports. 2017-04-05 11:58:17 +03:00
Paul Sokolovsky
4333b2fb53 docs/machine.SPI: Remove outdated wipy chunk. 2017-04-05 11:47:15 +03:00
Paul Sokolovsky
906d58f6f2 docs/uos: De-conditionalize statvfs() description.
It's a standard function, and it's already described (in the library
intro) that for any given port, any function may be missing.
2017-04-05 11:44:10 +03:00
Paul Sokolovsky
0a861db91c docs/utime: De-conditionalize description of sleep_ms() and friends.
These are basic MicroPython API, and all ports should implement them.
2017-04-05 11:40:47 +03:00
Damien George
b6fff4186d tests/basics: Add test for tuple inplace add. 2017-04-05 12:38:18 +10:00
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