Add basic support for LEGO HUB NO.6 (e.g. LEGO SPIKE Prime, LEGO MINDSTORMS
Robot Inventor).
See README.md for details.
Thanks to @dpgeorge for helping put this together.
Signed-off-by: Tobias Thyrrestrup <tt@LEGO.com>
It needs to use a different function because the formula to compute the
baudrate on LPUART1 is different to a normal UART.
Fixes issue #7466.
Signed-off-by: Damien George <damien@micropython.org>
Prior to this fix, if the UART hardware FIFO had a few chars but still
below the FIFO trigger threshold, and the ringbuf was empty, the read
function would timeout if timeout==0 (the default timeout).
This fix follows the suggestion of @iabdalkader.
The RX IRQ does not trigger if the FIFO is less than the trigger level, in
which case characters may be available in the FIFO, yet not in the ringbuf,
and the ioctl returns false.
When l2cap_send detects that the sys mempool is running low (used to store
the outgoing HCI payloads), it will report stalled back to the application,
and then only unstall once these HCI payloads have been sent.
This prevents a situation where a remote receiver with very large MTU can
cause NimBLE to queue up more than MYNEWT_VAL_MSYS_1_BLOCK_COUNT (i.e. 12)
payloads, causing further attempts to send to fail with ENOMEM (even though
the channel is not stalled and we have room in the channel mbufs). The
regular credit/stall flow control is not effective here because the
receiver's MTU is large enough that it will not activate (i.e. there are
lots of credits available).
Thresholds of 1/2 (stall) and 1/4 (unstall) chosen to allow headroom for
other payloads (e.g. notifications) and that when a regular stall occurs it
might keep sending (and creating more payloads) in the background.
Previously a subclass of a type that didn't implement unary_op, or didn't
handle MP_UNARY_OP_BOOL, would raise TypeError on bool conversion.
Fixes#5677.
* Make SDRAM test cache-aware for newer MCUs.
* Use the defined data bus width (instead of the fixed 8-bits).
* Allow optional failure on error with verbose error messages.
* Test speed is now inverted (test accepts exhaustive instead fast).
This helps the OS switch to and give other threads processing time during
the sleep. It also ensures that pending events are handled, even when
sleeping for 0ms.
Fixes issue #5344.
Signed-off-by: Damien George <damien@micropython.org>
Call MICROPY_EVENT_POLL_HOOK even on very short delays so that busy loops
that call sleep_ms still yield to events and other threads.
See related issue #5344.
Replace "master" with "controller" and "slave" with "peripheral" in
comments, errors, and debug messages.
Add CONTROLLER and PERIPHERAL constants to pyb.SPI and pyb.I2C classes;
retain MASTER and SLAVE constants for backward compatiblity.
In 2ae3c890bd, -Wimplicit-fallthrough=0 was
added to get the build to pass. This option is equivalent to
-Wno-implicit-fallthrough, and the latter is compatible with clang (while
the former is not).
Fixes issue #7546.
Signed-off-by: Damien George <damien@micropython.org>
A correctly-behaved application shouldn't do this, but in the
case where the channel is stalled, there's still enough room
in the mbuf pool, then we'll fail the send (BLE_HS_EBUSY) so
the mbuf needs to be freed.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This adds #if MICROPY_PY_USELECT_SELECT around the uselect.select()
function. According to the docs, this function is only for CPython
compatibility and should not normally be used. So we can disable it
and save a few bytes of flash space where possible.
Signed-off-by: David Lechner <david@pybricks.com>
Using a 2-item transaction queue instead of 1 allows long transfers to
be executed with the minimum inter-transaction delay. Limit maximum
transaction length to ensure an integer multiple of the SPI `bits`
setting are transferred. Fixes#7511.