aboutsummaryrefslogtreecommitdiff
path: root/extmod
AgeCommit message (Collapse)Author
2019-12-04stm32/mpconfigport.h: Use IRQ_PRI_PENDSV to protect bluetooth ringbuf.Damien George
The default protection for the BLE ringbuf is to use MICROPY_BEGIN_ATOMIC_SECTION, which disables all interrupts. On stm32 it only needs to disable the lowest priority IRQ, pendsv, because that's the IRQ level at which the BLE stack is driven.
2019-12-02extmod/modbluetooth: Remove limit on data coming from gattc data input.Damien George
This removes the limit on data coming in from a BLE.gattc_read() request, or a notify with payload (coming in to a central). In both cases the data coming in to the BLE callback is now limited only by the available data in the ringbuf, whereas before it was capped at (default hard coded) 20 bytes.
2019-12-02extmod/modbluetooth: Simplify how BLE IRQ callback is scheduled.Damien George
Instead of enqueue_irq() inspecting the ringbuf to decide whether to schedule the IRQ callback (if ringbuf is empty), maintain a flag that knows if the callback is on the schedule queue or not. This saves about 150 bytes of code (for stm32 builds), and simplifies all uses of enqueue_irq() and schedule_ringbuf().
2019-11-26extmod/vfs_lfs: Fix bug when passing no args to constructor and mkfs.Damien George
2019-11-26extmod/vfs_lfs: Pass flag along to ioctl when init'ing bdev for lfs.Damien George
To hint to the block device that the extended block protocol will be used.
2019-11-25extmod/modbluetooth: Simplify management of pre-allocated event data.Jim Mussared
The address, adv payload and uuid fields of the event are pre-allocated by modbluetooth, and reused in the IRQ handler. Simplify this and move all storage into the `mp_obj_bluetooth_ble_t` instance. This now allows users to hold on to a reference to these instances without crashes, although they may be overwritten by future events. If they want to hold onto the values longer term they need to copy them.
2019-11-25extmod/modbluetooh_nimble: Fix UUID conversion for 16 and 32 bit values.Jim Mussared
2019-11-25extmod/modbluetooth_nimble: Make gap_scan_stop no-op if no scan ongoing.Jim Mussared
No need for this to throw an exception if the intent (don't be scanning) is clear, and avoids a race with the scan duration timeout.
2019-11-25extmod/modbluetooth: Create UUID from bytes and allow comparison ops.Jim Mussared
This allows construction of UUID objects from advertising data payloads and matching against known UUIDs.
2019-11-21extmod/modbluetooth: Prioritise non-scan-result events.Jim Mussared
Remove existing scan result events from the ringbuf if the ringbuf is full and we're trying to enqueue any other event. This is needed so that events such as SCAN_COMPLETE are always put on the ringbuf.
2019-11-11extmod: Consolidate FAT FS config to MICROPY_VFS_FAT across all ports.Damien George
This commit removes the Makefile-level MICROPY_FATFS config and moves the MICROPY_VFS_FAT config to the Makefile level to replace it. It also moves the include of the oofatfs source files in the build from each port to a central place in extmod/extmod.mk. For a port to enabled VFS FAT support it should now set MICROPY_VFS_FAT=1 at the level of the Makefile. This will include the relevant oofatfs files in the build and set MICROPY_VFS_FAT=1 at the C (preprocessor) level.
2019-11-06extmod/vfs: Add autodetect of littlefs filesystem when mounting.Damien George
2019-11-05all: Convert nlr_raise(mp_obj_new_exception_msg(x)) to mp_raise_msg(x).Damien George
This helper function was added a while ago and these are the remaining cases to convert, to save a bit of code size.
2019-11-01extmod/modbtree: Make FILEVTABLE const to put it in ROM.Damien George
2019-11-01extmod/nimble: Factor out stm32-specific HCI UART RX/TX code.Damien George
2019-11-01extmod/nimble: Remove unneeded nimble_sprintf wrapper function.Damien George
2019-10-31extmod/modussl_mbedtls: Check for invalid key/cert data.Damien George
2019-10-31extmod/modussl_mbedtls: Fix getpeercert to return None if no cert avail.Damien George
2019-10-31extmod/modlwip: Unconditionally return POLLHUP/POLLERR when polling.Damien George
POSIX poll should always return POLLERR and POLLHUP in revents, regardless of whether they were requested in the input events flags. See issues #4290 and #5172.
2019-10-31extmod/modlwip: Make socket poll return POLLNVAL in case of bad file.Damien George
2019-10-31extmod/modlwip: Unconditionally return POLLHUP when polling new socket.Damien George
POSIX poll should always return POLLERR and POLLHUP in revents, regardless of whether they were requested in the input events flags. See issues #4290 and #5172.
2019-10-30extmod/vfs_lfs: Allow compiling in VfsLfs1 and VfsLfs2 separately.Damien George
These classes are enabled via the config options MICROPY_VFS_LFS1 and MICROPY_VFS_LFS2, which are disabled by default.
2019-10-29extmod/modbluetooth: Add gatts_set_buffer.Jim Mussared
- Adds an explicit way to set the size of a value's internal buffer, replacing `ble.gatts_write(handle, bytes(size))` (although that still works). - Add an "append" mode for values, which means that remote writes will append to the buffer.
2019-10-29extmod/vfs: Add MP_BLOCKDEV_IOCTL_BLOCK_ERASE constant.Damien George
2019-10-29extmod/vfs: Rename BP_IOCTL_xxx constants to MP_BLOCKDEV_IOCTL_xxx.Damien George
Also rename SEC_COUNT to BLOCK_COUNT and SEC_SIZE to BLOCK_SIZE.
2019-10-29extmod: Add VFS littlefs bindings.Damien George
Both LFS1 and LFS2 are supported at the same time.
2019-10-29extmod/vfs_blockdev: Add extended read/write methods.Damien George
This commit adds helper functions to call readblocks/writeblocks with a fourth argument, the byte offset within a block. Although the mp_vfs_blockdev_t struct has grown here by 2 machine words, in all current uses of this struct within this repository it still fits within the same number of GC blocks.
2019-10-29extmod/vfs_blockdev: Factor out block device interface code.Damien George
2019-10-29extmod: Factor out block-device struct to make independent of fatfs.Damien George
2019-10-22extmod/modbluetooth: Rename module to "ubluetooth".Jim Mussared
For consistency with "umachine". Now that weak links are enabled by default for built-in modules, this should be a no-op, but allows extension of the bluetooth module by user code. Also move registration of ubluetooth to objmodule rather than port-specific.
2019-10-22extmod/modbluetooth_nimble: Use `data_alloc` length to truncate writes.Jim Mussared
This allows the maximum size of a characteristic/descriptor to be increased by locally writing to it first.
2019-10-22extmod/modbluetooth: Persist reference to NimBLE service instances.Jim Mussared
NimBLE doesn't actually copy this data, it requires it to stay live. Only dereference when we register a new set of services. Fixes #5226 This will allow incrementally adding services in the future, so rename `reset` to `append` to make it clearer.
2019-10-22extmod/modbluetooth: Make UUID support the buffer protocol.Jim Mussared
Internally change the representation of UUIDs to LE uint8* to simplify this. This allows UUIDs to be easily used in BLE payloads (such as advertising). Ref: #5186
2019-10-18extmod/re1.5: Support escaping within RE classes.Jim Mussared
Fixes issues #3178 and #5220. Tests are added, including all the cases mentioned in both bugs.
2019-10-15extmod/modbluetooth: In gap_advertise only accept None to stop adv.Damien George
To match the docs, and interval=0 may be used in the future to indicate something else.
2019-10-15extmod/modbluetooth: Make gap_disconnect not raise when disconnected.Jim Mussared
Previously it raised OSError(MP_ENOTCONN) if the conn_handle was already disconnected. Now it returns True/False.
2019-10-15extmod/modbluetooth: Improve ringbuf handling.Jim Mussared
No need to share the irq_data buffer with addresses. Split them into two separate buffers and manage their max length independently.
2019-10-15extmod/modbluetooth: Fix order of params to IRQ_GATTS_WRITE event.Jim Mussared
2019-10-15extmod/modbluetooth: Clear gap_advertise payload when data is empty.Jim Mussared
Also fix default adv interval to 500ms.
2019-10-15extmod/modbluetooth: Increase maximum connections from 1 to 4.Jim Mussared
This avoids a confusing ENOMEM raised from gap_advertise if there is currently an active connection. This refers to the static connection buffer pre-allocated by Nimble (nothing to do with MicroPython heap memory).
2019-10-11extmod/modbluetooth: Use us instead of ms for advertising interval.Jim Mussared
This is to more accurately match the BLE spec, where intervals are configured in units of channel hop time (625us). When it was specified in ms, not all "valid" intervals were able to be specified. Now that we're also allowing configuration of scan interval, this commit updates advertising to match.
2019-10-11extmod/modbluetooth: Allow config of scan interval/window.Jim Mussared
This adds two additional optional kwargs to `gap_scan()`: - `interval_us`: How long between scans. - `window_us`: How long to scan for during a scan. The default with NimBLE is a 11.25ms window with a 1.28s interval. Changing these parameters is important for detecting low-frequency advertisements (e.g. beacons). Note: these params are in microseconds, not milliseconds in order to allow the 625us granularity offered by the spec.
2019-10-08stm32: Extract port-specific Nimble implementation.Jim Mussared
On other ports (e.g. ESP32) they provide a complete Nimble implementation (i.e. we don't need to use the code in extmod/nimble). This change extracts out the bits that we don't need to use in other ports: - malloc/free/realloc for Nimble memory. - pendsv poll handler - depowering the cywbt Also cleans up the root pointer management.
2019-10-01extmod/modbluetooth: Allow MP_BLUETOOTH_MAX_ATTR_SIZE in board config.Andrew Leech
2019-10-01extmod/modbluetooth_nimble: Use random addr if public isn't available.Andrew Leech
2019-10-01extmod/modbluetooth_nimble: Implement modbluetooth API with Nimble.Jim Mussared
2019-10-01extmod/modbluetooth: Add low-level Python BLE API.Jim Mussared
2019-10-01extmod/nimble: Add nimble bindings.Damien George
2019-09-23extmod/vfs_posix: Include stdio.h for declaration of function 'rename'.Bob Fanger
2019-09-02py/modstruct: Fix struct.pack_into with unaligned offset of native type.Damien George
Following the same fix for unpack.