summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorsommersoft <sommersoft@gmail.com>2019-09-01 21:16:12 -0500
committersommersoft <sommersoft@gmail.com>2019-09-01 21:16:12 -0500
commitb1c3d47413572937460b1c152c3051b71bbf4ffb (patch)
tree4011bf0bf60c7db52c5f687ab8275cbcfe2bc6b3 /py
parentc4d6f4f5367735e0d747c323a76adaf604987529 (diff)
parentb954b2f5df08a2674726fe70023adbe743280426 (diff)
Merge branch 'master' of https://github.com/adafruit/circuitpython into mixer_voice
Diffstat (limited to 'py')
-rw-r--r--py/circuitpy_defns.mk36
-rw-r--r--py/circuitpy_mpconfig.h2
-rw-r--r--py/circuitpy_mpconfig.mk2
-rw-r--r--py/obj.h1
-rw-r--r--py/objstr.c8
5 files changed, 29 insertions, 20 deletions
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index f92e66c74..b72d75390 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -125,7 +125,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/%
@@ -226,6 +226,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 \
@@ -236,17 +247,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 \
@@ -287,9 +287,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 \
@@ -304,6 +304,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 \
@@ -322,9 +325,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 \
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index 1d4acfd42..2cb617819 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -266,7 +266,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
diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk
index 40523d91d..c5756f488 100644
--- a/py/circuitpy_mpconfig.mk
+++ b/py/circuitpy_mpconfig.mk
@@ -104,7 +104,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
diff --git a/py/obj.h b/py/obj.h
index c719c2945..cf4216d02 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -647,6 +647,7 @@ mp_obj_t mp_obj_new_str(const char* data, size_t len);
mp_obj_t mp_obj_new_str_via_qstr(const char* data, size_t len);
mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr);
mp_obj_t mp_obj_new_bytes(const byte* data, size_t len);
+mp_obj_t mp_obj_new_bytes_of_zeros(size_t len);
mp_obj_t mp_obj_new_bytearray(size_t n, void *items);
mp_obj_t mp_obj_new_bytearray_of_zeros(size_t n);
mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items);
diff --git a/py/objstr.c b/py/objstr.c
index afe11f00f..6ef9a15b5 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -2094,6 +2094,14 @@ mp_obj_t mp_obj_new_bytes(const byte* data, size_t len) {
return mp_obj_new_str_copy(&mp_type_bytes, data, len);
}
+mp_obj_t mp_obj_new_bytes_of_zeros(size_t len) {
+ vstr_t vstr;
+ vstr_init_len(&vstr, len);
+ memset(vstr.buf, 0, len);
+ return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
+}
+
+
bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) {
if (MP_OBJ_IS_QSTR(s1) && MP_OBJ_IS_QSTR(s2)) {
return s1 == s2;