Christian Decker
2e3a2785cd
extmod/modubinascii: Add newline keyword to b2a_base64 function.
This allows encoding things (eg a Basic-Auth header for a request) without
slicing the \n from the string, which allocates additional memory.
Co-authored-by: David Lechner <david@lechnology.com>
3 years ago
Damien George
7d71ae25ed
extmod/machine_i2c: Increase default SoftI2C timeout to 50ms.
Some devices, eg BNO055, can stretch SCL for a long time, so make the
default large to accommodate them. 50ms matches the current default for
stm32 hardware I2C .
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
9438fb7321
extmod/modusocket: Support additional args to getaddrinfo.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
iabdalkader
1aac151d68
drivers/ninaw10: Return standard error numbers.
3 years ago
iabdalkader
a63875d5ad
extmod/modusocket: Create new sockets in blocking mode.
To conform with CPython and other MicroPython ports.
3 years ago
iabdalkader
155eb1361e
extmod/modusocket: Add makefile() method and common socket options.
3 years ago
iabdalkader
b23178a9c0
extmod/modusocket: Make setsockopt return if NIC is not connected.
3 years ago
iabdalkader
e401ff8935
drivers/ninaw10: Fix timeout handling to match modusocket.
3 years ago
iabdalkader
9a61bc3aa7
extmod/network_ninaw10: Implement MP_STREAM_POLL in ioctl.
There is currently no function to query if the socket is writable.
3 years ago
Damien George
e7fff736b5
extmod/modbluetooth: Put declaration of connect_cancel in correct place.
This fixes a bug introduced in 851ecb2da1
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
889dee8076
extmod/modbluetooth: Fix conditional compilation of ringbuf_put_uuid.
This fixes a bug introduced in a76604afba
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
iabdalkader
f2ccf87e0b
extmod/network_ninaw10: Use socket timeout preset in modusocket.
3 years ago
iabdalkader
842da93011
extmod/modusocket: Initialise accepted socket state.
3 years ago
iabdalkader
67420de4f4
extmod/modusocket: Allow setting timeout on unbound sockets.
For an extended state socket, if settimeout() is called before a NIC is
bound, save the timeout until the NIC is bound.
3 years ago
Damien George
3243abfda2
extmod/moduplatform: Detect xtensa arch.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
iabdalkader
5a86031223
extmod/network_ninaw10: Make recv/recvfrom interchangeable.
3 years ago
iabdalkader
73a6b53dbe
extmod/network_ninaw10: Return -1 on timeout from recv/send.
3 years ago
iabdalkader
544c232eb7
extmod/network_ninaw10: Make NIC state persistent.
3 years ago
iabdalkader
0f25e0387c
extmod/network_ninaw10: Disable active connections before connecting.
3 years ago
iabdalkader
1b7eee24eb
extmod/network_ninaw10: Fix config of AP mode.
* Fix missing call to connect to configure module in AP mode.
* Use enum for config/connect args indices.
3 years ago
Damien George
efde4b2c75
extmod/modure: Redirect regex debug printing to mp_printf.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Jim Mussared
3770fab334
all: Update Python formatting to latest Black version 21.12b0.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
3 years ago
Jonathan Hogg
851ecb2da1
extmod/modbluetooth: Support gap_connect(None) to cancel a connection.
Allow cancellation of in-progress peripheral connections.
3 years ago
iabdalkader
f7a0c98e00
extmod/network_ninaw10: Fix scan list order to match other NICs.
3 years ago
stijn
5900257dd6
extmod/uplatform: Use generic custom platform string.
Don't force the 'HAL' string to be part of the platform string because
it doesn't have a sensible meaning for all possible platforms, and
swap it with the PLATFORM_ARCH string so the strings which most platforms
have come first.
3 years ago
stijn
1e5875557a
extmod/uplatform: Remove unused definitions.
3 years ago
Damien George
43d08688c3
extmod/uasyncio: Fix gather returning exceptions from a cancelled task.
Fixes issue #5882 .
3 years ago
iabdalkader
43079aaf86
drivers/ninaw10: Add ublox Nina-W10 WiFi/BT module driver.
- Add WiFi/BT drivers for ublox Nina-W10 (esp32 based) module.
- Add ublox Nina-W10 Python module in extmod.
3 years ago
Jim Mussared
9519484c56
extmod/nimble: Remove workaround for OS_ENOMEM.
This was fixed in NimBLE 1.4.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
3 years ago
Jim Mussared
948e3289bf
extmod/nimble: Update to NimBLE v1.4.
We're using the MicroPython fork of NimBLE, which on the
`micropython_1_4_0` branch re-adds support for 64-bit targets and fixes
initialisation of g_msys_pool_list.
Also updates modbluetooth_nimble.c to suit v1.4.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
3 years ago
Jim Mussared
43467b9c71
extmod/modbluetooth: Add connection interval to gap_connect.
This forwards through directly to the NimBLE and BTStack connect functions.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
3 years ago
Andrew Leech
2ceeabf180
extmod/vfs_posix_file: Support MP_STREAM_POLL in vfs_posix_file_ioctl.
Allows asyncio reading of sys.stdin when MICROPY_PY_USELECT is used in the
build configuration.
3 years ago
stijn
d42cba0d22
extmod/moduplatform: Improve implementation for PC ports.
Fix identification of 32/64 bit and of the Windows platform and add a
platform string mimicking CPython for the latter.
3 years ago
iabdalkader
2c5e9bbdfa
extmod: Add platform module.
It contains the compiler version, and underlying system HAL/SDK version.
3 years ago
iabdalkader
38f8e852e0
rp2: Add framework for networking.
MICROPY_PY_NETWORK and MICROPY_PY_USOCKET need to be enabled by a board to
get networking. No NICs have yet been defined.
3 years ago
iabdalkader
8064c3bf9c
extmod/nimble: Add nimble CMake fragment file.
3 years ago
iabdalkader
80f2c794e6
extmod/mpbthci.h: Add mp_bluetooth_hci_uart_any prototype.
This allows drivers to use mpbthciport functions to read/write/poll UART.
3 years ago
iabdalkader
d9749f90ad
extmod/modnetwork: Remove modnetwork socket u_state member.
To simplify the socket state.
The CC3K driver (see drivers/cc3000/inc/socket.h and src/socket.c) has
socket() returning an INT16 so there is now enough room to store it
directly in the fileno member.
3 years ago
iabdalkader
f9d573a4ac
extmod/modnetwork: Remove STM32 references.
3 years ago
Damien George
a34d43b2b7
extmod/network_cyw43: Make consistent use of STA and AP constants.
The network.STA_IF and network.AP_IF constants are now independent to the
CYW43_ITF_STA and CYW43_ITF_AP constants.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
iabdalkader
4dba04a50f
extmod/modnetwork: Define network interfaces in port config files.
So this network implementation becomes more generic.
3 years ago
iabdalkader
c13e25c329
extmod/modusocket: Add read/write stream methods to socket object.
Following other socket implementations.
3 years ago
iabdalkader
e7429389a6
extmod/modnetwork: Add extended socket state.
3 years ago
iabdalkader
d889f672da
extmod/modnetwork: Add STA_IF and AP_IF constants.
3 years ago
iabdalkader
7aab0dc5d8
extmod: Move modnetwork and modusocket from stm32 to extmod.
So they can be used by other ports.
3 years ago
Damien George
af64c2ddbd
extmod/machine_pwm: Factor out machine.PWM bindings to common code.
This commit refactors machine.PWM and creates extmod/machine_pwm.c. The
esp8266, esp32 and rp2 ports all use this and provide implementations of
the required PWM functionality. This helps to reduce code duplication and
keep the same Python API across ports.
This commit does not make any functional changes.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
d41f6dde56
extmod/modonewire: Make _onewire module configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
afe0634c98
extmod/machine_spi: Make SoftSPI configurable via macro option.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
122d901ef1
extmod/machine_i2c: Make SoftI2C configurable via macro option.
The zephyr port doesn't support SoftI2C so it's not enabled, and the legacy
I2C constructor check can be removed.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago
Damien George
30691ed2a1
drivers/cyw43: Make wifi join fail if interface is not active.
Otherwise the Python network object continues to report that it is
attempting to connect.
Also make the return error code consistent with wifi scan.
Signed-off-by: Damien George <damien@micropython.org>
3 years ago