rename bleio module to _bleio

This commit is contained in:
Dan Halbert 2019-08-29 18:44:27 -04:00
parent b11b7916fd
commit 7a64af9280
60 changed files with 217 additions and 214 deletions

View File

@ -34,11 +34,11 @@
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/utils/interrupt_char.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Device.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Device.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#if (MICROPY_PY_BLE_NUS == 1)

View File

@ -37,8 +37,8 @@
#include "py/objstr.h"
#include "py/runtime.h"
#include "supervisor/usb.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Address.h"
#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)
#define BLE_MAX_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)

View File

@ -24,9 +24,9 @@
* THE SOFTWARE.
*/
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/_bleio/Attribute.h"
// Convert a bleio security mode to a ble_gap_conn_sec_mode_t setting.
// Convert a _bleio security mode to a ble_gap_conn_sec_mode_t setting.
void bleio_attribute_gatts_set_security_mode(ble_gap_conn_sec_mode_t *perm, bleio_attribute_security_mode_t security_mode) {
switch (security_mode) {
case SECURITY_MODE_NO_ACCESS:

View File

@ -27,7 +27,7 @@
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_ATTRIBUTE_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_ATTRIBUTE_H
#include "shared-module/bleio/Attribute.h"
#include "shared-module/_bleio/Attribute.h"
extern void bleio_attribute_gatts_set_security_mode(ble_gap_conn_sec_mode_t *perm, bleio_attribute_security_mode_t security_mode);

View File

@ -34,9 +34,9 @@
#include "nrf_soc.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Central.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Central.h"
STATIC void central_on_ble_evt(ble_evt_t *ble_evt, void *central_in) {
bleio_central_obj_t *central = (bleio_central_obj_t*)central_in;

View File

@ -31,7 +31,7 @@
#include <stdbool.h>
#include "py/objlist.h"
#include "shared-module/bleio/Address.h"
#include "shared-module/_bleio/Address.h"
typedef struct {
mp_obj_base_t base;

View File

@ -27,10 +27,10 @@
#include "py/runtime.h"
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Service.h"
static volatile bleio_characteristic_obj_t *m_read_characteristic;

View File

@ -28,10 +28,10 @@
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H
#include "shared-bindings/bleio/Attribute.h"
#include "shared-module/bleio/Characteristic.h"
#include "common-hal/bleio/Service.h"
#include "common-hal/bleio/UUID.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-module/_bleio/Characteristic.h"
#include "common-hal/_bleio/Service.h"
#include "common-hal/_bleio/UUID.h"
typedef struct {
mp_obj_base_t base;

View File

@ -37,8 +37,8 @@
#include "tick.h"
#include "shared-bindings/bleio/__init__.h"
#include "common-hal/bleio/CharacteristicBuffer.h"
#include "shared-bindings/_bleio/__init__.h"
#include "common-hal/_bleio/CharacteristicBuffer.h"
STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) {
// Push all the data onto the ring buffer.

View File

@ -30,7 +30,7 @@
#include "nrf_soc.h"
#include "py/ringbuf.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/_bleio/Characteristic.h"
typedef struct {
mp_obj_base_t base;

View File

@ -28,10 +28,10 @@
#include "py/runtime.h"
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
static volatile bleio_descriptor_obj_t *m_read_descriptor;

View File

@ -31,8 +31,8 @@
#include "py/obj.h"
#include "common-hal/bleio/Characteristic.h"
#include "common-hal/bleio/UUID.h"
#include "common-hal/_bleio/Characteristic.h"
#include "common-hal/_bleio/UUID.h"
typedef struct {
mp_obj_base_t base;

View File

@ -36,13 +36,13 @@
#include "py/objlist.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#define BLE_ADV_LENGTH_FIELD_SIZE 1
#define BLE_ADV_AD_TYPE_FIELD_SIZE 1

View File

@ -35,8 +35,8 @@
#include "py/obj.h"
#include "py/objlist.h"
#include "common-hal/bleio/__init__.h"
#include "shared-module/bleio/Address.h"
#include "common-hal/_bleio/__init__.h"
#include "shared-module/_bleio/Address.h"
typedef enum {
PAIR_NOT_PAIRED,

View File

@ -33,10 +33,10 @@
#include "py/mphal.h"
#include "py/objlist.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/ScanEntry.h"
#include "shared-bindings/bleio/Scanner.h"
#include "shared-module/bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Scanner.h"
#include "shared-module/_bleio/ScanEntry.h"
static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_MIN];

View File

@ -28,12 +28,12 @@
#include "ble_drv.h"
#include "ble.h"
#include "py/runtime.h"
#include "common-hal/bleio/__init__.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/Adapter.h"
#include "common-hal/_bleio/__init__.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/Adapter.h"
void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_peripheral_obj_t *peripheral, bleio_uuid_obj_t *uuid, bool is_secondary) {
self->device = MP_OBJ_FROM_PTR(peripheral);

View File

@ -29,7 +29,7 @@
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SERVICE_H
#include "py/objlist.h"
#include "common-hal/bleio/UUID.h"
#include "common-hal/_bleio/UUID.h"
typedef struct {
mp_obj_base_t base;

View File

@ -29,8 +29,8 @@
#include <string.h>
#include "py/runtime.h"
#include "common-hal/bleio/UUID.h"
#include "shared-bindings/bleio/Adapter.h"
#include "common-hal/_bleio/UUID.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "ble.h"
#include "ble_drv.h"

View File

@ -27,16 +27,16 @@
*/
#include "py/runtime.h"
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Central.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Central.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#include "common-hal/bleio/__init__.h"
#include "common-hal/_bleio/__init__.h"
static volatile bool m_discovery_in_process;
static volatile bool m_discovery_successful;
@ -51,7 +51,7 @@ void bleio_reset() {
}
}
// The singleton bleio.Adapter object, bound to bleio.adapter
// The singleton _bleio.Adapter object, bound to _bleio.adapter
// It currently only has properties and no state
const super_adapter_obj_t common_hal_bleio_adapter_obj = {
.base = {

View File

@ -38,7 +38,7 @@
#include "shared-module/gamepad/__init__.h"
#include "common-hal/microcontroller/Pin.h"
#include "common-hal/bleio/__init__.h"
#include "common-hal/_bleio/__init__.h"
#include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h"
#include "common-hal/busio/UART.h"

View File

@ -122,7 +122,7 @@ ifeq ($(CIRCUITPY_BITBANG_APA102),1)
SRC_PATTERNS += bitbangio/SPI%
endif
ifeq ($(CIRCUITPY_BLEIO),1)
SRC_PATTERNS += bleio/%
SRC_PATTERNS += _bleio/%
endif
ifeq ($(CIRCUITPY_BOARD),1)
SRC_PATTERNS += board/%
@ -223,6 +223,17 @@ endif
# All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL
SRC_COMMON_HAL_ALL = \
_bleio/__init__.c \
_bleio/Adapter.c \
_bleio/Attribute.c \
_bleio/Central.c \
_bleio/Characteristic.c \
_bleio/CharacteristicBuffer.c \
_bleio/Descriptor.c \
_bleio/Peripheral.c \
_bleio/Scanner.c \
_bleio/Service.c \
_bleio/UUID.c \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
@ -233,17 +244,6 @@ SRC_COMMON_HAL_ALL = \
audiopwmio/PWMAudioOut.c \
audioio/__init__.c \
audioio/AudioOut.c \
bleio/__init__.c \
bleio/Adapter.c \
bleio/Attribute.c \
bleio/Central.c \
bleio/Characteristic.c \
bleio/CharacteristicBuffer.c \
bleio/Descriptor.c \
bleio/Peripheral.c \
bleio/Scanner.c \
bleio/Service.c \
bleio/UUID.c \
board/__init__.c \
busio/I2C.c \
busio/SPI.c \
@ -284,9 +284,9 @@ SRC_COMMON_HAL = $(filter $(SRC_PATTERNS), $(SRC_COMMON_HAL_ALL))
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_BINDINGS_ENUMS = \
$(filter $(SRC_PATTERNS), \
bleio/Address.c \
bleio/Attribute.c \
bleio/ScanEntry.c \
_bleio/Address.c \
_bleio/Attribute.c \
_bleio/ScanEntry.c \
digitalio/Direction.c \
digitalio/DriveMode.c \
digitalio/Pull.c \
@ -301,6 +301,9 @@ SRC_BINDINGS_ENUMS += \
util.c
SRC_SHARED_MODULE_ALL = \
_bleio/Address.c \
_bleio/Attribute.c \
_bleio/ScanEntry.c \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
_stage/Layer.c \
@ -317,9 +320,6 @@ SRC_SHARED_MODULE_ALL = \
bitbangio/SPI.c \
bitbangio/__init__.c \
board/__init__.c \
bleio/Address.c \
bleio/Attribute.c \
bleio/ScanEntry.c \
busio/OneWire.c \
displayio/Bitmap.c \
displayio/ColorConverter.c \

View File

@ -259,7 +259,7 @@ extern const struct _mp_obj_module_t bitbangio_module;
#endif
#if CIRCUITPY_BLEIO
#define BLEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_bleio), (mp_obj_t)&bleio_module },
#define BLEIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR__bleio), (mp_obj_t)&bleio_module },
extern const struct _mp_obj_module_t bleio_module;
#else
#define BLEIO_MODULE

View File

@ -99,7 +99,7 @@ CIRCUITPY_BITBANGIO = $(CIRCUITPY_FULL_BUILD)
endif
CFLAGS += -DCIRCUITPY_BITBANGIO=$(CIRCUITPY_BITBANGIO)
# Explicitly enabled for boards that support bleio.
# Explicitly enabled for boards that support _bleio.
ifndef CIRCUITPY_BLEIO
CIRCUITPY_BLEIO = 0
endif

View File

@ -26,10 +26,10 @@
*/
#include "py/objproperty.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-bindings/_bleio/Adapter.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Adapter` --- BLE adapter information
//| ----------------------------------------------------
@ -38,15 +38,15 @@
//|
//| Usage::
//|
//| import bleio
//| bleio.adapter.enabled = True
//| print(bleio.adapter.address)
//| import _bleio
//| _bleio.adapter.enabled = True
//| print(_bleio.adapter.address)
//|
//| .. class:: Adapter()
//|
//| You cannot create an instance of `bleio.Adapter`.
//| Use `bleio.adapter` to access the sole instance available.
//| You cannot create an instance of `_bleio.Adapter`.
//| Use `_bleio.adapter` to access the sole instance available.
//|
//| .. attribute:: adapter.enabled

View File

@ -28,7 +28,7 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADAPTER_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADAPTER_H
#include "shared-module/bleio/Address.h"
#include "shared-module/_bleio/Address.h"
const mp_obj_type_t bleio_adapter_type;

View File

@ -31,10 +31,10 @@
#include "py/objproperty.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-module/bleio/Address.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-module/_bleio/Address.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Address` -- BLE address
//| =========================================================
@ -88,15 +88,15 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
//| Note that the ``bytes`` object returned is in little-endian order:
//| The least significant byte is ``address_bytes[0]``. So the address will
//| appear to be reversed if you print the raw ``bytes`` object. If you print
//| or use `str()` on the :py:class:`~bleio.Attribute` object itself, the address will be printed
//| or use `str()` on the :py:class:`~_bleio.Attribute` object itself, the address will be printed
//| in the expected order. For example:
//|
//| .. code-block:: pycon
//|
//| >>> import bleio
//| >>> bleio.adapter.address
//| >>> import _bleio
//| >>> _bleio.adapter.address
//| <Address c8:1d:f5:ed:a8:35>
//| >>> bleio.adapter.address.address_bytes
//| >>> _bleio.adapter.address.address_bytes
//| b'5\xa8\xed\xf5\x1d\xc8'
//|
STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) {

View File

@ -29,7 +29,7 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESS_H
#include "py/objtype.h"
#include "shared-module/bleio/Address.h"
#include "shared-module/_bleio/Address.h"
#define BLEIO_ADDRESS_TYPE_PUBLIC (0)
#define BLEIO_ADDRESS_TYPE_RANDOM_STATIC (1)

View File

@ -26,24 +26,24 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/UUID.h"
//
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Attribute` -- BLE Attribute
//| =========================================================
//|
//| Definitions associated with all BLE attributes: characteristics, descriptors, etc.
//| :py:class:`~bleio.Attribute` is, notionally, a superclass of
//| :py:class:`~_bleio.Attribute` is, notionally, a superclass of
//| :py:class:`~Characteristic` and :py:class:`~Descriptor`,
//| but is not defined as a Python superclass of those classes.
//|
//| .. class:: Attribute()
//|
//| You cannot create an instance of :py:class:`~bleio.Attribute`.
//| You cannot create an instance of :py:class:`~_bleio.Attribute`.
//|
STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = {

View File

@ -29,8 +29,8 @@
#include "py/obj.h"
#include "common-hal/bleio/Attribute.h"
#include "shared-module/bleio/Attribute.h"
#include "common-hal/_bleio/Attribute.h"
#include "shared-module/_bleio/Attribute.h"
extern const mp_obj_type_t bleio_attribute_type;

View File

@ -34,13 +34,13 @@
#include "py/objproperty.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Central.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Central.h"
#include "shared-bindings/_bleio/Service.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Central` -- A BLE central device
//| =========================================================
@ -49,9 +49,9 @@
//|
//| Usage::
//|
//| import bleio
//| import _bleio
//|
//| scanner = bleio.Scanner()
//| scanner = _bleio.Scanner()
//| entries = scanner.scan(2.5)
//|
//| my_entry = None
@ -63,7 +63,7 @@
//| if not my_entry:
//| raise Exception("'InterestingPeripheral' not found")
//|
//| central = bleio.Central()
//| central = _bleio.Central()
//| central.connect(my_entry.address, 10) # timeout after 10 seconds
//| remote_services = central.discover_remote_services()
//|
@ -86,7 +86,7 @@ STATIC mp_obj_t bleio_central_make_new(const mp_obj_type_t *type, size_t n_args,
//| .. method:: connect(address, timeout, *, service_uuids_whitelist=None)
//| Attempts a connection to the remote peripheral.
//|
//| :param bleio.Address address: The address of the peripheral to connect to
//| :param Address address: The address of the peripheral to connect to
//| :param float/int timeout: Try to connect for timeout seconds.
//|
STATIC mp_obj_t bleio_central_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {

View File

@ -29,8 +29,8 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CENTRAL_H
#include "py/objtuple.h"
#include "common-hal/bleio/Central.h"
#include "common-hal/bleio/Service.h"
#include "common-hal/_bleio/Central.h"
#include "common-hal/_bleio/Service.h"
extern const mp_obj_type_t bleio_central_type;

View File

@ -28,12 +28,12 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Characteristic` -- BLE service characteristic
//| =========================================================

View File

@ -28,11 +28,11 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-module/bleio/Characteristic.h"
#include "common-hal/bleio/Characteristic.h"
#include "common-hal/bleio/Service.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-module/_bleio/Characteristic.h"
#include "common-hal/_bleio/Characteristic.h"
#include "common-hal/_bleio/Service.h"
extern const mp_obj_type_t bleio_characteristic_type;

View File

@ -30,8 +30,8 @@
#include "py/runtime.h"
#include "py/stream.h"
#include "shared-bindings/bleio/CharacteristicBuffer.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
#include "shared-bindings/_bleio/UUID.h"
#include "shared-bindings/util.h"
STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self) {
@ -40,7 +40,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
}
}
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`CharacteristicBuffer` -- BLE Service incoming values buffer.
//| =====================================================================
@ -52,7 +52,7 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
//| Monitor the given Characteristic. Each time a new value is written to the Characteristic
//| add the newly-written bytes to a FIFO buffer.
//|
//| :param bleio.Characteristic characteristic: The Characteristic to monitor.
//| :param Characteristic characteristic: The Characteristic to monitor.
//| It may be a local Characteristic provided by a Peripheral Service, or a remote Characteristic
//| in a remote Service that a Central has connected to.
//| :param int timeout: the timeout in seconds to wait for the first character and between subsequent characters.

View File

@ -27,7 +27,7 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H
#include "common-hal/bleio/CharacteristicBuffer.h"
#include "common-hal/_bleio/CharacteristicBuffer.h"
extern const mp_obj_type_t bleio_characteristic_buffer_type;

View File

@ -28,12 +28,12 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/UUID.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Descriptor` -- BLE descriptor
//| =========================================================

View File

@ -28,10 +28,10 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_DESCRIPTOR_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_DESCRIPTOR_H
#include "shared-module/bleio/Attribute.h"
#include "common-hal/bleio/Characteristic.h"
#include "common-hal/bleio/Descriptor.h"
#include "common-hal/bleio/UUID.h"
#include "shared-module/_bleio/Attribute.h"
#include "common-hal/_bleio/Characteristic.h"
#include "common-hal/_bleio/Descriptor.h"
#include "common-hal/_bleio/UUID.h"
extern const mp_obj_type_t bleio_descriptor_type;

View File

@ -35,14 +35,14 @@
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-module/bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
#include "shared-module/_bleio/ScanEntry.h"
#include "common-hal/bleio/Peripheral.h"
#include "common-hal/_bleio/Peripheral.h"
#define ADV_INTERVAL_MIN (0.0020f)
#define ADV_INTERVAL_MIN_STRING "0.0020"
@ -51,7 +51,7 @@
// 20ms is recommended by Apple
#define ADV_INTERVAL_DEFAULT (0.1f)
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Peripheral` -- A BLE peripheral device
//| =========================================================
@ -61,18 +61,18 @@
//|
//| Usage::
//|
//| from bleio import Characteristic, Peripheral, Service
//| from _bleio import Characteristic, Peripheral, Service
//| from adafruit_ble.advertising import ServerAdvertisement
//|
//| # Create a peripheral and start it up.
//| peripheral = bleio.Peripheral()
//| peripheral = _bleio.Peripheral()
//|
//| # Create a Service and add it to this Peripheral.
//| service = Service.add_to_peripheral(peripheral, bleio.UUID(0x180f))
//| service = Service.add_to_peripheral(peripheral, _bleio.UUID(0x180f))
//|
//| # Create a Characteristic and add it to the Service.
//| characteristic = Characterist.add_to_service(service,
//| bleio.UUID(0x2919), properties=Characteristic.READ | Characteristic.NOTIFY)
//| characteristic = Characteristic.add_to_service(service,
//| _bleio.UUID(0x2919), properties=Characteristic.READ | Characteristic.NOTIFY)
//|
//| adv = ServerAdvertisement(peripheral)
//| peripheral.start_advertising(adv.advertising_data_bytes, scan_response=adv.scan_response_bytes)
@ -86,7 +86,7 @@
//| Create a new Peripheral object.
//|
//| :param str name: The name used when advertising this peripheral. If name is None,
//| bleio.adapter.default_name will be used.
//| _bleio.adapter.default_name will be used.
//|
STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_name };

View File

@ -29,8 +29,8 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_PERIPHERAL_H
#include "py/objtuple.h"
#include "common-hal/bleio/Peripheral.h"
#include "common-hal/bleio/Service.h"
#include "common-hal/_bleio/Peripheral.h"
#include "common-hal/_bleio/Service.h"
extern const mp_obj_type_t bleio_peripheral_type;

View File

@ -29,24 +29,24 @@
#include <string.h>
#include "py/objproperty.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/bleio/ScanEntry.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-module/bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-bindings/_bleio/ScanEntry.h"
#include "shared-bindings/_bleio/UUID.h"
#include "shared-module/_bleio/ScanEntry.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`ScanEntry` -- BLE scan response entry
//| =========================================================
//|
//| Encapsulates information about a device that was received as a
//| response to a BLE scan request. This object may only be created
//| by a `bleio.Scanner`: it has no user-visible constructor.
//| by a `_bleio.Scanner`: it has no user-visible constructor.
//|
//| .. attribute:: address
//|
//| The address of the device (read-only), of type `bleio.Address`.
//| The address of the device (read-only), of type `_bleio.Address`.
//|
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);

View File

@ -30,7 +30,7 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H
#include "py/obj.h"
#include "shared-module/bleio/ScanEntry.h"
#include "shared-module/_bleio/ScanEntry.h"
extern const mp_obj_type_t bleio_scanentry_type;

View File

@ -27,8 +27,8 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/ScanEntry.h"
#include "shared-bindings/bleio/Scanner.h"
#include "shared-bindings/_bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Scanner.h"
#define INTERVAL_DEFAULT (0.1f)
#define INTERVAL_MIN (0.0025f)
@ -37,7 +37,7 @@
#define INTERVAL_MAX_STRING "40.959375"
#define WINDOW_DEFAULT (0.1f)
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Scanner` -- scan for nearby BLE devices
//| =========================================================
@ -46,8 +46,8 @@
//|
//| Usage::
//|
//| import bleio
//| scanner = bleio.Scanner()
//| import _bleio
//| scanner = _bleio.Scanner()
//| entries = scanner.scan(2.5) # Scan for 2.5 seconds
//|

View File

@ -29,7 +29,7 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANNER_H
#include "py/objtype.h"
#include "common-hal/bleio/Scanner.h"
#include "common-hal/_bleio/Scanner.h"
extern const mp_obj_type_t bleio_scanner_type;

View File

@ -28,12 +28,12 @@
#include "py/objproperty.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`Service` -- BLE service
//| =========================================================

View File

@ -28,8 +28,8 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H
#include "common-hal/bleio/Peripheral.h"
#include "common-hal/bleio/Service.h"
#include "common-hal/_bleio/Peripheral.h"
#include "common-hal/_bleio/Service.h"
const mp_obj_type_t bleio_service_type;

View File

@ -31,9 +31,9 @@
#include "py/objproperty.h"
#include "py/objstr.h"
#include "py/runtime.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/UUID.h"
//| .. currentmodule:: bleio
//| .. currentmodule:: _bleio
//|
//| :class:`UUID` -- BLE UUID
//| =========================================================

View File

@ -28,7 +28,7 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_UUID_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_UUID_H
#include "common-hal/bleio/UUID.h"
#include "common-hal/_bleio/UUID.h"
void bleio_uuid_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind);

View File

@ -26,30 +26,33 @@
* THE SOFTWARE.
*/
#include "shared-bindings/bleio/__init__.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/bleio/Central.h"
#include "shared-bindings/bleio/Characteristic.h"
#include "shared-bindings/bleio/CharacteristicBuffer.h"
#include "shared-bindings/bleio/Descriptor.h"
#include "shared-bindings/bleio/Peripheral.h"
#include "shared-bindings/bleio/ScanEntry.h"
#include "shared-bindings/bleio/Scanner.h"
#include "shared-bindings/bleio/Service.h"
#include "shared-bindings/bleio/UUID.h"
#include "shared-bindings/_bleio/__init__.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-bindings/_bleio/Attribute.h"
#include "shared-bindings/_bleio/Central.h"
#include "shared-bindings/_bleio/Characteristic.h"
#include "shared-bindings/_bleio/CharacteristicBuffer.h"
#include "shared-bindings/_bleio/Descriptor.h"
#include "shared-bindings/_bleio/Peripheral.h"
#include "shared-bindings/_bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Scanner.h"
#include "shared-bindings/_bleio/Service.h"
#include "shared-bindings/_bleio/UUID.h"
//| :mod:`bleio` --- Bluetooth Low Energy (BLE) communication
//| :mod:`_bleio` --- Bluetooth Low Energy (BLE) communication
//| ================================================================
//|
//| .. module:: bleio
//| .. module:: _bleio
//| :synopsis: Bluetooth Low Energy functionality
//| :platform: nRF
//|
//| The `bleio` module provides necessary low-level functionality for communicating
//| using Bluetooth Low Energy (BLE). We recommend you use `bleio` in conjunction
//| with the `adafruit_ble <https://circuitpython.readthedocs.io/projects/ble/en/latest/>`_
//| CircuitPython library, which builds on `bleio`, and
//| The `_bleio` module provides necessary low-level functionality for communicating
//| using Bluetooth Low Energy (BLE). The '_' prefix indicates this module is meant
//| for internal use by libraries but not by the end user. Its API may change incompatibly
//| between minor versions of CircuitPython.
//| Please use the
//| `adafruit_ble <https://circuitpython.readthedocs.io/projects/ble/en/latest/>`_
//| CircuitPython library instead, which builds on `_bleio`, and
//| provides higher-level convenience functionality, including predefined beacons, clients,
//| servers.
//|
@ -75,11 +78,11 @@
//|
//| BLE Adapter information, such as enabled state as well as MAC
//| address.
//| This object is the sole instance of `bleio.Adapter`.
//| This object is the sole instance of `_bleio.Adapter`.
//|
STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bleio) },
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__bleio) },
{ MP_ROM_QSTR(MP_QSTR_Address), MP_ROM_PTR(&bleio_address_type) },
{ MP_ROM_QSTR(MP_QSTR_Attribute), MP_ROM_PTR(&bleio_attribute_type) },
{ MP_ROM_QSTR(MP_QSTR_Central), MP_ROM_PTR(&bleio_central_type) },

View File

@ -31,10 +31,10 @@
#include "py/objlist.h"
#include "shared-bindings/bleio/Adapter.h"
#include "shared-bindings/_bleio/Adapter.h"
#include "common-hal/bleio/__init__.h"
#include "common-hal/bleio/Adapter.h"
#include "common-hal/_bleio/__init__.h"
#include "common-hal/_bleio/Adapter.h"
extern const super_adapter_obj_t common_hal_bleio_adapter_obj;

View File

@ -28,8 +28,8 @@
#include <string.h>
#include "py/objstr.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-module/bleio/Address.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-module/_bleio/Address.h"
void common_hal_bleio_address_construct(bleio_address_obj_t *self, uint8_t *bytes, uint8_t address_type) {
self->bytes = mp_obj_new_bytes(bytes, NUM_BLEIO_ADDRESS_BYTES);

View File

@ -27,7 +27,7 @@
#include <string.h>
#include "py/runtime.h"
#include "shared-bindings/bleio/Attribute.h"
#include "shared-bindings/_bleio/Attribute.h"
void common_hal_bleio_attribute_security_mode_check_valid(bleio_attribute_security_mode_t security_mode) {
switch (security_mode) {

View File

@ -28,9 +28,9 @@
#include <string.h>
#include "shared-bindings/bleio/Address.h"
#include "shared-module/bleio/Address.h"
#include "shared-module/bleio/ScanEntry.h"
#include "shared-bindings/_bleio/Address.h"
#include "shared-module/_bleio/Address.h"
#include "shared-module/_bleio/ScanEntry.h"
mp_obj_t common_hal_bleio_scanentry_get_address(bleio_scanentry_obj_t *self) {
return MP_OBJ_FROM_PTR(self->address);

View File

@ -29,7 +29,7 @@
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H
#include "py/obj.h"
#include "shared-bindings/bleio/Address.h"
#include "shared-bindings/_bleio/Address.h"
typedef struct {
mp_obj_base_t base;