From 82d436d05e600ab386f43652f865f59b4361f888 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 26 Jul 2019 00:18:29 -0700 Subject: [PATCH 01/41] Add writeto_then_readfrom to I2C API. Deprecate stop kwarg. writeto_then_readfrom has been added to do a write -> no stop -> repeated start -> read sequence. This is done to match the capabilities of Blinka on Linux. Code that uses stop=False will not work correctly on Blinka. To fix, if stop=False then use writeto_then_readfrom otherwise use writeto then readfrom_into. First step in #2082 --- shared-bindings/bitbangio/I2C.c | 124 +++++++++++++++++++++++--------- shared-bindings/busio/I2C.c | 120 ++++++++++++++++++++++--------- 2 files changed, 177 insertions(+), 67 deletions(-) diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 0a3b03f512..a6276dca0b 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -175,6 +175,23 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); //| :param int start: Index to start writing at //| :param int end: Index to write up to but not include //| +// Shared arg parsing for readfrom_into and writeto_then_readfrom. +STATIC void readfrom(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); + + uint32_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + if (length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + uint8_t status = shared_module_bitbangio_i2c_read(self, address, ((uint8_t*)bufinfo.buf) + start, length); + if (status != 0) { + mp_raise_OSError(status); + } +} + STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -185,33 +202,21 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a }; bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); + check_lock(self); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - check_lock(self); - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); - int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - if (length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - uint8_t status = shared_module_bitbangio_i2c_read(self, - args[ARG_address].u_int, - ((uint8_t*)bufinfo.buf) + start, - length); - if (status != 0) { - mp_raise_OSError(status); - } + readfrom(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, + args[ARG_end].u_int); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_readfrom_into); //| .. method:: writeto(address, buffer, *, start=0, end=None, stop=True) //| -//| Write the bytes from ``buffer`` to the slave specified by ``address``. -//| Transmits a stop bit if ``stop`` is set. +//| Write the bytes from ``buffer`` to the slave specified by ``address`` and then transmits a +//| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start +//| before a read. //| //| If ``start`` or ``end`` is provided, then the buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like @@ -224,9 +229,27 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_rea //| :param bytearray buffer: buffer containing the bytes to write //| :param int start: Index to start writing from //| :param int end: Index to read up to but not include -//| :param bool stop: If true, output an I2C stop condition after the -//| buffer is written +//| :param bool stop: If true, output an I2C stop condition after the buffer is written. +//| Deprecated. Will be removed in 6.x and act as stop=True. //| +// Shared arg parsing for writeto and writeto_then_readfrom. +STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) { + // get the buffer to write the data from + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); + + uint32_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + + // do the transfer + uint8_t status = shared_module_bitbangio_i2c_write(self, address, + ((uint8_t*) bufinfo.buf) + start, length, + stop); + if (status != 0) { + mp_raise_OSError(status); + } +} + STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop }; static const mp_arg_t allowed_args[] = { @@ -242,24 +265,56 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - // get the buffer to write the data from - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - - int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - - // do the transfer - uint8_t status = shared_module_bitbangio_i2c_write(self, args[ARG_address].u_int, - ((uint8_t*) bufinfo.buf) + start, length, args[ARG_stop].u_bool); - if (status != 0) { - mp_raise_OSError(status); - } + writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, + args[ARG_end].u_int, args[ARG_stop].u_bool); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto); + +//| .. method:: writeto_then_readfrom(address, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) +//| +//| Write the bytes from ``out_buffer`` to the slave specified by ``address``, generate no stop +//| bit, generate a repeated start and read into ``in_buffer``. +//| +//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` +//| will so it saves memory. +//| +//| :param int address: 7-bit device address +//| :param bytearray out_buffer: buffer containing the bytes to write +//| :param bytearray in_buffer: buffer to write into +//| :param int out_start: Index to start writing from +//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)`` +//| :param int in_start: Index to start writing at +//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)`` +//| +STATIC mp_obj_t bitbangio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_in_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + check_lock(self); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + writeto(self, args[ARG_address].u_int, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, + args[ARG_out_end].u_int, false); + readfrom(self, args[ARG_address].u_int, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, + args[ARG_in_end].u_int); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_then_readfrom_obj, 3, bitbangio_i2c_writeto_then_readfrom); + STATIC const mp_rom_map_elem_t bitbangio_i2c_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&bitbangio_i2c_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, @@ -271,6 +326,7 @@ STATIC const mp_rom_map_elem_t bitbangio_i2c_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_writeto), MP_ROM_PTR(&bitbangio_i2c_writeto_obj) }, { MP_ROM_QSTR(MP_QSTR_readfrom_into), MP_ROM_PTR(&bitbangio_i2c_readfrom_into_obj) }, + { MP_ROM_QSTR(MP_QSTR_writeto_then_readfrom), MP_ROM_PTR(&bitbangio_i2c_writeto_then_readfrom_obj) }, }; STATIC MP_DEFINE_CONST_DICT(bitbangio_i2c_locals_dict, bitbangio_i2c_locals_dict_table); diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 0e639f0b5b..f3c1503edb 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -189,6 +189,23 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); //| :param int start: Index to start writing at //| :param int end: Index to write up to but not include. Defaults to ``len(buffer)`` //| +// Shared arg parsing for readfrom_into and writeto_then_readfrom. +STATIC void readfrom(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); + + uint32_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + if (length == 0) { + mp_raise_ValueError(translate("Buffer must be at least length 1")); + } + + uint8_t status = common_hal_busio_i2c_read(self, address, ((uint8_t*)bufinfo.buf) + start, length); + if (status != 0) { + mp_raise_OSError(status); + } +} + STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -203,21 +220,8 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); - - int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - if (length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } - - uint8_t status = common_hal_busio_i2c_read(self, args[ARG_address].u_int, ((uint8_t*)bufinfo.buf) + start, length); - if (status != 0) { - mp_raise_OSError(status); - } - + readfrom(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, + args[ARG_end].u_int); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into); @@ -225,7 +229,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in //| .. method:: writeto(address, buffer, *, start=0, end=None, stop=True) //| //| Write the bytes from ``buffer`` to the slave specified by ``address``. -//| Transmits a stop bit if ``stop`` is set. +//| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be +//| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and +//| repeated start before a read. //| //| If ``start`` or ``end`` is provided, then the buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like @@ -238,9 +244,26 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in //| :param bytearray buffer: buffer containing the bytes to write //| :param int start: Index to start writing from //| :param int end: Index to read up to but not include. Defaults to ``len(buffer)`` -//| :param bool stop: If true, output an I2C stop condition after the -//| buffer is written +//| :param bool stop: If true, output an I2C stop condition after the buffer is written. +//| Deprecated. Will be removed in 6.x and act as stop=True. //| +// Shared arg parsing for writeto and writeto_then_readfrom. +STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) { + // get the buffer to write the data from + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); + + uint32_t length = bufinfo.len; + normalize_buffer_bounds(&start, end, &length); + + // do the transfer + uint8_t status = common_hal_busio_i2c_write(self, address, ((uint8_t*) bufinfo.buf) + start, + length, stop); + if (status != 0) { + mp_raise_OSError(status); + } +} + STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop }; static const mp_arg_t allowed_args[] = { @@ -256,25 +279,55 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - // get the buffer to write the data from - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - - - int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - - // do the transfer - uint8_t status = common_hal_busio_i2c_write(self, args[ARG_address].u_int, - ((uint8_t*) bufinfo.buf) + start, length, args[ARG_stop].u_bool); - if (status != 0) { - mp_raise_OSError(status); - } + writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int, + args[ARG_end].u_int, args[ARG_stop].u_bool); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); +//| .. method:: writeto_then_readfrom(address, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) +//| +//| Write the bytes from ``out_buffer`` to the slave specified by ``address``, generate no stop +//| bit, generate a repeated start and read into ``in_buffer``. +//| +//| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced +//| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` +//| will so it saves memory. +//| +//| :param int address: 7-bit device address +//| :param bytearray out_buffer: buffer containing the bytes to write +//| :param bytearray in_buffer: buffer to write into +//| :param int out_start: Index to start writing from +//| :param int out_end: Index to read up to but not include. Defaults to ``len(buffer)`` +//| :param int in_start: Index to start writing at +//| :param int in_end: Index to write up to but not include. Defaults to ``len(buffer)`` +//| +STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_address, ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_out_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_in_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_out_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_out_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + { MP_QSTR_in_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_in_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, + }; + busio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + check_lock(self); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + writeto(self, args[ARG_address].u_int, args[ARG_out_buffer].u_obj, args[ARG_out_start].u_int, + args[ARG_out_end].u_int, false); + readfrom(self, args[ARG_address].u_int, args[ARG_in_buffer].u_obj, args[ARG_in_start].u_int, + args[ARG_in_end].u_int); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_then_readfrom_obj, 3, busio_i2c_writeto_then_readfrom); + STATIC const mp_rom_map_elem_t busio_i2c_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&busio_i2c_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, @@ -286,6 +339,7 @@ STATIC const mp_rom_map_elem_t busio_i2c_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_readfrom_into), MP_ROM_PTR(&busio_i2c_readfrom_into_obj) }, { MP_ROM_QSTR(MP_QSTR_writeto), MP_ROM_PTR(&busio_i2c_writeto_obj) }, + { MP_ROM_QSTR(MP_QSTR_writeto_then_readfrom), MP_ROM_PTR(&busio_i2c_writeto_then_readfrom_obj) }, }; STATIC MP_DEFINE_CONST_DICT(busio_i2c_locals_dict, busio_i2c_locals_dict_table); From 8fa87374650d6b67af4df82442120f7f2bf24238 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 30 Jul 2019 14:23:50 -0700 Subject: [PATCH 02/41] Initial ePaper work --- shared-bindings/displayio/Display.h | 6 +- shared-bindings/displayio/EPaperDisplay.c | 370 ++++++++++++++++++++++ shared-bindings/displayio/EPaperDisplay.h | 70 ++++ 3 files changed, 443 insertions(+), 3 deletions(-) create mode 100644 shared-bindings/displayio/EPaperDisplay.c create mode 100644 shared-bindings/displayio/EPaperDisplay.h diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index e871cfc5c4..8df1adc085 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_DISPLAY_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_DISPLAY_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H #include "common-hal/microcontroller/Pin.h" @@ -74,4 +74,4 @@ uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_DISPLAY_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c new file mode 100644 index 0000000000..d88b4c818f --- /dev/null +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -0,0 +1,370 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/displayio/Display.h" + +#include + +#include "lib/utils/context_manager_helpers.h" +#include "py/binary.h" +#include "py/objproperty.h" +#include "py/objtype.h" +#include "py/runtime.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/translate.h" + +//| .. currentmodule:: displayio +//| +//| :class:`Display` -- Manage updating a display over a display bus +//| ========================================================================== +//| +//| This initializes a display and connects it into CircuitPython. Unlike other +//| objects in CircuitPython, Display objects live until `displayio.release_displays()` +//| is called. This is done so that CircuitPython can use the display itself. +//| +//| Most people should not use this class directly. Use a specific display driver instead that will +//| contain the initialization sequence at minimum. +//| +//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False) +//| +//| Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). +//| +//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a +//| command byte followed by a byte to determine the parameter count and if a delay is need after. +//| When the top bit of the second byte is 1, the next byte will be the delay time in milliseconds. +//| The remaining 7 bits are the parameter count excluding any delay byte. The third through final +//| bytes are the remaining command parameters. The next byte will begin a new command definition. +//| Here is a portion of ILI9341 init code: +//| +//| .. code-block:: python +//| +//| init_sequence = (b"\xe1\x0f\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F" # Set Gamma +//| b"\x11\x80\x78"# Exit Sleep then delay 0x78 (120ms) +//| b"\x29\x80\x78"# Display on then delay 0x78 (120ms) +//| ) +//| display = displayio.Display(display_bus, init_sequence, width=320, height=240) +//| +//| The first command is 0xe1 with 15 (0xf) parameters following. The second and third are 0x11 and +//| 0x29 respectively with delays (0x80) of 120ms (0x78) and no parameters. Multiple byte literals +//| (b"") are merged together on load. The parens are needed to allow byte literals on subsequent +//| lines. +//| +//| The initialization sequence should always leave the display memory access inline with the scan +//| of the display to minimize tearing artifacts. +//| +//| :param display_bus: The bus that the display is connected to +//| :type display_bus: displayio.FourWire or displayio.ParallelBus +//| :param buffer init_sequence: Byte-packed initialization sequence. +//| :param int width: Width in pixels +//| :param int height: Height in pixels +//| :param int colstart: The index if the first visible column +//| :param int rowstart: The index if the first visible row +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| :param int color_depth: The number of bits of color per pixel transmitted. (Some displays +//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.) +//| :param bool grayscale: True if the display only shows a single color. +//| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column. +//| :param int set_column_command: Command used to set the start and end columns to update +//| :param int set_row_command: Command used so set the start and end rows to update +//| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set. +//| :param int set_vertical_scroll: Command used to set the first row to show +//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight +//| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers. +//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True. +//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. +//| :param bool single_byte_bounds: Display column and row commands use single bytes +//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this. +//| +STATIC mp_obj_t displayio_display_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_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_colstart, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_rowstart, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_rotation, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, + { MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} }, + { MP_QSTR_grayscale, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, + { MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} }, + { MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} }, + { MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} }, + { MP_QSTR_set_vertical_scroll, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x0} }, + { MP_QSTR_backlight_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + { MP_QSTR_brightness_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_BRIGHTNESS_COMMAND} }, + { MP_QSTR_brightness, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} }, + { MP_QSTR_auto_brightness, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_single_byte_bounds, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_data_as_commands, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t display_bus = args[ARG_display_bus].u_obj; + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ); + + mp_obj_t backlight_pin_obj = args[ARG_backlight_pin].u_obj; + assert_pin(backlight_pin_obj, true); + const mcu_pin_obj_t* backlight_pin = NULL; + if (backlight_pin_obj != NULL && backlight_pin_obj != mp_const_none) { + backlight_pin = MP_OBJ_TO_PTR(backlight_pin_obj); + assert_pin_free(backlight_pin); + } + + mp_float_t brightness = mp_obj_get_float(args[ARG_brightness].u_obj); + + mp_int_t rotation = args[ARG_rotation].u_int; + if (rotation % 90 != 0) { + mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); + } + + displayio_display_obj_t *self = NULL; + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + if (displays[i].display.base.type == NULL || + displays[i].display.base.type == &mp_type_NoneType) { + self = &displays[i].display; + break; + } + } + if (self == NULL) { + mp_raise_RuntimeError(translate("Too many displays")); + } + self->base.type = &displayio_display_type; + common_hal_displayio_display_construct( + self, + display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, + args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool, args[ARG_pixels_in_byte_share_row].u_bool, + args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int, + args[ARG_write_ram_command].u_int, + args[ARG_set_vertical_scroll].u_int, + bufinfo.buf, bufinfo.len, + MP_OBJ_TO_PTR(backlight_pin), + args[ARG_brightness_command].u_int, + brightness, + args[ARG_auto_brightness].u_bool, + args[ARG_single_byte_bounds].u_bool, + args[ARG_data_as_commands].u_bool + ); + + return self; +} + +// Helper to ensure we have the native super class instead of a subclass. +static displayio_display_obj_t* native_display(mp_obj_t display_obj) { + mp_obj_t native_display = mp_instance_cast_to_native_base(display_obj, &displayio_display_type); + mp_obj_assert_native_inited(native_display); + return MP_OBJ_TO_PTR(native_display); +} + +//| .. method:: show(group) +//| +//| Switches to displaying the given group of layers. When group is None, the default +//| CircuitPython terminal will be shown. +//| +//| :param Group group: The group to show. +STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) { + displayio_display_obj_t *self = native_display(self_in); + displayio_group_t* group = NULL; + if (group_in != mp_const_none) { + group = MP_OBJ_TO_PTR(native_group(group_in)); + } + + common_hal_displayio_display_show(self, group); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); + +//| .. method:: refresh_soon() +//| +//| Queues up a display refresh that happens in the background. +//| +STATIC mp_obj_t displayio_display_obj_refresh_soon(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + common_hal_displayio_display_refresh_soon(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_refresh_soon_obj, displayio_display_obj_refresh_soon); + +//| .. method:: wait_for_frame() +//| +//| Waits until the next frame has been transmitted to the display unless the wait count is +//| behind the rendered frames. In that case, this will return immediately with the wait count. +//| +STATIC mp_obj_t displayio_display_obj_wait_for_frame(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_wait_for_frame(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_wait_for_frame_obj, displayio_display_obj_wait_for_frame); + +//| .. attribute:: brightness +//| +//| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When +//| `auto_brightness` is True, the value of `brightness` will change automatically. +//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False. +//| +STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + mp_float_t brightness = common_hal_displayio_display_get_brightness(self); + if (brightness < 0) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + return mp_obj_new_float(brightness); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_brightness_obj, displayio_display_obj_get_brightness); + +STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) { + displayio_display_obj_t *self = native_display(self_in); + common_hal_displayio_display_set_auto_brightness(self, false); + mp_float_t brightness = mp_obj_get_float(brightness_obj); + if (brightness < 0 || brightness > 1.0) { + mp_raise_ValueError(translate("Brightness must be 0-1.0")); + } + bool ok = common_hal_displayio_display_set_brightness(self, brightness); + if (!ok) { + mp_raise_RuntimeError(translate("Brightness not adjustable")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_brightness_obj, displayio_display_obj_set_brightness); + +const mp_obj_property_t displayio_display_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_brightness_obj, + (mp_obj_t)&displayio_display_set_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: auto_brightness +//| +//| True when the display brightness is adjusted automatically, based on an ambient +//| light sensor or other method. Note that some displays may have this set to True by default, +//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False +//| if `brightness` is set manually. +//| +STATIC mp_obj_t displayio_display_obj_get_auto_brightness(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return mp_obj_new_bool(common_hal_displayio_display_get_auto_brightness(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_brightness_obj, displayio_display_obj_get_auto_brightness); + +STATIC mp_obj_t displayio_display_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { + displayio_display_obj_t *self = native_display(self_in); + + common_hal_displayio_display_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_brightness_obj, displayio_display_obj_set_auto_brightness); + +const mp_obj_property_t displayio_display_auto_brightness_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_auto_brightness_obj, + (mp_obj_t)&displayio_display_set_auto_brightness_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: width +//| +//| Gets the width of the board +//| +//| +STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_width_obj, displayio_display_obj_get_width); + +const mp_obj_property_t displayio_display_width_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_width_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: height +//| +//| Gets the height of the board +//| +//| +STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_height_obj, displayio_display_obj_get_height); + +const mp_obj_property_t displayio_display_height_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_height_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| .. attribute:: bus +//| +//| The bus being used by the display +//| +//| +STATIC mp_obj_t displayio_display_obj_get_bus(mp_obj_t self_in) { + displayio_display_obj_t *self = native_display(self_in); + return self->bus; +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_bus_obj, displayio_display_obj_get_bus); + +const mp_obj_property_t displayio_display_bus_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_bus_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + + +STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_display_refresh_soon_obj) }, + { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_display_wait_for_frame_obj) }, + + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, + + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_display_bus_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table); + +const mp_obj_type_t displayio_display_type = { + { &mp_type_type }, + .name = MP_QSTR_Display, + .make_new = displayio_display_make_new, + .locals_dict = (mp_obj_dict_t*)&displayio_display_locals_dict, +}; diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h new file mode 100644 index 0000000000..6ffabedee6 --- /dev/null +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -0,0 +1,70 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H + +#include "common-hal/microcontroller/Pin.h" + +#include "shared-module/displayio/Display.h" +#include "shared-module/displayio/Group.h" + +extern const mp_obj_type_t displayio_epaperdisplay_type; + +#define DELAY 0x80 + +void common_hal_displayio_display_construct(displayio_display_obj_t* self, + mp_obj_t bus, uint16_t width, uint16_t height, uint16_t seconds_per_frame, + uint16_t rotation, uint16_t color_depth, bool grayscale, + uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* busy_pin, uint16_t partial_command); + +int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self); + +void common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); + +void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self); + +bool displayio_display_begin_transaction(displayio_display_obj_t* self); +void displayio_display_end_transaction(displayio_display_obj_t* self); + +// The second point of the region is exclusive. +void displayio_display_set_region_to_update(displayio_display_obj_t* self, displayio_area_t* area); +bool displayio_display_frame_queued(displayio_display_obj_t* self); + +bool displayio_display_refresh_queued(displayio_display_obj_t* self); +void displayio_display_finish_refresh(displayio_display_obj_t* self); +void displayio_display_send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length); + +bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); +void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); + +uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self); +uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self); + +mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); +bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H From 70680d5b22aa6cb797ccf26645d553a4c72b5100 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 2 Aug 2019 16:17:38 -0700 Subject: [PATCH 03/41] EPaper displays work mostly. --- .../common-hal/displayio/ParallelBus.c | 19 +- py/circuitpy_defns.mk | 1 + shared-bindings/displayio/EPaperDisplay.c | 331 +++++------ shared-bindings/displayio/EPaperDisplay.h | 53 +- shared-bindings/displayio/FourWire.c | 26 +- shared-bindings/displayio/FourWire.h | 5 +- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/I2CDisplay.h | 5 +- shared-bindings/displayio/ParallelBus.c | 4 +- shared-bindings/displayio/ParallelBus.h | 5 +- shared-bindings/displayio/__init__.c | 3 + shared-module/displayio/ColorConverter.c | 90 +++ shared-module/displayio/ColorConverter.h | 3 + shared-module/displayio/Display.c | 30 +- shared-module/displayio/Display.h | 2 +- shared-module/displayio/EPaperDisplay.c | 531 ++++++++++++++++++ shared-module/displayio/EPaperDisplay.h | 92 +++ shared-module/displayio/FourWire.c | 27 +- shared-module/displayio/Group.c | 3 + shared-module/displayio/I2CDisplay.c | 23 +- shared-module/displayio/OnDiskBitmap.c | 49 +- shared-module/displayio/Palette.c | 18 +- shared-module/displayio/Palette.h | 10 +- shared-module/displayio/TileGrid.c | 1 + shared-module/displayio/__init__.c | 89 ++- shared-module/displayio/__init__.h | 6 +- supervisor/shared/display.c | 24 +- tools/gen_display_resources.py | 6 +- 28 files changed, 1123 insertions(+), 335 deletions(-) create mode 100644 shared-module/displayio/EPaperDisplay.c create mode 100644 shared-module/displayio/EPaperDisplay.h diff --git a/ports/atmel-samd/common-hal/displayio/ParallelBus.c b/ports/atmel-samd/common-hal/displayio/ParallelBus.c index c370f7e52a..a43d205113 100644 --- a/ports/atmel-samd/common-hal/displayio/ParallelBus.c +++ b/ports/atmel-samd/common-hal/displayio/ParallelBus.c @@ -84,10 +84,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel common_hal_digitalio_digitalinout_construct(&self->reset, reset); common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); never_reset_pin_number(reset->number); - - common_hal_digitalio_digitalinout_set_value(&self->reset, false); - common_hal_mcu_delay_us(4); - common_hal_digitalio_digitalinout_set_value(&self->reset, true); + common_hal_displayio_parallelbus_reset(self); } never_reset_pin_number(command->number); @@ -111,13 +108,25 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) reset_pin_number(self->reset.pin->number); } +void common_hal_displayio_parallelbus_reset(mp_obj_t obj) { + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + + common_hal_digitalio_digitalinout_set_value(&self->reset, false); + common_hal_mcu_delay_us(4); + common_hal_digitalio_digitalinout_set_value(&self->reset, true); +} + +bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { + return true; +} + bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->chip_select, false); return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, !command); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR.reg; diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 95939de2b7..d0f0cf7dc9 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -320,6 +320,7 @@ SRC_SHARED_MODULE_ALL = \ displayio/Bitmap.c \ displayio/ColorConverter.c \ displayio/Display.c \ + displayio/EPaperDisplay.c \ displayio/FourWire.c \ displayio/Group.c \ displayio/I2CDisplay.c \ diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index d88b4c818f..d13d07e4af 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "shared-bindings/displayio/Display.h" +#include "shared-bindings/displayio/EPaperDisplay.h" #include @@ -41,147 +41,143 @@ //| .. currentmodule:: displayio //| -//| :class:`Display` -- Manage updating a display over a display bus +//| :class:`EPaperDisplay` -- Manage updating an epaper display over a display bus //| ========================================================================== //| -//| This initializes a display and connects it into CircuitPython. Unlike other -//| objects in CircuitPython, Display objects live until `displayio.release_displays()` +//| This initializes an epaper display and connects it into CircuitPython. Unlike other +//| objects in CircuitPython, EPaperDisplay objects live until `displayio.release_displays()` //| is called. This is done so that CircuitPython can use the display itself. //| //| Most people should not use this class directly. Use a specific display driver instead that will -//| contain the initialization sequence at minimum. +//| contain the startup and shutdown sequences at minimum. //| -//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False) +//| .. class:: EPaperDisplay(display_bus, start_sequence, stop_sequence, *, width, height, ram_width, ram_height, colstart=0, rowstart=0, rotation=0, set_column_window_command=None, set_row_window_command=None, single_byte_bounds=False, write_black_ram_command, black_bits_inverted=False, write_color_ram_command=None, color_bits_inverted=False, refresh_display_command, busy_pin=None, busy_state=True, seconds_per_frame=180, always_toggle_chip_select=False) //| -//| Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). +//| Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| -//| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a -//| command byte followed by a byte to determine the parameter count and if a delay is need after. -//| When the top bit of the second byte is 1, the next byte will be the delay time in milliseconds. -//| The remaining 7 bits are the parameter count excluding any delay byte. The third through final -//| bytes are the remaining command parameters. The next byte will begin a new command definition. -//| Here is a portion of ILI9341 init code: -//| -//| .. code-block:: python -//| -//| init_sequence = (b"\xe1\x0f\x00\x0E\x14\x03\x11\x07\x31\xC1\x48\x08\x0F\x0C\x31\x36\x0F" # Set Gamma -//| b"\x11\x80\x78"# Exit Sleep then delay 0x78 (120ms) -//| b"\x29\x80\x78"# Display on then delay 0x78 (120ms) -//| ) -//| display = displayio.Display(display_bus, init_sequence, width=320, height=240) -//| -//| The first command is 0xe1 with 15 (0xf) parameters following. The second and third are 0x11 and -//| 0x29 respectively with delays (0x80) of 120ms (0x78) and no parameters. Multiple byte literals -//| (b"") are merged together on load. The parens are needed to allow byte literals on subsequent -//| lines. -//| -//| The initialization sequence should always leave the display memory access inline with the scan -//| of the display to minimize tearing artifacts. +//| The ``start_sequence`` and ``stop_sequence`` bitpacked to minimize the ram impact. Every +//| command begins with a command byte followed by a byte to determine the parameter count and if +//| a delay is need after. When the top bit of the second byte is 1, the next byte will be the +//| delay time in milliseconds. The remaining 7 bits are the parameter count excluding any delay +//| byte. The third through final bytes are the remaining command parameters. The next byte will +//| begin a new command definition. //| //| :param display_bus: The bus that the display is connected to //| :type display_bus: displayio.FourWire or displayio.ParallelBus -//| :param buffer init_sequence: Byte-packed initialization sequence. +//| :param buffer start_sequence: Byte-packed initialization sequence. +//| :param buffer stop_sequence: Byte-packed initialization sequence. //| :param int width: Width in pixels //| :param int height: Height in pixels +//| :param int ram_width: RAM width in pixels +//| :param int ram_height: RAM height in pixels //| :param int colstart: The index if the first visible column //| :param int rowstart: The index if the first visible row //| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) -//| :param int color_depth: The number of bits of color per pixel transmitted. (Some displays -//| support 18 bit but 16 is easier to transmit. The last bit is extrapolated.) -//| :param bool grayscale: True if the display only shows a single color. -//| :param bool pixels_in_byte_share_row: True when pixels are less than a byte and a byte includes pixels from the same row of the display. When False, pixels share a column. -//| :param int set_column_command: Command used to set the start and end columns to update -//| :param int set_row_command: Command used so set the start and end rows to update -//| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set. -//| :param int set_vertical_scroll: Command used to set the first row to show -//| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight -//| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers. -//| :param bool brightness: Initial display brightness. This value is ignored if auto_brightness is True. -//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. -//| :param bool single_byte_bounds: Display column and row commands use single bytes -//| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this. +//| :param int set_column_window_command: Command used to set the start and end columns to update +//| :param int set_row_window_command: Command used so set the start and end rows to update +//| :param int set_current_column_command: Command used to set the current column location +//| :param int set_current_row_command: Command used to set the current row location +//| :param int write_black_ram_command: Command used to write pixels values into the update region +//| :param bool black_bits_inverted: True if 0 bits are used to show black pixels. Otherwise, 1 means to show black. +//| :param int write_color_ram_command: Command used to write pixels values into the update region +//| :param bool color_bits_inverted: True if 0 bits are used to show the color. Otherwise, 1 means to show color. +//| :param int third_color: Color of third ePaper color in RGB888. +//| :param int refresh_display_command: Command used to start a display refresh +//| :param microcontroller.Pin busy_pin: Pin used to signify the display is busy +//| :param bool busy_state: State of the busy pin when the display is busy +//| :param int seconds_per_frame: Minimum number of seconds between screen refreshes +//| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| -STATIC mp_obj_t displayio_display_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_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands }; +STATIC mp_obj_t displayio_epaperdisplay_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_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_third_color, ARG_refresh_display_command, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_stop_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_ram_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, + { MP_QSTR_ram_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, }, { MP_QSTR_colstart, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_rowstart, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, { MP_QSTR_rotation, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} }, - { MP_QSTR_color_depth, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 16} }, - { MP_QSTR_grayscale, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, - { MP_QSTR_pixels_in_byte_share_row, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, - { MP_QSTR_set_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2a} }, - { MP_QSTR_set_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2b} }, - { MP_QSTR_write_ram_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x2c} }, - { MP_QSTR_set_vertical_scroll, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x0} }, - { MP_QSTR_backlight_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, - { MP_QSTR_brightness_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_BRIGHTNESS_COMMAND} }, - { MP_QSTR_brightness, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} }, - { MP_QSTR_auto_brightness, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, - { MP_QSTR_single_byte_bounds, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, - { MP_QSTR_data_as_commands, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_set_column_window_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_COMMAND} }, + { MP_QSTR_set_row_window_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_COMMAND} }, + { MP_QSTR_set_current_column_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_COMMAND} }, + { MP_QSTR_set_current_row_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_COMMAND} }, + { MP_QSTR_write_black_ram_command, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_black_bits_inverted, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_write_color_ram_command, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + { MP_QSTR_color_bits_inverted, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_third_color, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x000000} }, + { MP_QSTR_refresh_display_command, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_busy_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + { MP_QSTR_busy_state, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, + { MP_QSTR_seconds_per_frame, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(180)} }, + { MP_QSTR_always_toggle_chip_select, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_obj_t display_bus = args[ARG_display_bus].u_obj; - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ); + mp_buffer_info_t start_bufinfo; + mp_get_buffer_raise(args[ARG_start_sequence].u_obj, &start_bufinfo, MP_BUFFER_READ); + mp_buffer_info_t stop_bufinfo; + mp_get_buffer_raise(args[ARG_stop_sequence].u_obj, &stop_bufinfo, MP_BUFFER_READ); - mp_obj_t backlight_pin_obj = args[ARG_backlight_pin].u_obj; - assert_pin(backlight_pin_obj, true); - const mcu_pin_obj_t* backlight_pin = NULL; - if (backlight_pin_obj != NULL && backlight_pin_obj != mp_const_none) { - backlight_pin = MP_OBJ_TO_PTR(backlight_pin_obj); - assert_pin_free(backlight_pin); + + mp_obj_t busy_pin_obj = args[ARG_busy_pin].u_obj; + assert_pin(busy_pin_obj, true); + const mcu_pin_obj_t* busy_pin = NULL; + if (busy_pin_obj != NULL && busy_pin_obj != mp_const_none) { + busy_pin = MP_OBJ_TO_PTR(busy_pin_obj); + assert_pin_free(busy_pin); } - mp_float_t brightness = mp_obj_get_float(args[ARG_brightness].u_obj); - mp_int_t rotation = args[ARG_rotation].u_int; if (rotation % 90 != 0) { mp_raise_ValueError(translate("Display rotation must be in 90 degree increments")); } - displayio_display_obj_t *self = NULL; + displayio_epaperdisplay_obj_t *self = NULL; for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].display.base.type == NULL || displays[i].display.base.type == &mp_type_NoneType) { - self = &displays[i].display; + self = &displays[i].epaper_display; break; } } if (self == NULL) { mp_raise_RuntimeError(translate("Too many displays")); } - self->base.type = &displayio_display_type; - common_hal_displayio_display_construct( + + mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj); + + mp_int_t write_color_ram_command = NO_COMMAND; + mp_int_t third_color = args[ARG_third_color].u_int; + if (args[ARG_write_color_ram_command].u_obj != mp_const_none) { + write_color_ram_command = mp_obj_get_int(args[ARG_write_color_ram_command].u_obj); + } + + self->base.type = &displayio_epaperdisplay_type; + common_hal_displayio_epaperdisplay_construct( self, - display_bus, args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, - args[ARG_color_depth].u_int, args[ARG_grayscale].u_bool, args[ARG_pixels_in_byte_share_row].u_bool, - args[ARG_set_column_command].u_int, args[ARG_set_row_command].u_int, - args[ARG_write_ram_command].u_int, - args[ARG_set_vertical_scroll].u_int, - bufinfo.buf, bufinfo.len, - MP_OBJ_TO_PTR(backlight_pin), - args[ARG_brightness_command].u_int, - brightness, - args[ARG_auto_brightness].u_bool, - args[ARG_single_byte_bounds].u_bool, - args[ARG_data_as_commands].u_bool + display_bus, + start_bufinfo.buf, start_bufinfo.len, stop_bufinfo.buf, stop_bufinfo.len, + args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_ram_width].u_int, args[ARG_ram_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, + args[ARG_set_column_window_command].u_int, args[ARG_set_row_window_command].u_int, + args[ARG_set_current_column_command].u_int, args[ARG_set_current_row_command].u_int, + args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, third_color, args[ARG_refresh_display_command].u_int, + busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, args[ARG_always_toggle_chip_select].u_bool ); return self; } // Helper to ensure we have the native super class instead of a subclass. -static displayio_display_obj_t* native_display(mp_obj_t display_obj) { - mp_obj_t native_display = mp_instance_cast_to_native_base(display_obj, &displayio_display_type); +static displayio_epaperdisplay_obj_t* native_display(mp_obj_t display_obj) { + mp_obj_t native_display = mp_instance_cast_to_native_base(display_obj, &displayio_epaperdisplay_type); mp_obj_assert_native_inited(native_display); return MP_OBJ_TO_PTR(native_display); } @@ -192,139 +188,75 @@ static displayio_display_obj_t* native_display(mp_obj_t display_obj) { //| CircuitPython terminal will be shown. //| //| :param Group group: The group to show. -STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) { - displayio_display_obj_t *self = native_display(self_in); +STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); displayio_group_t* group = NULL; if (group_in != mp_const_none) { group = MP_OBJ_TO_PTR(native_group(group_in)); } - common_hal_displayio_display_show(self, group); + bool ok = common_hal_displayio_epaperdisplay_show(self, group); + if (!ok) { + mp_raise_ValueError(translate("Group already used")); + } return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); +MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); //| .. method:: refresh_soon() //| //| Queues up a display refresh that happens in the background. //| -STATIC mp_obj_t displayio_display_obj_refresh_soon(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - common_hal_displayio_display_refresh_soon(self); +STATIC mp_obj_t displayio_epaperdisplay_obj_refresh_soon(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + common_hal_displayio_epaperdisplay_refresh_soon(self); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_refresh_soon_obj, displayio_display_obj_refresh_soon); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_soon_obj, displayio_epaperdisplay_obj_refresh_soon); //| .. method:: wait_for_frame() //| //| Waits until the next frame has been transmitted to the display unless the wait count is //| behind the rendered frames. In that case, this will return immediately with the wait count. //| -STATIC mp_obj_t displayio_display_obj_wait_for_frame(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_wait_for_frame(self)); +STATIC mp_obj_t displayio_epaperdisplay_obj_wait_for_frame(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_wait_for_frame(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_wait_for_frame_obj, displayio_display_obj_wait_for_frame); - -//| .. attribute:: brightness -//| -//| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When -//| `auto_brightness` is True, the value of `brightness` will change automatically. -//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False. -//| -STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - mp_float_t brightness = common_hal_displayio_display_get_brightness(self); - if (brightness < 0) { - mp_raise_RuntimeError(translate("Brightness not adjustable")); - } - return mp_obj_new_float(brightness); -} -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_brightness_obj, displayio_display_obj_get_brightness); - -STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) { - displayio_display_obj_t *self = native_display(self_in); - common_hal_displayio_display_set_auto_brightness(self, false); - mp_float_t brightness = mp_obj_get_float(brightness_obj); - if (brightness < 0 || brightness > 1.0) { - mp_raise_ValueError(translate("Brightness must be 0-1.0")); - } - bool ok = common_hal_displayio_display_set_brightness(self, brightness); - if (!ok) { - mp_raise_RuntimeError(translate("Brightness not adjustable")); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_brightness_obj, displayio_display_obj_set_brightness); - -const mp_obj_property_t displayio_display_brightness_obj = { - .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_display_get_brightness_obj, - (mp_obj_t)&displayio_display_set_brightness_obj, - (mp_obj_t)&mp_const_none_obj}, -}; - -//| .. attribute:: auto_brightness -//| -//| True when the display brightness is adjusted automatically, based on an ambient -//| light sensor or other method. Note that some displays may have this set to True by default, -//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False -//| if `brightness` is set manually. -//| -STATIC mp_obj_t displayio_display_obj_get_auto_brightness(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - return mp_obj_new_bool(common_hal_displayio_display_get_auto_brightness(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_brightness_obj, displayio_display_obj_get_auto_brightness); - -STATIC mp_obj_t displayio_display_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { - displayio_display_obj_t *self = native_display(self_in); - - common_hal_displayio_display_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_brightness_obj, displayio_display_obj_set_auto_brightness); - -const mp_obj_property_t displayio_display_auto_brightness_obj = { - .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_display_get_auto_brightness_obj, - (mp_obj_t)&displayio_display_set_auto_brightness_obj, - (mp_obj_t)&mp_const_none_obj}, -}; +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_wait_for_frame_obj, displayio_epaperdisplay_obj_wait_for_frame); //| .. attribute:: width //| -//| Gets the width of the board +//| Gets the width of the display in pixels //| //| -STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self)); +STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_width(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_width_obj, displayio_display_obj_get_width); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_width_obj, displayio_epaperdisplay_obj_get_width); -const mp_obj_property_t displayio_display_width_obj = { +const mp_obj_property_t displayio_epaperdisplay_width_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_display_get_width_obj, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_width_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; //| .. attribute:: height //| -//| Gets the height of the board +//| Gets the height of the display in pixels //| //| -STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self)); +STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_get_height(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_height_obj, displayio_display_obj_get_height); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_height_obj, displayio_epaperdisplay_obj_get_height); -const mp_obj_property_t displayio_display_height_obj = { +const mp_obj_property_t displayio_epaperdisplay_height_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_display_get_height_obj, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_height_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; @@ -334,37 +266,34 @@ const mp_obj_property_t displayio_display_height_obj = { //| The bus being used by the display //| //| -STATIC mp_obj_t displayio_display_obj_get_bus(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); +STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); return self->bus; } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_bus_obj, displayio_display_obj_get_bus); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_bus_obj, displayio_epaperdisplay_obj_get_bus); -const mp_obj_property_t displayio_display_bus_obj = { +const mp_obj_property_t displayio_epaperdisplay_bus_obj = { .base.type = &mp_type_property, - .proxy = {(mp_obj_t)&displayio_display_get_bus_obj, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_bus_obj, (mp_obj_t)&mp_const_none_obj, (mp_obj_t)&mp_const_none_obj}, }; -STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) }, - { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_display_refresh_soon_obj) }, - { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_display_wait_for_frame_obj) }, +STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_epaperdisplay_refresh_soon_obj) }, + { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_epaperdisplay_wait_for_frame_obj) }, - { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, - { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, - - { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_width_obj) }, - { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) }, - { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_display_bus_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, }; -STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table); -const mp_obj_type_t displayio_display_type = { +const mp_obj_type_t displayio_epaperdisplay_type = { { &mp_type_type }, - .name = MP_QSTR_Display, - .make_new = displayio_display_make_new, - .locals_dict = (mp_obj_dict_t*)&displayio_display_locals_dict, + .name = MP_QSTR_EPaperDisplay, + .make_new = displayio_epaperdisplay_make_new, + .locals_dict = (mp_obj_dict_t*)&displayio_epaperdisplay_locals_dict, }; diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 6ffabedee6..3deeef9591 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -24,47 +24,52 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H #include "common-hal/microcontroller/Pin.h" -#include "shared-module/displayio/Display.h" +#include "shared-module/displayio/EPaperDisplay.h" #include "shared-module/displayio/Group.h" extern const mp_obj_type_t displayio_epaperdisplay_type; #define DELAY 0x80 -void common_hal_displayio_display_construct(displayio_display_obj_t* self, - mp_obj_t bus, uint16_t width, uint16_t height, uint16_t seconds_per_frame, - uint16_t rotation, uint16_t color_depth, bool grayscale, - uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* busy_pin, uint16_t partial_command); +#define NO_COMMAND 0x100 -int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self); +void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, + mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, + uint16_t set_column_window_command, uint16_t set_row_window_command, + uint16_t set_current_column_command, uint16_t set_current_row_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t third_color, uint16_t refresh_display_command, + const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select); -void common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); +int32_t common_hal_displayio_epaperdisplay_wait_for_frame(displayio_epaperdisplay_obj_t* self); -void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self); +bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self, displayio_group_t* root_group); -bool displayio_display_begin_transaction(displayio_display_obj_t* self); -void displayio_display_end_transaction(displayio_display_obj_t* self); +void common_hal_displayio_epaperdisplay_refresh_soon(displayio_epaperdisplay_obj_t* self); + +bool displayio_epaperdisplay_begin_transaction(displayio_epaperdisplay_obj_t* self); +void displayio_epaperdisplay_end_transaction(displayio_epaperdisplay_obj_t* self); // The second point of the region is exclusive. -void displayio_display_set_region_to_update(displayio_display_obj_t* self, displayio_area_t* area); -bool displayio_display_frame_queued(displayio_display_obj_t* self); +void displayio_epaperdisplay_set_region_to_update(displayio_epaperdisplay_obj_t* self, displayio_area_t* area); +bool displayio_epaperdisplay_frame_queued(displayio_epaperdisplay_obj_t* self); -bool displayio_display_refresh_queued(displayio_display_obj_t* self); -void displayio_display_finish_refresh(displayio_display_obj_t* self); -void displayio_display_send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length); +bool displayio_epaperdisplay_refresh_queued(displayio_epaperdisplay_obj_t* self); +void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self); +void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length); -bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); -void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); +bool common_hal_displayio_epaperdisplay_get_auto_brightness(displayio_epaperdisplay_obj_t* self); +void common_hal_displayio_epaperdisplay_set_auto_brightness(displayio_epaperdisplay_obj_t* self, bool auto_brightness); -uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self); -uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self); +uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); +uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); -mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); -bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); +mp_float_t common_hal_displayio_epaperdisplay_get_brightness(displayio_epaperdisplay_obj_t* self); +bool common_hal_displayio_epaperdisplay_set_brightness(displayio_epaperdisplay_obj_t* self, mp_float_t brightness); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_EPAPERDISPLAY_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 0d41359eea..efd553e2e8 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -103,31 +103,41 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ return self; } -//| .. method:: send(command, data) +//| .. method:: send(command, data, *, toggle_every_byte=False) //| //| Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done. //| -STATIC mp_obj_t displayio_fourwire_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) { - mp_int_t command_int = MP_OBJ_SMALL_INT_VALUE(command_obj); - if (!MP_OBJ_IS_SMALL_INT(command_obj) || command_int > 255 || command_int < 0) { +STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_command, ARG_data, ARG_toggle_every_byte }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_command, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_data, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_toggle_every_byte, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_int_t command_int = args[ARG_command].u_int; + if (command_int > 255 || command_int < 0) { mp_raise_ValueError(translate("Command must be an int between 0 and 255")); } + displayio_fourwire_obj_t *self = pos_args[0]; uint8_t command = command_int; mp_buffer_info_t bufinfo; - mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ); // Wait for display bus to be available. while (!common_hal_displayio_fourwire_begin_transaction(self)) { RUN_BACKGROUND_TASKS; } - common_hal_displayio_fourwire_send(self, true, &command, 1); - common_hal_displayio_fourwire_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); + common_hal_displayio_fourwire_send(self, true, args[ARG_toggle_every_byte].u_bool, &command, 1); + common_hal_displayio_fourwire_send(self, false, args[ARG_toggle_every_byte].u_bool, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_fourwire_end_transaction(self); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_3(displayio_fourwire_send_obj, displayio_fourwire_obj_send); +MP_DEFINE_CONST_FUN_OBJ_KW(displayio_fourwire_send_obj, 3, displayio_fourwire_obj_send); STATIC const mp_rom_map_elem_t displayio_fourwire_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_fourwire_send_obj) }, diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h index 5dbd607649..ee69a63acb 100644 --- a/shared-bindings/displayio/FourWire.h +++ b/shared-bindings/displayio/FourWire.h @@ -40,9 +40,12 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self, void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self); +void common_hal_displayio_fourwire_reset(mp_obj_t self); +bool common_hal_displayio_fourwire_bus_free(mp_obj_t self); + bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self); -void common_hal_displayio_fourwire_send(mp_obj_t self, bool command, uint8_t *data, uint32_t data_length); +void common_hal_displayio_fourwire_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); void common_hal_displayio_fourwire_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 9ef989d711..4428e8dbb4 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -116,7 +116,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob uint8_t full_command[bufinfo.len + 1]; full_command[0] = command; memcpy(full_command + 1, ((uint8_t*) bufinfo.buf), bufinfo.len); - common_hal_displayio_i2cdisplay_send(self, true, full_command, bufinfo.len + 1); + common_hal_displayio_i2cdisplay_send(self, true, false, full_command, bufinfo.len + 1); common_hal_displayio_i2cdisplay_end_transaction(self); return mp_const_none; diff --git a/shared-bindings/displayio/I2CDisplay.h b/shared-bindings/displayio/I2CDisplay.h index cc41628000..6a75fc488d 100644 --- a/shared-bindings/displayio/I2CDisplay.h +++ b/shared-bindings/displayio/I2CDisplay.h @@ -37,9 +37,12 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self, void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self); +void common_hal_displayio_i2cdisplay_reset(mp_obj_t self); +bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self); + bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self); -void common_hal_displayio_i2cdisplay_send(mp_obj_t self, bool command, uint8_t *data, uint32_t data_length); +void common_hal_displayio_i2cdisplay_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index c29c79fffc..e260f9b7eb 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -124,8 +124,8 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o while (!common_hal_displayio_parallelbus_begin_transaction(self)) { RUN_BACKGROUND_TASKS; } - common_hal_displayio_parallelbus_send(self, true, &command, 1); - common_hal_displayio_parallelbus_send(self, false, ((uint8_t*) bufinfo.buf), bufinfo.len); + common_hal_displayio_parallelbus_send(self, true, false, &command, 1); + common_hal_displayio_parallelbus_send(self, false, false, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_parallelbus_end_transaction(self); return mp_const_none; diff --git a/shared-bindings/displayio/ParallelBus.h b/shared-bindings/displayio/ParallelBus.h index c4cde5ff53..b8da910411 100644 --- a/shared-bindings/displayio/ParallelBus.h +++ b/shared-bindings/displayio/ParallelBus.h @@ -40,9 +40,12 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self); +void common_hal_displayio_parallelbus_reset(mp_obj_t self); +bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self); + bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self); -void common_hal_displayio_parallelbus_send(mp_obj_t self, bool command, uint8_t *data, uint32_t data_length); +void common_hal_displayio_parallelbus_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); void common_hal_displayio_parallelbus_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index fd3dc42333..8c5d1f2284 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -33,6 +33,7 @@ #include "shared-bindings/displayio/Bitmap.h" #include "shared-bindings/displayio/ColorConverter.h" #include "shared-bindings/displayio/Display.h" +#include "shared-bindings/displayio/EPaperDisplay.h" #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/I2CDisplay.h" @@ -60,6 +61,7 @@ //| Bitmap //| ColorConverter //| Display +//| EPaperDisplay //| FourWire //| Group //| I2CDisplay @@ -91,6 +93,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) }, { MP_ROM_QSTR(MP_QSTR_ColorConverter), MP_ROM_PTR(&displayio_colorconverter_type) }, { MP_ROM_QSTR(MP_QSTR_Display), MP_ROM_PTR(&displayio_display_type) }, + { MP_ROM_QSTR(MP_QSTR_EPaperDisplay), MP_ROM_PTR(&displayio_epaperdisplay_type) }, { MP_ROM_QSTR(MP_QSTR_Group), MP_ROM_PTR(&displayio_group_type) }, { MP_ROM_QSTR(MP_QSTR_OnDiskBitmap), MP_ROM_PTR(&displayio_ondiskbitmap_type) }, { MP_ROM_QSTR(MP_QSTR_Palette), MP_ROM_PTR(&displayio_palette_type) }, diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 6b9bd5840b..0277c79f0f 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -45,14 +45,104 @@ uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) { return (r8 * 19) / 255 + (g8 * 182) / 255 + (b8 + 54) / 255; } +void compute_bounds(uint8_t r8, uint8_t g8, uint8_t b8, uint8_t* min, uint8_t* max) { + if (r8 > g8) { + if (b8 > r8) { + *max = b8; + } else { + *max = r8; + } + if (b8 < g8) { + *min = b8; + } else { + *min = g8; + } + } else { + if (b8 > g8) { + *max = b8; + } else { + *max = g8; + } + if (b8 < r8) { + *min = b8; + } else { + *min = r8; + } + } +} + +uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888) { + uint32_t r8 = (color_rgb888 >> 16); + uint32_t g8 = (color_rgb888 >> 8) & 0xff; + uint32_t b8 = color_rgb888 & 0xff; + uint8_t max; + uint8_t min; + compute_bounds(r8, g8, b8, &min, &max); + return max - min; +} + +uint8_t displayio_colorconverter_compute_hue(uint32_t color_rgb888) { + uint32_t r8 = (color_rgb888 >> 16); + uint32_t g8 = (color_rgb888 >> 8) & 0xff; + uint32_t b8 = color_rgb888 & 0xff; + uint8_t max; + uint8_t min; + compute_bounds(r8, g8, b8, &min, &max); + uint8_t c = max - min; + if (c == 0) { + return 0; + } + + int32_t hue = 0; + if (max == r8) { + hue = (((int32_t) (g8 - b8) * 40) / c) % 240; + } else if (max == g8) { + hue = (((int32_t) (b8 - r8) + (2 * c)) * 40) / c; + } else if (max == b8) { + hue = (((int32_t) (r8 - g8) + (4 * c)) * 40) / c; + } + if (hue < 0) { + hue += 240; + } + + return hue; +} + +void displayio_colorconverter_compute_tricolor(const _displayio_colorspace_t* colorspace, uint8_t pixel_hue, uint8_t pixel_luma, uint32_t* color) { + + int16_t hue_diff = colorspace->tricolor_hue - pixel_hue; + if ((-10 <= hue_diff && hue_diff <= 10) || hue_diff <= -220 || hue_diff >= 220) { + if (colorspace->grayscale) { + *color = 0; + } else { + *color = 1; + } + } else if (!colorspace->grayscale) { + *color = 0; + } +} + bool displayio_colorconverter_convert(displayio_colorconverter_t *self, const _displayio_colorspace_t* colorspace, uint32_t input_color, uint32_t* output_color) { if (colorspace->depth == 16) { *output_color = displayio_colorconverter_compute_rgb565(input_color); return true; + } else if (colorspace->tricolor) { + uint8_t luma = displayio_colorconverter_compute_luma(input_color); + *output_color = luma >> (8 - colorspace->depth); + if (displayio_colorconverter_compute_chroma(input_color) <= 16) { + if (!colorspace->grayscale) { + *output_color = 0; + } + return true; + } + uint8_t pixel_hue = displayio_colorconverter_compute_hue(input_color); + displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, output_color); + return true; } else if (colorspace->grayscale && colorspace->depth <= 8) { uint8_t luma = displayio_colorconverter_compute_luma(input_color); *output_color = luma >> (8 - colorspace->depth); return true; + } else if (!colorspace->grayscale && colorspace->depth == 1) { } return false; } diff --git a/shared-module/displayio/ColorConverter.h b/shared-module/displayio/ColorConverter.h index c48b98e6dc..c79e6a2f7e 100644 --- a/shared-module/displayio/ColorConverter.h +++ b/shared-module/displayio/ColorConverter.h @@ -42,5 +42,8 @@ void displayio_colorconverter_finish_refresh(displayio_colorconverter_t *self); bool displayio_colorconverter_convert(displayio_colorconverter_t *self, const _displayio_colorspace_t* colorspace, uint32_t input_color, uint32_t* output_color); uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888); uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888); +uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888); +uint8_t displayio_colorconverter_compute_hue(uint32_t color_rgb888); +void displayio_colorconverter_compute_tricolor(const _displayio_colorspace_t* colorspace, uint8_t pixel_hue, uint8_t pixel_luma, uint32_t* color); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_COLORCONVERTER_H diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index d11813b8c5..97a18740a3 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -40,8 +40,6 @@ #include "tick.h" -#define DELAY 0x80 - void common_hal_displayio_display_construct(displayio_display_obj_t* self, mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, @@ -97,10 +95,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, uint8_t full_command[data_size + 1]; full_command[0] = cmd[0]; memcpy(full_command + 1, data, data_size); - self->send(self->bus, true, full_command, data_size + 1); + self->send(self->bus, true, true, full_command, data_size + 1); } else { - self->send(self->bus, true, cmd, 1); - self->send(self->bus, false, data, data_size); + self->send(self->bus, true, true, cmd, 1); + self->send(self->bus, false, false, data, data_size); } uint16_t delay_length_ms = 10; if (delay) { @@ -232,6 +230,9 @@ const displayio_area_t* displayio_display_get_refresh_areas(displayio_display_ob self->area.next = NULL; return &self->area; } else { + if (self->current_group == NULL || self->current_group->base.type != &displayio_group_type) { + asm("bkpt"); + } return displayio_group_get_refresh_areas(self->current_group, NULL); } } @@ -283,12 +284,12 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, if (ok) { if (self->data_as_commands) { uint8_t set_brightness[2] = {self->brightness_command, (uint8_t) (0xff * brightness)}; - self->send(self->bus, true, set_brightness, 2); + self->send(self->bus, true, true, set_brightness, 2); } else { uint8_t command = self->brightness_command; uint8_t hex_brightness = 0xff * brightness; - self->send(self->bus, true, &command, 1); - self->send(self->bus, false, &hex_brightness, 1); + self->send(self->bus, true, true, &command, 1); + self->send(self->bus, false, false, &hex_brightness, 1); } self->end_transaction(self->bus); } @@ -331,7 +332,7 @@ void displayio_display_set_region_to_update(displayio_display_obj_t* self, displ data[0] = self->set_column_command; uint8_t data_length = 1; if (!self->data_as_commands) { - self->send(self->bus, true, data, 1); + self->send(self->bus, true, true, data, 1); data_length = 0; } if (self->single_byte_bounds) { @@ -345,13 +346,13 @@ void displayio_display_set_region_to_update(displayio_display_obj_t* self, displ data[data_length++] = x2 >> 8; data[data_length++] = x2 & 0xff; } - self->send(self->bus, self->data_as_commands, data, data_length); + self->send(self->bus, self->data_as_commands, self->data_as_commands, data, data_length); // Set row. data[0] = self->set_row_command; data_length = 1; if (!self->data_as_commands) { - self->send(self->bus, true, data, 1); + self->send(self->bus, true, true, data, 1); data_length = 0; } if (self->single_byte_bounds) { @@ -365,7 +366,7 @@ void displayio_display_set_region_to_update(displayio_display_obj_t* self, displ data[data_length++] = y2 >> 8; data[data_length++] = y2 & 0xff; } - self->send(self->bus, self->data_as_commands, data, data_length); + self->send(self->bus, self->data_as_commands, self->data_as_commands, data, data_length); } void displayio_display_start_refresh(displayio_display_obj_t* self) { @@ -391,9 +392,9 @@ void displayio_display_finish_refresh(displayio_display_obj_t* self) { void displayio_display_send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length) { if (!self->data_as_commands) { - self->send(self->bus, true, &self->write_ram_command, 1); + self->send(self->bus, true, true, &self->write_ram_command, 1); } - self->send(self->bus, false, pixels, length); + self->send(self->bus, false, false, pixels, length); } void displayio_display_update_backlight(displayio_display_obj_t* self) { @@ -414,7 +415,6 @@ void release_display(displayio_display_obj_t* self) { if (self->current_group != NULL) { self->current_group->in_group = false; } - if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm); common_hal_pulseio_pwmout_deinit(&self->backlight_pwm); diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index 74ae175b1e..c85d69b0e2 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -34,7 +34,7 @@ #include "shared-module/displayio/area.h" typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, bool command, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); typedef void (*display_bus_end_transaction)(mp_obj_t bus); typedef struct { diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c new file mode 100644 index 0000000000..5e4bdc340d --- /dev/null +++ b/shared-module/displayio/EPaperDisplay.c @@ -0,0 +1,531 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/displayio/EPaperDisplay.h" + +#include "py/runtime.h" +#include "shared-bindings/displayio/ColorConverter.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/displayio/I2CDisplay.h" +#include "shared-bindings/displayio/ParallelBus.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/display.h" +#include "supervisor/usb.h" + +#include +#include + +#include "tick.h" + +void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self, + mp_obj_t bus, uint8_t* start_sequence, uint16_t start_sequence_len, uint8_t* stop_sequence, uint16_t stop_sequence_len, + uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, + int16_t colstart, int16_t rowstart, uint16_t rotation, + uint16_t set_column_window_command, uint16_t set_row_window_command, + uint16_t set_current_column_command, uint16_t set_current_row_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t third_color, uint16_t refresh_display_command, + const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select) { + self->colorspace.depth = 1; + self->colorspace.grayscale = true; + self->colorspace.pixels_in_byte_share_row = true; + self->colorspace.bytes_per_cell = 1; + self->colorspace.reverse_pixels_in_byte = true; + + if (third_color != 0x000000) { + self->colorspace.tricolor = true; + self->colorspace.tricolor_hue = displayio_colorconverter_compute_hue(third_color); + self->colorspace.tricolor_luma = displayio_colorconverter_compute_luma(third_color); + } + + self->set_column_window_command = set_column_window_command; + self->set_row_window_command = set_row_window_command; + self->set_current_column_command = set_current_column_command; + self->set_current_row_command = set_current_row_command; + self->write_black_ram_command = write_black_ram_command; + self->black_bits_inverted = black_bits_inverted; + self->write_color_ram_command = write_color_ram_command; + self->color_bits_inverted = color_bits_inverted; + self->refresh_display_command = refresh_display_command; + self->busy_state = busy_state; + self->refresh = true; + self->current_group = NULL; + self->colstart = colstart; + self->rowstart = rowstart; + self->refreshing = false; + self->milliseconds_per_frame = seconds_per_frame * 1000; + self->always_toggle_chip_select = always_toggle_chip_select; + + self->start_sequence = start_sequence; + self->start_sequence_len = start_sequence_len; + self->stop_sequence = stop_sequence; + self->stop_sequence_len = stop_sequence_len; + + + if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { + self->bus_reset = common_hal_displayio_parallelbus_reset; + self->bus_free = common_hal_displayio_parallelbus_bus_free; + self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; + self->send = common_hal_displayio_parallelbus_send; + self->end_transaction = common_hal_displayio_parallelbus_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { + self->bus_reset = common_hal_displayio_fourwire_reset; + self->bus_free = common_hal_displayio_fourwire_bus_free; + self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; + self->send = common_hal_displayio_fourwire_send; + self->end_transaction = common_hal_displayio_fourwire_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { + self->bus_reset = common_hal_displayio_i2cdisplay_reset; + self->bus_free = common_hal_displayio_i2cdisplay_bus_free; + self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; + self->send = common_hal_displayio_i2cdisplay_send; + self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; + } else { + mp_raise_ValueError(translate("Unsupported display bus type")); + } + self->bus = bus; + + supervisor_start_terminal(width, height); + + self->width = width; + self->height = height; + rotation = rotation % 360; + self->transform.x = 0; + self->transform.y = 0; + self->transform.scale = 1; + self->transform.mirror_x = false; + self->transform.mirror_y = false; + self->transform.transpose_xy = false; + if (rotation == 0 || rotation == 180) { + if (rotation == 180) { + self->transform.mirror_x = true; + self->transform.mirror_y = true; + } + } else { + self->transform.transpose_xy = true; + if (rotation == 270) { + self->transform.mirror_y = true; + } else { + self->transform.mirror_x = true; + } + } + + self->ram_width = ram_width; + self->ram_height = ram_height; + + self->area.x1 = 0; + self->area.y1 = 0; + self->area.next = NULL; + + self->transform.dx = 1; + self->transform.dy = 1; + if (self->transform.transpose_xy) { + self->area.x2 = height; + self->area.y2 = width; + if (self->transform.mirror_x) { + self->transform.x = height; + self->transform.dx = -1; + } + if (self->transform.mirror_y) { + self->transform.y = width; + self->transform.dy = -1; + } + } else { + self->area.x2 = width; + self->area.y2 = height; + if (self->transform.mirror_x) { + self->transform.x = width; + self->transform.dx = -1; + } + if (self->transform.mirror_y) { + self->transform.y = height; + self->transform.dy = -1; + } + } + + self->busy.base.type = &mp_type_NoneType; + if (busy_pin != NULL) { + self->busy.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->busy, busy_pin); + never_reset_pin_number(busy_pin->number); + } + + // Set the group after initialization otherwise we may send pixels while we delay in + // initialization. + common_hal_displayio_epaperdisplay_show(self, &circuitpython_splash); +} + +bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self, displayio_group_t* root_group) { + if (root_group == NULL && !circuitpython_splash.in_group) { + root_group = &circuitpython_splash; + } + if (root_group == self->current_group) { + return true; + } + if (root_group != NULL && root_group->in_group) { + return false; + } + if (self->current_group != NULL) { + self->current_group->in_group = false; + } + if (root_group != NULL) { + displayio_group_update_transform(root_group, &self->transform); + root_group->in_group = true; + self->current_group = root_group; + } + self->full_refresh = true; + common_hal_displayio_epaperdisplay_refresh_soon(self); + return true; +} + +void common_hal_displayio_epaperdisplay_refresh_soon(displayio_epaperdisplay_obj_t* self) { + self->refresh = true; +} + +const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { + const displayio_area_t* first_area; + if (self->current_group == NULL || self->current_group->base.type != &displayio_group_type) { + asm("bkpt"); + } + if (self->full_refresh) { + first_area = &self->area; + } else { + first_area = displayio_group_get_refresh_areas(self->current_group, NULL); + } + if (first_area != NULL && self->set_row_window_command == NO_COMMAND) { + self->area.next = NULL; + return &self->area; + } + return first_area; +} + +int32_t common_hal_displayio_epaperdisplay_wait_for_frame(displayio_epaperdisplay_obj_t* self) { + uint64_t last_refresh = self->last_refresh; + // Don't try to refresh if we got an exception. + while (last_refresh == self->last_refresh && MP_STATE_VM(mp_pending_exception) == NULL) { + MICROPY_VM_HOOK_LOOP + } + return 0; +} + +uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self){ + return self->width; +} + +uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self){ + return self->height; +} + +bool displayio_epaperdisplay_bus_free(displayio_epaperdisplay_obj_t *self) { + return self->bus_free(self->bus); +} + +bool displayio_epaperdisplay_begin_transaction(displayio_epaperdisplay_obj_t* self) { + return self->begin_transaction(self->bus); +} + +void displayio_epaperdisplay_end_transaction(displayio_epaperdisplay_obj_t* self) { + self->end_transaction(self->bus); +} + +STATIC void wait_for_busy(displayio_epaperdisplay_obj_t* self) { + if (self->busy.base.type == &mp_type_NoneType) { + return; + } + while (common_hal_digitalio_digitalinout_get_value(&self->busy) == self->busy_state) { + #ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP + #endif + } +} + +STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool should_wait_for_busy, uint8_t* sequence, uint32_t sequence_len) { + uint32_t i = 0; + while (i < sequence_len) { + uint8_t *cmd = sequence + i; + uint8_t data_size = *(cmd + 1); + bool delay = (data_size & DELAY) != 0; + data_size &= ~DELAY; + uint8_t *data = cmd + 2; + self->begin_transaction(self->bus); + self->send(self->bus, true, self->always_toggle_chip_select, cmd, 1); + self->send(self->bus, false, self->always_toggle_chip_select, data, data_size); + self->end_transaction(self->bus); + uint16_t delay_length_ms = 0; + if (delay) { + data_size++; + delay_length_ms = *(cmd + 1 + data_size); + if (delay_length_ms == 255) { + delay_length_ms = 500; + } + } + common_hal_time_delay_ms(delay_length_ms); + if (should_wait_for_busy) { + wait_for_busy(self); + } + i += 2 + data_size; + } +} + +void displayio_epaperdisplay_set_region_to_update(displayio_epaperdisplay_obj_t* self, displayio_area_t* area) { + if (self->set_row_window_command == NO_COMMAND) { + return; + } + uint16_t x1 = area->x1; + uint16_t x2 = area->x2; + uint16_t y1 = area->y1; + uint16_t y2 = area->y2; + // Collapse down the dimension where multiple pixels are in a byte. + uint8_t pixels_per_byte = 8 / self->colorspace.depth; + x1 /= pixels_per_byte * self->colorspace.bytes_per_cell; + x2 /= pixels_per_byte * self->colorspace.bytes_per_cell; + + + // Set column. + uint8_t data[5]; + data[0] = self->set_column_window_command; + self->send(self->bus, true, self->always_toggle_chip_select, data, 1); + uint8_t data_length = 0; + if (self->ram_width / pixels_per_byte < 0x100) { + data[data_length++] = x1 + self->colstart; + data[data_length++] = x2 - 1 + self->colstart; + } else { + x1 += self->colstart; + x2 += self->colstart - 1; + data[data_length++] = x1 >> 8; + data[data_length++] = x1 & 0xff; + data[data_length++] = x2 >> 8; + data[data_length++] = x2 & 0xff; + } + self->send(self->bus, false, self->always_toggle_chip_select, data, data_length); + if (self->set_current_column_command != NO_COMMAND) { + uint8_t command = self->set_current_column_command; + self->send(self->bus, true, self->always_toggle_chip_select, &command, 1); + self->send(self->bus, false, self->always_toggle_chip_select, data, data_length / 2); + } + + // Set row. + data[0] = self->set_row_window_command; + self->send(self->bus, true, self->always_toggle_chip_select, data, 1); + data_length = 0; + if (self->ram_height < 0x100) { + data[data_length++] = y1 + self->rowstart; + data[data_length++] = y2 - 1 + self->rowstart; + } else { + y1 += self->rowstart; + y2 += self->rowstart - 1; + data[data_length++] = y1 & 0xff; + data[data_length++] = y1 >> 8; + data[data_length++] = y2 & 0xff; + data[data_length++] = y2 >> 8; + } + self->send(self->bus, false, self->always_toggle_chip_select, data, data_length); + if (self->set_current_row_command != NO_COMMAND) { + uint8_t command = self->set_current_row_command; + self->send(self->bus, true, self->always_toggle_chip_select, &command, 1); + self->send(self->bus, false, self->always_toggle_chip_select, data, data_length / 2); + } +} + +void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self) { + // run start sequence + self->bus_reset(self->bus); + + send_command_sequence(self, true, self->start_sequence, self->start_sequence_len); + self->last_refresh = ticks_ms; +} + +bool displayio_epaperdisplay_frame_queued(displayio_epaperdisplay_obj_t* self) { + if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { + if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { + self->refreshing = false; + // Run stop sequence but don't wait for busy because busy is set when sleeping. + send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); + } else { + return false; + } + } + if (self->current_group == NULL) { + return false; + } + // Refresh at seconds per frame rate. + return (ticks_ms - self->last_refresh) > self->milliseconds_per_frame; +} + +void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) { + // Actually refresh the display now that all pixel RAM has been updated. + displayio_epaperdisplay_begin_transaction(self); + self->send(self->bus, true, self->always_toggle_chip_select, &self->refresh_display_command, 1); + displayio_epaperdisplay_end_transaction(self); + self->refreshing = true; + + if (self->current_group != NULL) { + displayio_group_finish_refresh(self->current_group); + } + self->refresh = false; + self->full_refresh = false; + self->last_refresh = ticks_ms; +} + +void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length) { +} + + +bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { + uint16_t buffer_size = 128; // In uint32_ts + + displayio_area_t clipped; + // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. + if (!displayio_epaperdisplay_clip_area(self, area, &clipped)) { + return true; + } + uint16_t subrectangles = 1; + uint16_t rows_per_buffer = displayio_area_height(&clipped); + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->colorspace.depth; + uint16_t pixels_per_buffer = displayio_area_size(&clipped); + if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { + rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); + if (rows_per_buffer == 0) { + rows_per_buffer = 1; + } + subrectangles = displayio_area_height(&clipped) / rows_per_buffer; + if (displayio_area_height(&clipped) % rows_per_buffer != 0) { + subrectangles++; + } + pixels_per_buffer = rows_per_buffer * displayio_area_width(&clipped); + buffer_size = pixels_per_buffer / pixels_per_word; + if (pixels_per_buffer % pixels_per_word) { + buffer_size += 1; + } + } + + // Allocated and shared as a uint32_t array so the compiler knows the + // alignment everywhere. + uint32_t buffer[buffer_size]; + volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1; + uint32_t mask[mask_length]; + + uint8_t passes = 1; + if (self->colorspace.tricolor) { + passes = 2; + } + for (uint8_t pass = 0; pass < passes; pass++) { + uint16_t remaining_rows = displayio_area_height(&clipped); + + displayio_epaperdisplay_begin_transaction(self); + displayio_epaperdisplay_set_region_to_update(self, &clipped); + displayio_epaperdisplay_end_transaction(self); + + uint8_t write_command = self->write_black_ram_command; + if (pass == 1) { + write_command = self->write_color_ram_command; + } + displayio_epaperdisplay_begin_transaction(self); + self->send(self->bus, true, self->always_toggle_chip_select, &write_command, 1); + displayio_epaperdisplay_end_transaction(self); + + for (uint16_t j = 0; j < subrectangles; j++) { + displayio_area_t subrectangle = { + .x1 = clipped.x1, + .y1 = clipped.y1 + rows_per_buffer * j, + .x2 = clipped.x2, + .y2 = clipped.y1 + rows_per_buffer * (j + 1) + }; + if (remaining_rows < rows_per_buffer) { + subrectangle.y2 = subrectangle.y1 + remaining_rows; + } + remaining_rows -= rows_per_buffer; + + + uint16_t subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->colorspace.depth); + + for (uint16_t k = 0; k < mask_length; k++) { + mask[k] = 0x00000000; + } + for (uint16_t k = 0; k < buffer_size; k++) { + buffer[k] = 0x00000000; + } + + self->colorspace.grayscale = true; + if (pass == 1) { + self->colorspace.grayscale = false; + } + displayio_group_fill_area(self->current_group, &self->colorspace, &subrectangle, mask, buffer); + + // Invert it all. + if ((pass == 1 && self->color_bits_inverted) || + (pass == 0 && self->black_bits_inverted)) { + for (uint16_t k = 0; k < buffer_size; k++) { + buffer[k] = ~buffer[k]; + } + } + + if (!displayio_epaperdisplay_begin_transaction(self)) { + // Can't acquire display bus; skip the rest of the data. Try next display. + return false; + } + self->send(self->bus, false, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); + displayio_epaperdisplay_end_transaction(self); + + // TODO(tannewt): Make refresh displays faster so we don't starve other + // background tasks. + usb_background(); + } + } + + return true; +} + +void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { + if (self->current_group != NULL) { + self->current_group->in_group = false; + } + if (self->busy.base.type == &digitalio_digitalinout_type) { + common_hal_digitalio_digitalinout_deinit(&self->busy); + } +} + +bool displayio_epaperdisplay_fill_area(displayio_epaperdisplay_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer) { + return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); +} + +bool displayio_epaperdisplay_clip_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped) { + bool overlaps = displayio_area_compute_overlap(&self->area, area, clipped); + if (!overlaps) { + return false; + } + // Expand the area if we have multiple pixels per byte and we need to byte + // align the bounds. + uint8_t pixels_per_byte = 8; + if (clipped->x1 % pixels_per_byte != 0) { + clipped->x1 -= clipped->x1 % pixels_per_byte; + } + if (clipped->x2 % pixels_per_byte != 0) { + clipped->x2 += pixels_per_byte - clipped->x2 % pixels_per_byte; + } + return true; +} diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h new file mode 100644 index 0000000000..737b5987a8 --- /dev/null +++ b/shared-module/displayio/EPaperDisplay.h @@ -0,0 +1,92 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_EPAPERDISPLAY_H +#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_EPAPERDISPLAY_H + +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/displayio/Group.h" +#include "shared-bindings/pulseio/PWMOut.h" + +#include "shared-module/displayio/area.h" + +typedef void (*display_bus_bus_reset)(mp_obj_t bus); +typedef bool (*display_bus_bus_free)(mp_obj_t bus); +typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); +typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_end_transaction)(mp_obj_t bus); + +typedef struct { + mp_obj_base_t base; + mp_obj_t bus; + displayio_group_t *current_group; + uint64_t last_refresh; + display_bus_bus_reset bus_reset; + display_bus_bus_free bus_free; + display_bus_begin_transaction begin_transaction; + display_bus_send send; + display_bus_end_transaction end_transaction; + digitalio_digitalinout_obj_t busy; + uint32_t milliseconds_per_frame; + uint8_t* start_sequence; + uint32_t start_sequence_len; + uint8_t* stop_sequence; + uint32_t stop_sequence_len; + displayio_buffer_transform_t transform; + displayio_area_t area; + uint16_t width; + uint16_t height; + uint16_t ram_width; + uint16_t ram_height; + _displayio_colorspace_t colorspace; + int16_t colstart; + int16_t rowstart; + uint16_t set_column_window_command; + uint16_t set_row_window_command; + uint16_t set_current_column_command; + uint16_t set_current_row_command; + uint16_t write_black_ram_command; + uint16_t write_color_ram_command; + uint8_t refresh_display_command; + uint8_t hue; + bool busy_state; + bool black_bits_inverted; + bool color_bits_inverted; + bool refresh; + bool refreshing; + bool full_refresh; // New group means we need to refresh the whole display. + bool always_toggle_chip_select; +} displayio_epaperdisplay_obj_t; + +bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* display, const displayio_area_t* area); +void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self); +const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self); +bool displayio_epaperdisplay_fill_area(displayio_epaperdisplay_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer); +bool displayio_epaperdisplay_clip_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped); +bool displayio_epaperdisplay_bus_free(displayio_epaperdisplay_obj_t *self); +void release_epaperdisplay(displayio_epaperdisplay_obj_t* self); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 913635db86..64ad80665d 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -59,11 +59,7 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self, common_hal_digitalio_digitalinout_construct(&self->reset, reset); common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); never_reset_pin_number(reset->number); - - common_hal_digitalio_digitalinout_set_value(&self->reset, false); - common_hal_mcu_delay_us(10); - common_hal_digitalio_digitalinout_set_value(&self->reset, true); - common_hal_mcu_delay_us(10); + common_hal_displayio_fourwire_reset(self); } never_reset_pin_number(command->number); @@ -80,6 +76,23 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) { reset_pin_number(self->reset.pin->number); } +void common_hal_displayio_fourwire_reset(mp_obj_t obj) { + displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); + common_hal_digitalio_digitalinout_set_value(&self->reset, false); + common_hal_time_delay_ms(1); + common_hal_digitalio_digitalinout_set_value(&self->reset, true); + common_hal_time_delay_ms(1); +} + +bool common_hal_displayio_fourwire_bus_free(mp_obj_t obj) { + displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); + if (!common_hal_busio_spi_try_lock(self->bus)) { + return false; + } + common_hal_busio_spi_unlock(self->bus); + return true; +} + bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); if (!common_hal_busio_spi_try_lock(self->bus)) { @@ -91,10 +104,10 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, !command); - if (command) { + if (toggle_every_byte) { // Toggle chip select after each command byte in case the display driver // IC latches commands based on it. for (size_t i = 0; i < data_length; i++) { diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 38418a0299..eb6e9a4537 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -304,6 +304,9 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t* displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t* tail) { + if (self->base.type != &displayio_group_type) { + asm("bkpt"); + } if (self->item_removed) { self->dirty_area.next = tail; tail = &self->dirty_area; diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 9d89495287..23ebc0889d 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -59,10 +59,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self, common_hal_digitalio_digitalinout_construct(&self->reset, reset); common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); never_reset_pin_number(reset->number); - - common_hal_digitalio_digitalinout_set_value(&self->reset, false); - common_hal_mcu_delay_us(1); - common_hal_digitalio_digitalinout_set_value(&self->reset, true); + common_hal_displayio_i2cdisplay_reset(self); } } @@ -74,7 +71,17 @@ void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) { reset_pin_number(self->reset.pin->number); } -bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { + +void common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) { + displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); + + common_hal_digitalio_digitalinout_set_value(&self->reset, false); + common_hal_mcu_delay_us(1); + common_hal_digitalio_digitalinout_set_value(&self->reset, true); +} + + +bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); if (!common_hal_busio_i2c_try_lock(self->bus)) { return false; @@ -82,7 +89,11 @@ bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) { +bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { + return common_hal_displayio_i2cdisplay_bus_free(obj); +} + +void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); if (command) { uint8_t command_bytes[2 * data_length]; diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 2b56424375..10fc0c4a2e 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -74,7 +74,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, self->g_bitmask = 0x3e0; self->b_bitmask = 0x1f; } - } else if ((indexed) && (self->bits_per_pixel != 1)) { + } else if (indexed && self->bits_per_pixel != 1) { uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_offset = 0xe + header_size; @@ -90,25 +90,24 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, if (palette_bytes_read != palette_size) { mp_raise_ValueError(translate("Unable to read color palette data")); } - - } else if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124)) { mp_raise_ValueError_varg(translate("Only Windows format, uncompressed BMP supported: given header size is %d"), header_size); } - if ((bits_per_pixel == 4 ) || (( bits_per_pixel == 8) && (number_of_colors == 0))) { - mp_raise_ValueError_varg(translate("Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp given"), bits_per_pixel); + if (bits_per_pixel == 8 && number_of_colors == 0) { + mp_raise_ValueError_varg(translate("Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: %d bpp given"), bits_per_pixel); } - if (self->bits_per_pixel >=8){ - self->stride = (self->width * (bits_per_pixel / 8)); + uint8_t bytes_per_pixel = (self->bits_per_pixel / 8) ? (self->bits_per_pixel /8) : 1; + uint8_t pixels_per_byte = 8 / self->bits_per_pixel; + if (pixels_per_byte == 0){ + self->stride = (self->width * bytes_per_pixel); // Rows are word aligned. if (self->stride % 4 != 0) { self->stride += 4 - self->stride % 4; } - } else { - uint32_t bit_stride = self->width; + uint32_t bit_stride = self->width * self->bits_per_pixel; if (bit_stride % 32 != 0) { bit_stride += 32 - bit_stride % 32; } @@ -126,10 +125,11 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s uint32_t location; uint8_t bytes_per_pixel = (self->bits_per_pixel / 8) ? (self->bits_per_pixel /8) : 1; - if (self->bits_per_pixel >= 8){ + uint8_t pixels_per_byte = 8 / self->bits_per_pixel; + if (pixels_per_byte == 0){ location = self->data_offset + (self->height - y - 1) * self->stride + x * bytes_per_pixel; } else { - location = self->data_offset + (self->height - y - 1) * self->stride + x / 8; + location = self->data_offset + (self->height - y - 1) * self->stride + x / pixels_per_byte; } // We don't cache here because the underlying FS caches sectors. f_lseek(&self->file->fp, location); @@ -141,20 +141,21 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s uint8_t red; uint8_t green; uint8_t blue; - if (self->bits_per_pixel == 1) { - uint8_t bit_offset = x%8; - tmp = ( pixel_data & (0x80 >> (bit_offset))) >> (7 - bit_offset); - if (tmp == 1) { - return 0x00FFFFFF; - } else { - return 0x00000000; + if (bytes_per_pixel == 1) { + uint8_t offset = (x % pixels_per_byte) * self->bits_per_pixel; + uint8_t mask = (1 << self->bits_per_pixel) - 1; + + uint8_t index = (pixel_data >> ((8 - self->bits_per_pixel) - offset)) & mask; + if (self->bits_per_pixel == 1) { + if (index == 1) { + return 0xFFFFFF; + } else if (index == 0) { + return 0x000000; + } else { + asm("bkpt"); + } } - } else if (bytes_per_pixel == 1) { - blue = ((self->palette_data[pixel_data] & 0xFF) >> 0); - red = ((self->palette_data[pixel_data] & 0xFF0000) >> 16); - green = ((self->palette_data[pixel_data] & 0xFF00) >> 8); - tmp = (red << 16 | green << 8 | blue ); - return tmp; + return self->palette_data[index]; } else if (bytes_per_pixel == 2) { if (self->g_bitmask == 0x07e0) { // 565 red =((pixel_data & self->r_bitmask) >>11); diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index 444151b3c0..3bce86f484 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -52,6 +52,10 @@ void common_hal_displayio_palette_set_color(displayio_palette_t* self, uint32_t self->colors[palette_index].rgb888 = color; self->colors[palette_index].luma = displayio_colorconverter_compute_luma(color); self->colors[palette_index].rgb565 = displayio_colorconverter_compute_rgb565(color); + + uint8_t chroma = displayio_colorconverter_compute_chroma(color); + self->colors[palette_index].chroma = chroma; + self->colors[palette_index].hue = displayio_colorconverter_compute_hue(color); self->needs_refresh = true; } @@ -64,7 +68,19 @@ bool displayio_palette_get_color(displayio_palette_t *self, const _displayio_col return false; // returns opaque } - if (colorspace->grayscale) { + if (colorspace->tricolor) { + uint8_t luma = self->colors[palette_index].luma; + *color = luma >> (8 - colorspace->depth); + // Chroma 0 means the color is a gray and has no hue so never color based on it. + if (self->colors[palette_index].chroma <= 16) { + if (!colorspace->grayscale) { + *color = 0; + } + return true; + } + uint8_t pixel_hue = self->colors[palette_index].hue; + displayio_colorconverter_compute_tricolor(colorspace, pixel_hue, luma, color); + } else if (colorspace->grayscale) { *color = self->colors[palette_index].luma >> (8 - colorspace->depth); } else { *color = self->colors[palette_index].rgb565; diff --git a/shared-module/displayio/Palette.h b/shared-module/displayio/Palette.h index a917e24321..1cfdd199a5 100644 --- a/shared-module/displayio/Palette.h +++ b/shared-module/displayio/Palette.h @@ -34,17 +34,21 @@ typedef struct { uint8_t depth; - bool grayscale; - bool pixels_in_byte_share_row; uint8_t bytes_per_cell; + uint8_t tricolor_hue; + uint8_t tricolor_luma; + bool grayscale; + bool tricolor; + bool pixels_in_byte_share_row; bool reverse_pixels_in_byte; - uint8_t hue; } _displayio_colorspace_t; typedef struct { uint32_t rgb888; uint16_t rgb565; uint8_t luma; + uint8_t hue; + uint8_t chroma; bool transparent; // This may have additional bits added later for blending. } _displayio_color_t; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 6144f8f994..6553cf9012 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -443,6 +443,7 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, const _displayio_c } uint8_t shift = (offset % pixels_per_byte) * colorspace->depth; if (colorspace->reverse_pixels_in_byte) { + // Reverse the shift by subtracting it from the leftmost shift. shift = (pixels_per_byte - 1) * colorspace->depth - shift; } ((uint8_t*)buffer)[offset / pixels_per_byte] |= pixel << shift; diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 3e9c4aa2a1..a8f888654f 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -133,26 +133,50 @@ void displayio_refresh_displays(void) { // Skip null display. continue; } - displayio_display_obj_t* display = &displays[i].display; - displayio_display_update_backlight(display); + if (displays[i].display.base.type == &displayio_display_type) { + displayio_display_obj_t* display = &displays[i].display; + displayio_display_update_backlight(display); - // Time to refresh at specified frame rate? - if (!displayio_display_frame_queued(display)) { - // Too soon. Try next display. - continue; + // Time to refresh at specified frame rate? + if (!displayio_display_frame_queued(display)) { + // Too soon. Try next display. + continue; + } + if (!displayio_display_begin_transaction(display)) { + // Can't acquire display bus; skip updating this display. Try next display. + continue; + } + displayio_display_end_transaction(display); + displayio_display_start_refresh(display); + const displayio_area_t* current_area = displayio_display_get_refresh_areas(display); + while (current_area != NULL) { + refresh_area(display, current_area); + current_area = current_area->next; + } + displayio_display_finish_refresh(display); + } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; + // Time to refresh at specified frame rate? + if (!displayio_epaperdisplay_frame_queued(display)) { + // Too soon. Try next display. + continue; + } + if (!displayio_epaperdisplay_bus_free(display)) { + // Can't acquire display bus; skip updating this display. Try next display. + continue; + } + const displayio_area_t* current_area = displayio_epaperdisplay_get_refresh_areas(display); + if (current_area == NULL) { + continue; + } + displayio_epaperdisplay_start_refresh(display); + while (current_area != NULL) { + displayio_epaperdisplay_refresh_area(display, current_area); + current_area = current_area->next; + } + displayio_epaperdisplay_finish_refresh(display); } - if (!displayio_display_begin_transaction(display)) { - // Can't acquire display bus; skip updating this display. Try next display. - continue; - } - displayio_display_end_transaction(display); - displayio_display_start_refresh(display); - const displayio_area_t* current_area = displayio_display_get_refresh_areas(display); - while (current_area != NULL) { - refresh_area(display, current_area); - current_area = current_area->next; - } - displayio_display_finish_refresh(display); + frame_count++; } @@ -175,7 +199,14 @@ void common_hal_displayio_release_displays(void) { displays[i].fourwire_bus.base.type = &mp_type_NoneType; } for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - release_display(&displays[i].display); + mp_const_obj_t display_type = displays[i].display.base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { + continue; + } else if (display_type == &displayio_display_type) { + release_display(&displays[i].display); + } else if (display_type == &displayio_epaperdisplay_type) { + release_epaperdisplay(&displays[i].epaper_display); + } displays[i].display.base.type = &mp_type_NoneType; } @@ -232,7 +263,7 @@ void reset_displays(void) { } } } else { - // Not an active display. + // Not an active display bus. continue; } } @@ -240,9 +271,14 @@ void reset_displays(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { // Reset the displayed group. Only the first will get the terminal but // that's ok. - displayio_display_obj_t* display = &displays[i].display; - display->auto_brightness = true; - common_hal_displayio_display_show(display, NULL); + if (displays[i].display.base.type == &displayio_display_type) { + displayio_display_obj_t* display = &displays[i].display; + display->auto_brightness = true; + common_hal_displayio_display_show(display, NULL); + } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; + common_hal_displayio_epaperdisplay_show(display, NULL); + } } } @@ -254,8 +290,11 @@ void displayio_gc_collect(void) { // Alternatively, we could use gc_collect_root over the whole object, // but this is more precise, and is the only field that needs marking. - gc_collect_ptr(displays[i].display.current_group); - + if (displays[i].display.base.type == &displayio_display_type) { + gc_collect_ptr(displays[i].display.current_group); + } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + gc_collect_ptr(displays[i].epaper_display.current_group); + } } } diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index caa5ce36d8..95eefbdd99 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -28,6 +28,7 @@ #define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H #include "shared-bindings/displayio/Display.h" +#include "shared-bindings/displayio/EPaperDisplay.h" #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/displayio/Group.h" #include "shared-bindings/displayio/I2CDisplay.h" @@ -39,7 +40,10 @@ typedef struct { displayio_i2cdisplay_obj_t i2cdisplay_bus; displayio_parallelbus_obj_t parallel_bus; }; - displayio_display_obj_t display; + union { + displayio_display_obj_t display; + displayio_epaperdisplay_obj_t epaper_display; + }; } primary_display_t; extern primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index fd51e2c079..586b6f8be4 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -151,37 +151,49 @@ _displayio_color_t blinka_colors[7] = { .rgb888 = 0x000000, .rgb565 = 0x0000, .luma = 0x00, + .chroma = 0, .transparent = true }, { .rgb888 = 0x8428bc, .rgb565 = 0x7889, - .luma = 0xff // We cheat the luma here. It is actually 0x60 + .luma = 0xff, // We cheat the luma here. It is actually 0x60 + .hue = 184, + .chroma = 148 }, { .rgb888 = 0xff89bc, .rgb565 = 0xB8FC, - .luma = 0xb5 + .luma = 0xb5, + .hue = 222, + .chroma = 118 }, { .rgb888 = 0x7beffe, .rgb565 = 0x9F86, - .luma = 0xe0 + .luma = 0xe0, + .hue = 124, + .chroma = 131 }, { .rgb888 = 0x51395f, .rgb565 = 0x0D5A, - .luma = 0x47 + .luma = 0x47, + .hue = 185, + .chroma = 38 }, { .rgb888 = 0xffffff, .rgb565 = 0xffff, - .luma = 0xff + .luma = 0xff, + .chroma = 0 }, { .rgb888 = 0x0736a0, .rgb565 = 0xf501, - .luma = 0x44 + .luma = 0x44, + .hue = 147, + .chroma = 153 }, }; diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index 0f6b9014b7..65600a195b 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -102,12 +102,14 @@ _displayio_color_t terminal_colors[2] = { { .rgb888 = 0x000000, .rgb565 = 0x0000, - .luma = 0x00 + .luma = 0x00, + .chroma = 0 }, { .rgb888 = 0xffffff, .rgb565 = 0xffff, - .luma = 0xff + .luma = 0xff, + .chroma = 0 }, }; From d37dd4d758dd2d2a63fd4c9b7989d60560fd4a25 Mon Sep 17 00:00:00 2001 From: Benny Meisels Date: Tue, 6 Aug 2019 02:24:25 +0300 Subject: [PATCH 04/41] Updated ParallelBus implementation in nrf port --- ports/nrf/common-hal/displayio/ParallelBus.c | 28 +++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ports/nrf/common-hal/displayio/ParallelBus.c b/ports/nrf/common-hal/displayio/ParallelBus.c index 42231be527..efb8c15b91 100644 --- a/ports/nrf/common-hal/displayio/ParallelBus.c +++ b/ports/nrf/common-hal/displayio/ParallelBus.c @@ -31,6 +31,7 @@ #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" #include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/microcontroller/__init__.h" #include "tick.h" @@ -70,10 +71,6 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select); common_hal_digitalio_digitalinout_switch_to_output(&self->chip_select, true, DRIVE_MODE_PUSH_PULL); - self->reset.base.type = &digitalio_digitalinout_type; - common_hal_digitalio_digitalinout_construct(&self->reset, reset); - common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); - self->write.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->write, write); common_hal_digitalio_digitalinout_switch_to_output(&self->write, true, DRIVE_MODE_PUSH_PULL); @@ -93,11 +90,18 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel } self->write_mask = 1 << (write->number % num_pins_in_write_port); + if (reset != NULL) { + self->reset.base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(&self->reset, reset); + common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); + never_reset_pin_number(reset->number); + common_hal_displayio_parallelbus_reset(self); + } + never_reset_pin_number(command->number); never_reset_pin_number(chip_select->number); never_reset_pin_number(write->number); never_reset_pin_number(read->number); - never_reset_pin_number(reset->number); for (uint8_t i = 0; i < 8; i++) { never_reset_pin_number(data_pin + i); } @@ -115,13 +119,25 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) reset_pin_number(self->reset.pin->number); } +void common_hal_displayio_parallelbus_reset(mp_obj_t obj) { + displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + + common_hal_digitalio_digitalinout_set_value(&self->reset, false); + common_hal_mcu_delay_us(4); + common_hal_digitalio_digitalinout_set_value(&self->reset, true); +} + +bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { + return true; +} + bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->chip_select, false); return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); common_hal_digitalio_digitalinout_set_value(&self->command, !command); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR; From c247e7df9c043dc6a452a6cabc7bf232c0e9e085 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 14 Aug 2019 14:17:35 -0700 Subject: [PATCH 05/41] Begin refresh rework. --- ports/atmel-samd/background.c | 2 +- ports/nrf/background.c | 2 +- ports/stm32f4/background.c | 2 +- py/circuitpy_mpconfig.h | 2 +- shared-bindings/displayio/Display.c | 37 ++++-- shared-bindings/displayio/Display.h | 14 +- shared-bindings/displayio/EPaperDisplay.c | 45 ++++--- shared-bindings/displayio/EPaperDisplay.h | 9 +- shared-module/displayio/Display.c | 124 +++++++++++++++++- shared-module/displayio/Display.h | 8 +- shared-module/displayio/EPaperDisplay.c | 71 ++++++++--- shared-module/displayio/EPaperDisplay.h | 8 +- shared-module/displayio/__init__.c | 149 ++-------------------- shared-module/displayio/__init__.h | 2 +- 14 files changed, 254 insertions(+), 221 deletions(-) diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index 6942380706..386ba07158 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -60,7 +60,7 @@ void run_background_tasks(void) { audio_dma_background(); #endif #if CIRCUITPY_DISPLAYIO - displayio_refresh_displays(); + displayio_background(); #endif #if CIRCUITPY_NETWORK diff --git a/ports/nrf/background.c b/ports/nrf/background.c index 453bc96dfb..94411cbce5 100644 --- a/ports/nrf/background.c +++ b/ports/nrf/background.c @@ -56,7 +56,7 @@ void run_background_tasks(void) { #endif #if CIRCUITPY_DISPLAYIO - displayio_refresh_displays(); + displayio_background(); #endif running_background_tasks = false; diff --git a/ports/stm32f4/background.c b/ports/stm32f4/background.c index e9872b0450..b91c3793ee 100644 --- a/ports/stm32f4/background.c +++ b/ports/stm32f4/background.c @@ -49,7 +49,7 @@ void run_background_tasks(void) { //usb_background(); #if CIRCUITPY_DISPLAYIO - displayio_refresh_displays(); + displayio_background(); #endif running_background_tasks = false; diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 393b7600c7..c2e2e2d023 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -307,7 +307,7 @@ extern const struct _mp_obj_module_t terminalio_module; #define DISPLAYIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_displayio), (mp_obj_t)&displayio_module }, #define FONTIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_fontio), (mp_obj_t)&fontio_module }, #define TERMINALIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_terminalio), (mp_obj_t)&terminalio_module }, -#define CIRCUITPY_DISPLAY_LIMIT (3) +#define CIRCUITPY_DISPLAY_LIMIT (1) #else #define DISPLAYIO_MODULE #define FONTIO_MODULE diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 0c48b0cc51..fb9bfff852 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -212,27 +212,42 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) } MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); -//| .. method:: refresh_soon() +//| .. method:: refresh(*, target_frames_per_second=None, minimum_frames_per_second=1) //| -//| Queues up a display refresh that happens in the background. +//| Waits for the target frame rate and then refreshes the display. If the call is too late for the given target frame rate, then the refresh returns immediately without updating the screen to hopefully help getting caught up. If the current frame rate is below the minimum frame rate, then an exception will be raised. //| -STATIC mp_obj_t displayio_display_obj_refresh_soon(mp_obj_t self_in) { +STATIC mp_obj_t displayio_display_obj_refresh(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); - common_hal_displayio_display_refresh_soon(self); + common_hal_displayio_display_refresh(self); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_refresh_soon_obj, displayio_display_obj_refresh_soon); -//| .. method:: wait_for_frame() +//| .. attribute:: auto_refresh //| -//| Waits until the next frame has been transmitted to the display unless the wait count is -//| behind the rendered frames. In that case, this will return immediately with the wait count. +//| True when the display is refreshed automatically. //| -STATIC mp_obj_t displayio_display_obj_wait_for_frame(mp_obj_t self_in) { +STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_wait_for_frame(self)); + return mp_obj_new_bool(common_hal_displayio_display_get_auto_refresh(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_wait_for_frame_obj, displayio_display_obj_wait_for_frame); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_refresh_obj, displayio_display_obj_get_auto_refresh); + +STATIC mp_obj_t displayio_display_obj_set_auto_refresh(mp_obj_t self_in, mp_obj_t auto_refresh) { + displayio_display_obj_t *self = native_display(self_in); + + common_hal_displayio_display_set_auto_refresh(self, mp_obj_is_true(auto_refresh)); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_refresh_obj, displayio_display_obj_set_auto_refresh); + +const mp_obj_property_t displayio_display_auto_refresh_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_display_get_auto_refresh_obj, + (mp_obj_t)&displayio_display_set_auto_refresh_obj, + (mp_obj_t)&mp_const_none_obj}, +}; //| .. attribute:: brightness //| @@ -442,6 +457,8 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_display_wait_for_frame_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&displayio_display_fill_row_obj) }, + { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&displayio_display_auto_refresh_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 8df1adc085..0d416b8688 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -44,26 +44,16 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll, uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command, - mp_float_t brightness, bool auto_brightness, + mp_float_t brightness, bool auto_brightness, bool auto_refresh, uint8_t frames_per_second, bool single_byte_bounds, bool data_as_commands); -int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self); - bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); -void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self); +void common_hal_displayio_display_refresh(displayio_display_obj_t* self); bool displayio_display_begin_transaction(displayio_display_obj_t* self); void displayio_display_end_transaction(displayio_display_obj_t* self); -// The second point of the region is exclusive. -void displayio_display_set_region_to_update(displayio_display_obj_t* self, displayio_area_t* area); -bool displayio_display_frame_queued(displayio_display_obj_t* self); - -bool displayio_display_refresh_queued(displayio_display_obj_t* self); -void displayio_display_finish_refresh(displayio_display_obj_t* self); -void displayio_display_send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length); - bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index d13d07e4af..4b00240d1d 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -51,7 +51,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum. //| -//| .. class:: EPaperDisplay(display_bus, start_sequence, stop_sequence, *, width, height, ram_width, ram_height, colstart=0, rowstart=0, rotation=0, set_column_window_command=None, set_row_window_command=None, single_byte_bounds=False, write_black_ram_command, black_bits_inverted=False, write_color_ram_command=None, color_bits_inverted=False, refresh_display_command, busy_pin=None, busy_state=True, seconds_per_frame=180, always_toggle_chip_select=False) +//| .. class:: EPaperDisplay(display_bus, start_sequence, stop_sequence, *, width, height, ram_width, ram_height, colstart=0, rowstart=0, rotation=0, set_column_window_command=None, set_row_window_command=None, single_byte_bounds=False, write_black_ram_command, black_bits_inverted=False, write_color_ram_command=None, color_bits_inverted=False, highlight_color=0x000000, refresh_display_command, busy_pin=None, busy_state=True, seconds_per_frame=180, always_toggle_chip_select=False) //| //| Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| @@ -81,7 +81,7 @@ //| :param bool black_bits_inverted: True if 0 bits are used to show black pixels. Otherwise, 1 means to show black. //| :param int write_color_ram_command: Command used to write pixels values into the update region //| :param bool color_bits_inverted: True if 0 bits are used to show the color. Otherwise, 1 means to show color. -//| :param int third_color: Color of third ePaper color in RGB888. +//| :param int highlight_color: RGB888 of source color to highlight with third ePaper color. //| :param int refresh_display_command: Command used to start a display refresh //| :param microcontroller.Pin busy_pin: Pin used to signify the display is busy //| :param bool busy_state: State of the busy pin when the display is busy @@ -89,7 +89,7 @@ //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| STATIC mp_obj_t displayio_epaperdisplay_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_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_third_color, ARG_refresh_display_command, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; + enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, ARG_refresh_display_command, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -109,7 +109,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size { MP_QSTR_black_bits_inverted, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_write_color_ram_command, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, { MP_QSTR_color_bits_inverted, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, - { MP_QSTR_third_color, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x000000} }, + { MP_QSTR_highlight_color, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x000000} }, { MP_QSTR_refresh_display_command, MP_ARG_INT | MP_ARG_REQUIRED }, { MP_QSTR_busy_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, { MP_QSTR_busy_state, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, @@ -155,7 +155,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj); mp_int_t write_color_ram_command = NO_COMMAND; - mp_int_t third_color = args[ARG_third_color].u_int; + mp_int_t highlight_color = args[ARG_highlight_color].u_int; if (args[ARG_write_color_ram_command].u_obj != mp_const_none) { write_color_ram_command = mp_obj_get_int(args[ARG_write_color_ram_command].u_obj); } @@ -168,7 +168,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_ram_width].u_int, args[ARG_ram_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, args[ARG_set_column_window_command].u_int, args[ARG_set_row_window_command].u_int, args[ARG_set_current_column_command].u_int, args[ARG_set_current_row_command].u_int, - args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, third_color, args[ARG_refresh_display_command].u_int, + args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, highlight_color, args[ARG_refresh_display_command].u_int, busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, args[ARG_always_toggle_chip_select].u_bool ); @@ -203,27 +203,38 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou } MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); -//| .. method:: refresh_soon() +//| .. method:: refresh() //| -//| Queues up a display refresh that happens in the background. +//| Refreshes the display immediately or raises an exception if too soon. Use +//| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur. //| STATIC mp_obj_t displayio_epaperdisplay_obj_refresh_soon(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); - common_hal_displayio_epaperdisplay_refresh_soon(self); + bool ok = common_hal_displayio_epaperdisplay_refresh(self); + if (!ok) { + mp_raise_RuntimeError(translate("Refresh too soon")); + } return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_soon_obj, displayio_epaperdisplay_obj_refresh_soon); -//| .. method:: wait_for_frame() +//| .. attribute:: time_to_refresh //| -//| Waits until the next frame has been transmitted to the display unless the wait count is -//| behind the rendered frames. In that case, this will return immediately with the wait count. +//| Time, in fractional seconds, until the ePaper display can be refreshed. //| -STATIC mp_obj_t displayio_epaperdisplay_obj_wait_for_frame(mp_obj_t self_in) { +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); - return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_epaperdisplay_wait_for_frame(self)); + return mp_obj_new_float(common_hal_displayio_epaperdisplay_get_time_to_refresh(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_wait_for_frame_obj, displayio_epaperdisplay_obj_wait_for_frame); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_time_to_refresh_obj, displayio_epaperdisplay_obj_get_time_to_refresh); + +const mp_obj_property_t displayio_epaperdisplay_time_to_refresh_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&displayio_epaperdisplay_get_time_to_refresh_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj}, +}; //| .. attribute:: width //| @@ -282,12 +293,12 @@ const mp_obj_property_t displayio_epaperdisplay_bus_obj = { STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, - { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_epaperdisplay_refresh_soon_obj) }, - { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_epaperdisplay_wait_for_frame_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, + { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table); diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 3deeef9591..87feb4da08 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -43,23 +43,24 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t third_color, uint16_t refresh_display_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select); int32_t common_hal_displayio_epaperdisplay_wait_for_frame(displayio_epaperdisplay_obj_t* self); bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self, displayio_group_t* root_group); -void common_hal_displayio_epaperdisplay_refresh_soon(displayio_epaperdisplay_obj_t* self); - bool displayio_epaperdisplay_begin_transaction(displayio_epaperdisplay_obj_t* self); void displayio_epaperdisplay_end_transaction(displayio_epaperdisplay_obj_t* self); +bool displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self); + +mp_float_t displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); + // The second point of the region is exclusive. void displayio_epaperdisplay_set_region_to_update(displayio_epaperdisplay_obj_t* self, displayio_area_t* area); bool displayio_epaperdisplay_frame_queued(displayio_epaperdisplay_obj_t* self); -bool displayio_epaperdisplay_refresh_queued(displayio_epaperdisplay_obj_t* self); void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self); void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length); diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 97a18740a3..fafb35f43c 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -221,10 +221,6 @@ bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_ return true; } -void common_hal_displayio_display_refresh_soon(displayio_display_obj_t* self) { - self->refresh = true; -} - const displayio_area_t* displayio_display_get_refresh_areas(displayio_display_obj_t *self) { if (self->full_refresh) { self->area.next = NULL; @@ -246,6 +242,118 @@ int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* sel return 0; } +STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_t* area) { + uint16_t buffer_size = 128; // In uint32_ts + + displayio_area_t clipped; + // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. + if (!displayio_display_clip_area(display, area, &clipped)) { + return true; + } + uint16_t subrectangles = 1; + uint16_t rows_per_buffer = displayio_area_height(&clipped); + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / display->colorspace.depth; + uint16_t pixels_per_buffer = displayio_area_size(&clipped); + if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { + rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); + if (rows_per_buffer == 0) { + rows_per_buffer = 1; + } + // If pixels are packed by column then ensure rows_per_buffer is on a byte boundary. + if (display->colorspace.depth < 8 && !display->colorspace.pixels_in_byte_share_row) { + uint8_t pixels_per_byte = 8 / display->colorspace.depth; + if (rows_per_buffer % pixels_per_byte != 0) { + rows_per_buffer -= rows_per_buffer % pixels_per_byte; + } + } + subrectangles = displayio_area_height(&clipped) / rows_per_buffer; + if (displayio_area_height(&clipped) % rows_per_buffer != 0) { + subrectangles++; + } + pixels_per_buffer = rows_per_buffer * displayio_area_width(&clipped); + buffer_size = pixels_per_buffer / pixels_per_word; + if (pixels_per_buffer % pixels_per_word) { + buffer_size += 1; + } + } + + // Allocated and shared as a uint32_t array so the compiler knows the + // alignment everywhere. + uint32_t buffer[buffer_size]; + volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1; + uint32_t mask[mask_length]; + uint16_t remaining_rows = displayio_area_height(&clipped); + + for (uint16_t j = 0; j < subrectangles; j++) { + displayio_area_t subrectangle = { + .x1 = clipped.x1, + .y1 = clipped.y1 + rows_per_buffer * j, + .x2 = clipped.x2, + .y2 = clipped.y1 + rows_per_buffer * (j + 1) + }; + if (remaining_rows < rows_per_buffer) { + subrectangle.y2 = subrectangle.y1 + remaining_rows; + } + remaining_rows -= rows_per_buffer; + + displayio_display_begin_transaction(display); + displayio_display_set_region_to_update(display, &subrectangle); + displayio_display_end_transaction(display); + + uint16_t subrectangle_size_bytes; + if (display->colorspace.depth >= 8) { + subrectangle_size_bytes = displayio_area_size(&subrectangle) * (display->colorspace.depth / 8); + } else { + subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / display->colorspace.depth); + } + + for (uint16_t k = 0; k < mask_length; k++) { + mask[k] = 0x00000000; + } + for (uint16_t k = 0; k < buffer_size; k++) { + buffer[k] = 0x00000000; + } + + displayio_display_fill_area(display, &subrectangle, mask, buffer); + + if (!displayio_display_begin_transaction(display)) { + // Can't acquire display bus; skip the rest of the data. Try next display. + return false; + } + displayio_display_send_pixels(display, (uint8_t*) buffer, subrectangle_size_bytes); + displayio_display_end_transaction(display); + + // TODO(tannewt): Make refresh displays faster so we don't starve other + // background tasks. + usb_background(); + } + return true; +} + +STATIC void refresh_display(displayio_display_obj_t* self) { + if (!displayio_display_begin_transaction(self)) { + // Can't acquire display bus; skip updating this display. Try next display. + continue; + } + displayio_display_end_transaction(self); + displayio_display_start_refresh(self); + const displayio_area_t* current_area = displayio_display_get_refresh_areas(self); + while (current_area != NULL) { + refresh_area(self, current_area); + current_area = current_area->next; + } + displayio_display_finish_refresh(self); +} + +void common_hal_displayio_display_refresh(displayio_display_obj_t* self) { + // Time to refresh at specified frame rate? + while (!displayio_display_frame_queued(self)) { + // Too soon. Try next display. + continue; + } + refresh_display(self); +} + bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self) { return self->auto_brightness; } @@ -411,6 +519,14 @@ void displayio_display_update_backlight(displayio_display_obj_t* self) { self->last_backlight_refresh = ticks_ms; } +void displayio_display_background(displayio_display_obj_t* self) { + displayio_display_update_backlight(self); + + if (self->auto_refresh && (ticks_ms - self->last_refresh) > 16) { + display_refresh(self); + } +} + void release_display(displayio_display_obj_t* self) { if (self->current_group != NULL) { self->current_group->in_group = false; diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index c85d69b0e2..db0a23012d 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -63,7 +63,7 @@ typedef struct { uint8_t set_column_command; uint8_t set_row_command; uint8_t write_ram_command; - bool refresh; + bool auto_refresh; bool single_byte_bounds; bool data_as_commands; bool auto_brightness; @@ -71,11 +71,7 @@ typedef struct { bool full_refresh; // New group means we need to refresh the whole display. } displayio_display_obj_t; -void displayio_display_start_refresh(displayio_display_obj_t* self); -const displayio_area_t* displayio_display_get_refresh_areas(displayio_display_obj_t *self); -bool displayio_display_fill_area(displayio_display_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer); -void displayio_display_update_backlight(displayio_display_obj_t* self); -bool displayio_display_clip_area(displayio_display_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped); +void displayio_display_background(displayio_display_obj_t* self); void release_display(displayio_display_obj_t* self); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 5e4bdc340d..434adbdf4e 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -48,7 +48,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t third_color, uint16_t refresh_display_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select) { self->colorspace.depth = 1; self->colorspace.grayscale = true; @@ -56,10 +56,10 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->colorspace.bytes_per_cell = 1; self->colorspace.reverse_pixels_in_byte = true; - if (third_color != 0x000000) { + if (highlight_color != 0x000000) { self->colorspace.tricolor = true; - self->colorspace.tricolor_hue = displayio_colorconverter_compute_hue(third_color); - self->colorspace.tricolor_luma = displayio_colorconverter_compute_luma(third_color); + self->colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); + self->colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color); } self->set_column_window_command = set_column_window_command; @@ -174,6 +174,11 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* never_reset_pin_number(busy_pin->number); } + // Clear the color memory if it isn't in use. + if (highlight_color == 0x00 && write_color_ram_command != NO_COMMAND) { + // TODO: Clear + } + // Set the group after initialization otherwise we may send pixels while we delay in // initialization. common_hal_displayio_epaperdisplay_show(self, &circuitpython_splash); @@ -198,14 +203,9 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self self->current_group = root_group; } self->full_refresh = true; - common_hal_displayio_epaperdisplay_refresh_soon(self); return true; } -void common_hal_displayio_epaperdisplay_refresh_soon(displayio_epaperdisplay_obj_t* self) { - self->refresh = true; -} - const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { const displayio_area_t* first_area; if (self->current_group == NULL || self->current_group->base.type != &displayio_group_type) { @@ -359,21 +359,23 @@ void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self) self->last_refresh = ticks_ms; } -bool displayio_epaperdisplay_frame_queued(displayio_epaperdisplay_obj_t* self) { +void displayio_epaperdisplay_background_task(displayio_epaperdisplay_obj_t* self) { if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { self->refreshing = false; // Run stop sequence but don't wait for busy because busy is set when sleeping. send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); - } else { - return false; } } - if (self->current_group == NULL) { - return false; - } +} + +uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self) { // Refresh at seconds per frame rate. - return (ticks_ms - self->last_refresh) > self->milliseconds_per_frame; + uint32_t elapsed_time = ticks_ms - self->last_refresh; + if (elapsed_time > self->milliseconds_per_frame) { + return 0; + } + return self->milliseconds_per_frame - elapsed_time; } void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) { @@ -394,7 +396,6 @@ void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length) { } - bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { uint16_t buffer_size = 128; // In uint32_ts @@ -500,6 +501,42 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c return true; } +bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self) { + + if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { + if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { + self->refreshing = false; + // Run stop sequence but don't wait for busy because busy is set when sleeping. + send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); + } else { + return false; + } + } + if (self->current_group == NULL) { + return false; + } + // Refresh at seconds per frame rate. + if (ticks_ms - self->last_refresh) > self->milliseconds_per_frame; + + if (displayio_epaperdisplay_get_time_to_refresh(display) > 0) { + return false; + } + if (!displayio_epaperdisplay_bus_free(display)) { + // Can't acquire display bus; skip updating this display. Try next display. + continue; + } + const displayio_area_t* current_area = displayio_epaperdisplay_get_refresh_areas(display); + if (current_area == NULL) { + continue; + } + displayio_epaperdisplay_start_refresh(display); + while (current_area != NULL) { + displayio_epaperdisplay_refresh_area(display, current_area); + current_area = current_area->next; + } + displayio_epaperdisplay_finish_refresh(display); +} + void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { if (self->current_group != NULL) { self->current_group->in_group = false; diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 737b5987a8..cc7db6f6d1 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -75,18 +75,12 @@ typedef struct { bool busy_state; bool black_bits_inverted; bool color_bits_inverted; - bool refresh; bool refreshing; bool full_refresh; // New group means we need to refresh the whole display. bool always_toggle_chip_select; } displayio_epaperdisplay_obj_t; -bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* display, const displayio_area_t* area); -void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self); -const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self); -bool displayio_epaperdisplay_fill_area(displayio_epaperdisplay_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer); -bool displayio_epaperdisplay_clip_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped); -bool displayio_epaperdisplay_bus_free(displayio_epaperdisplay_obj_t *self); +void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self); void release_epaperdisplay(displayio_epaperdisplay_obj_t* self); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index a8f888654f..0ebed58c24 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -19,100 +19,11 @@ #include "supervisor/usb.h" primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; -uint32_t frame_count = 0; -bool refresh_area(displayio_display_obj_t* display, const displayio_area_t* area) { - uint16_t buffer_size = 128; // In uint32_ts +// Check for recursive calls to displayio_background. +bool displayio_background_in_progress = false; - displayio_area_t clipped; - // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. - if (!displayio_display_clip_area(display, area, &clipped)) { - return true; - } - uint16_t subrectangles = 1; - uint16_t rows_per_buffer = displayio_area_height(&clipped); - uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / display->colorspace.depth; - uint16_t pixels_per_buffer = displayio_area_size(&clipped); - if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { - rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); - if (rows_per_buffer == 0) { - rows_per_buffer = 1; - } - // If pixels are packed by column then ensure rows_per_buffer is on a byte boundary. - if (display->colorspace.depth < 8 && !display->colorspace.pixels_in_byte_share_row) { - uint8_t pixels_per_byte = 8 / display->colorspace.depth; - if (rows_per_buffer % pixels_per_byte != 0) { - rows_per_buffer -= rows_per_buffer % pixels_per_byte; - } - } - subrectangles = displayio_area_height(&clipped) / rows_per_buffer; - if (displayio_area_height(&clipped) % rows_per_buffer != 0) { - subrectangles++; - } - pixels_per_buffer = rows_per_buffer * displayio_area_width(&clipped); - buffer_size = pixels_per_buffer / pixels_per_word; - if (pixels_per_buffer % pixels_per_word) { - buffer_size += 1; - } - } - - // Allocated and shared as a uint32_t array so the compiler knows the - // alignment everywhere. - uint32_t buffer[buffer_size]; - volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1; - uint32_t mask[mask_length]; - uint16_t remaining_rows = displayio_area_height(&clipped); - - for (uint16_t j = 0; j < subrectangles; j++) { - displayio_area_t subrectangle = { - .x1 = clipped.x1, - .y1 = clipped.y1 + rows_per_buffer * j, - .x2 = clipped.x2, - .y2 = clipped.y1 + rows_per_buffer * (j + 1) - }; - if (remaining_rows < rows_per_buffer) { - subrectangle.y2 = subrectangle.y1 + remaining_rows; - } - remaining_rows -= rows_per_buffer; - - displayio_display_begin_transaction(display); - displayio_display_set_region_to_update(display, &subrectangle); - displayio_display_end_transaction(display); - - uint16_t subrectangle_size_bytes; - if (display->colorspace.depth >= 8) { - subrectangle_size_bytes = displayio_area_size(&subrectangle) * (display->colorspace.depth / 8); - } else { - subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / display->colorspace.depth); - } - - for (uint16_t k = 0; k < mask_length; k++) { - mask[k] = 0x00000000; - } - for (uint16_t k = 0; k < buffer_size; k++) { - buffer[k] = 0x00000000; - } - - displayio_display_fill_area(display, &subrectangle, mask, buffer); - - if (!displayio_display_begin_transaction(display)) { - // Can't acquire display bus; skip the rest of the data. Try next display. - return false; - } - displayio_display_send_pixels(display, (uint8_t*) buffer, subrectangle_size_bytes); - displayio_display_end_transaction(display); - - // TODO(tannewt): Make refresh displays faster so we don't starve other - // background tasks. - usb_background(); - } - return true; -} - -// Check for recursive calls to displayio_refresh_displays. -bool refresh_displays_in_progress = false; - -void displayio_refresh_displays(void) { +void displayio_background(void) { if (mp_hal_is_interrupted()) { return; } @@ -121,12 +32,12 @@ void displayio_refresh_displays(void) { return; } - if (refresh_displays_in_progress) { + if (displayio_background_in_progress) { // Don't allow recursive calls to this routine. return; } - refresh_displays_in_progress = true; + displayio_background_in_progress = true; for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { if (displays[i].display.base.type == NULL || displays[i].display.base.type == &mp_type_NoneType) { @@ -134,54 +45,14 @@ void displayio_refresh_displays(void) { continue; } if (displays[i].display.base.type == &displayio_display_type) { - displayio_display_obj_t* display = &displays[i].display; - displayio_display_update_backlight(display); - - // Time to refresh at specified frame rate? - if (!displayio_display_frame_queued(display)) { - // Too soon. Try next display. - continue; - } - if (!displayio_display_begin_transaction(display)) { - // Can't acquire display bus; skip updating this display. Try next display. - continue; - } - displayio_display_end_transaction(display); - displayio_display_start_refresh(display); - const displayio_area_t* current_area = displayio_display_get_refresh_areas(display); - while (current_area != NULL) { - refresh_area(display, current_area); - current_area = current_area->next; - } - displayio_display_finish_refresh(display); - } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { - displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; - // Time to refresh at specified frame rate? - if (!displayio_epaperdisplay_frame_queued(display)) { - // Too soon. Try next display. - continue; - } - if (!displayio_epaperdisplay_bus_free(display)) { - // Can't acquire display bus; skip updating this display. Try next display. - continue; - } - const displayio_area_t* current_area = displayio_epaperdisplay_get_refresh_areas(display); - if (current_area == NULL) { - continue; - } - displayio_epaperdisplay_start_refresh(display); - while (current_area != NULL) { - displayio_epaperdisplay_refresh_area(display, current_area); - current_area = current_area->next; - } - displayio_epaperdisplay_finish_refresh(display); + displayio_display_background(&displays[i].display); + } else if (displays[i].epaperdisplay.base.type == &displayio_epaperdisplay_type) { + displayio_epaperdisplay_background(&displays[i].epaperdisplay); } - - frame_count++; } // All done. - refresh_displays_in_progress = false; + displayio_background_in_progress = false; } void common_hal_displayio_release_displays(void) { @@ -245,7 +116,7 @@ void reset_displays(void) { ((uint32_t) i2c->bus) > ((uint32_t) &displays + CIRCUITPY_DISPLAY_LIMIT)) { busio_i2c_obj_t* original_i2c = i2c->bus; #if BOARD_I2C - // We don't need to move original_i2c if it is the board.SPI object because it is + // We don't need to move original_i2c if it is the board.I2C object because it is // statically allocated already. (Doing so would also make it impossible to reference in // a subsequent VM run.) if (original_i2c == common_hal_board_get_i2c()) { diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index 95eefbdd99..e78bc61ce4 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -50,7 +50,7 @@ extern primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; extern displayio_group_t circuitpython_splash; -void displayio_refresh_displays(void); +void displayio_background(void); void reset_displays(void); void displayio_gc_collect(void); From 36a23e0fe3914b43645e51bf23a4d8bfec2db2c9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 16 Aug 2019 18:34:00 -0700 Subject: [PATCH 06/41] Rework refresh API and factor common display stuff out NOT TESTED! Just compiles Fixes #1691 --- ports/atmel-samd/Makefile | 3 +- .../boards/hallowing_m0_express/board.c | 4 +- ports/atmel-samd/boards/pybadge/board.c | 4 +- .../atmel-samd/boards/pybadge_airlift/board.c | 4 +- ports/atmel-samd/boards/pygamer/board.c | 4 +- .../atmel-samd/boards/pygamer_advance/board.c | 4 +- ports/atmel-samd/boards/pyportal/board.c | 4 +- .../atmel-samd/boards/pyportal_titano/board.c | 4 +- ports/nrf/Makefile | 3 +- ports/stm32f4/Makefile | 3 +- py/circuitpy_defns.mk | 6 + shared-bindings/_stage/__init__.c | 10 +- shared-bindings/displayio/Display.c | 54 +- shared-bindings/displayio/Display.h | 23 +- shared-bindings/displayio/EPaperDisplay.c | 10 +- shared-bindings/displayio/EPaperDisplay.h | 19 +- shared-module/_stage/__init__.c | 4 +- shared-module/displayio/Display.c | 485 ++++++------------ shared-module/displayio/Display.h | 27 +- shared-module/displayio/EPaperDisplay.c | 350 +++---------- shared-module/displayio/EPaperDisplay.h | 28 +- shared-module/displayio/__init__.c | 10 +- shared-module/displayio/display_core.c | 309 +++++++++++ shared-module/displayio/display_core.h | 90 ++++ 24 files changed, 729 insertions(+), 733 deletions(-) create mode 100644 shared-module/displayio/display_core.c create mode 100644 shared-module/displayio/display_core.h diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 8e3fe94606..11e6874edd 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -289,7 +289,8 @@ SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix common-hal/, $(SRC_COMMON_HAL)) SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE)) + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) SRC_S = supervisor/$(CHIP_FAMILY)_cpu.s diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index c12431f8b2..b4c54062f6 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -106,7 +106,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index e30b901b04..37f7991d15 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -108,7 +108,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pybadge_airlift/board.c b/ports/atmel-samd/boards/pybadge_airlift/board.c index 38fb33886a..7622de6f08 100644 --- a/ports/atmel-samd/boards/pybadge_airlift/board.c +++ b/ports/atmel-samd/boards/pybadge_airlift/board.c @@ -86,7 +86,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index 5ccf3fc509..b33ae4fb06 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -108,7 +108,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pygamer_advance/board.c b/ports/atmel-samd/boards/pygamer_advance/board.c index 72d4dda8dd..8eb501243f 100644 --- a/ports/atmel-samd/boards/pygamer_advance/board.c +++ b/ports/atmel-samd/boards/pygamer_advance/board.c @@ -86,7 +86,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index a5de1d1454..2a72897784 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -98,7 +98,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index 0ed1010a1c..a18bb380bb 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -118,7 +118,9 @@ void board_init(void) { 1.0f, // brightness (ignored) true, // auto_brightness false, // single_byte_bounds - false); // data_as_commands + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 9a461f9d82..6ec1600881 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -192,7 +192,8 @@ SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix common-hal/, $(SRC_COMMON_HAL)) SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE)) + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) SRC_S = supervisor/cpu.s diff --git a/ports/stm32f4/Makefile b/ports/stm32f4/Makefile index 7f07444434..c75a6c7ee4 100755 --- a/ports/stm32f4/Makefile +++ b/ports/stm32f4/Makefile @@ -216,7 +216,8 @@ SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix common-hal/, $(SRC_COMMON_HAL)) SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE)) + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d0f0cf7dc9..e7b9175128 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -364,6 +364,12 @@ SRC_SHARED_MODULE_ALL += \ touchio/__init__.c endif +# All possible sources are listed here, and are filtered by SRC_PATTERNS. +SRC_SHARED_MODULE_INTERNAL = \ +$(filter $(SRC_PATTERNS), \ + displayio/display_core.c \ +) + ifeq ($(INTERNAL_LIBM),1) SRC_LIBM = \ $(addprefix lib/,\ diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 6096f6b6dd..1d970cce4b 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -30,6 +30,7 @@ #include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/Display.h" #include "shared-module/_stage/__init__.h" +#include "shared-module/displayio/display_core.h" #include "Layer.h" #include "Text.h" @@ -95,7 +96,8 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { scale = mp_obj_get_int(args[7]); } - while (!displayio_display_begin_transaction(display)) { + // TODO: Everything below should be in shared-module because it's not argument parsing. + while (!displayio_display_core_begin_transaction(&display->core)) { RUN_BACKGROUND_TASKS; } displayio_area_t area; @@ -103,12 +105,12 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { area.y1 = y0; area.x2 = x1; area.y2 = y1; - displayio_display_set_region_to_update(display, &area); + displayio_display_core_set_region_to_update(&display->core, display->set_column_command, display->set_row_command, NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area); - display->send(display->bus, true, &display->write_ram_command, 1); + display->core.send(display->core.bus, true, true, &display->write_ram_command, 1); render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, display, scale); - displayio_display_end_transaction(display); + displayio_display_core_end_transaction(&display->core); return mp_const_none; } diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index fb9bfff852..ded4119ca5 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -51,7 +51,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum. //| -//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, bytes_per_cell=1, reverse_pixels_in_byte=False, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False) +//| .. class:: Display(display_bus, init_sequence, *, width, height, colstart=0, rowstart=0, rotation=0, color_depth=16, grayscale=False, pixels_in_byte_share_row=True, bytes_per_cell=1, reverse_pixels_in_byte=False, set_column_command=0x2a, set_row_command=0x2b, write_ram_command=0x2c, set_vertical_scroll=0, backlight_pin=None, brightness_command=None, brightness=1.0, auto_brightness=False, single_byte_bounds=False, data_as_commands=False, auto_refresh=True, native_frames_per_second=60) //| //| Create a Display object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| @@ -102,9 +102,11 @@ //| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. //| :param bool single_byte_bounds: Display column and row commands use single bytes //| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this. +//| :param bool auto_refresh: Automatically refresh the screen +//| :param int native_frames_per_second: Number of display refreshes per second that occur with the given init_sequence. //| STATIC mp_obj_t displayio_display_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_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands }; + enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_color_depth, ARG_grayscale, ARG_pixels_in_byte_share_row, ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -128,6 +130,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a { MP_QSTR_auto_brightness, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_single_byte_bounds, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_data_as_commands, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, + { MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -178,7 +182,9 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a brightness, args[ARG_auto_brightness].u_bool, args[ARG_single_byte_bounds].u_bool, - args[ARG_data_as_commands].u_bool + args[ARG_data_as_commands].u_bool, + args[ARG_auto_refresh].u_bool, + args[ARG_native_frames_per_second].u_int ); return self; @@ -214,14 +220,28 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| .. method:: refresh(*, target_frames_per_second=None, minimum_frames_per_second=1) //| -//| Waits for the target frame rate and then refreshes the display. If the call is too late for the given target frame rate, then the refresh returns immediately without updating the screen to hopefully help getting caught up. If the current frame rate is below the minimum frame rate, then an exception will be raised. +//| When auto refresh is off, waits for the target frame rate and then refreshes the display. If +//| the call is too late for the given target frame rate, then the refresh returns immediately +//| without updating the screen to hopefully help getting caught up. If the current frame rate +//| is below the minimum frame rate, then an exception will be raised. //| -STATIC mp_obj_t displayio_display_obj_refresh(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - common_hal_displayio_display_refresh(self); +//| When auto refresh is on, updates the display immediately. (The display will also update +//| without calls to this.) +//| +STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_target_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 60} }, + { MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + displayio_display_obj_t *self = native_display(pos_args[0]); + common_hal_displayio_display_refresh(self, 1000 / args[ARG_target_frames_per_second].u_int, 1000 / args[ARG_minimum_frames_per_second].u_int); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_refresh_soon_obj, displayio_display_obj_refresh_soon); +MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh); //| .. attribute:: auto_refresh //| @@ -376,7 +396,7 @@ const mp_obj_property_t displayio_display_rotation_obj = { //| STATIC mp_obj_t displayio_display_obj_get_bus(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); - return self->bus; + return common_hal_displayio_display_get_bus(self); } MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_bus_obj, displayio_display_obj_get_bus); @@ -412,18 +432,18 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po if (bufinfo.typecode != BYTEARRAY_TYPECODE) { mp_raise_ValueError(translate("Buffer is not a bytearray.")); } - if (self->colorspace.depth != 16) { + if (self->core.colorspace.depth != 16) { mp_raise_ValueError(translate("Display must have a 16 bit colorspace.")); } displayio_area_t area = { .x1 = 0, .y1 = y, - .x2 = self->width, + .x2 = self->core.width, .y2 = y + 1 }; - uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->colorspace.depth; - uint16_t buffer_size = self->width / pixels_per_word; + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth; + uint16_t buffer_size = self->core.width / pixels_per_word; uint16_t pixels_per_buffer = displayio_area_size(&area); if (pixels_per_buffer % pixels_per_word) { buffer_size += 1; @@ -440,7 +460,7 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po mask[k] = 0x00000000; } - displayio_display_fill_area(self, &area, mask, result_buffer); + displayio_display_core_fill_area(&self->core, &area, mask, result_buffer); return result; } else { mp_raise_ValueError(translate("Buffer is too small")); @@ -448,13 +468,9 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po } MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row); - - - STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) }, - { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_display_refresh_soon_obj) }, - { MP_ROM_QSTR(MP_QSTR_wait_for_frame), MP_ROM_PTR(&displayio_display_wait_for_frame_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_display_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&displayio_display_fill_row_obj) }, { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&displayio_display_auto_refresh_obj) }, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 0d416b8688..06c848d0d3 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -44,24 +44,29 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll, uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command, - mp_float_t brightness, bool auto_brightness, bool auto_refresh, uint8_t frames_per_second, - bool single_byte_bounds, bool data_as_commands); + mp_float_t brightness, bool auto_brightness, + bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second); -bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); +bool common_hal_displayio_display_show(displayio_display_obj_t* self, + displayio_group_t* root_group); -void common_hal_displayio_display_refresh(displayio_display_obj_t* self); +// Times in ms. +void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_frame_time, uint32_t maximum_frame_time); -bool displayio_display_begin_transaction(displayio_display_obj_t* self); -void displayio_display_end_transaction(displayio_display_obj_t* self); - -bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); -void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); +bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self); +void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self, bool auto_refresh); uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self); uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self); uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self); +bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); +void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); + mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self); bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness); +mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t* self); + + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 4b00240d1d..8f3c16efd4 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -208,7 +208,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisp //| Refreshes the display immediately or raises an exception if too soon. Use //| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur. //| -STATIC mp_obj_t displayio_epaperdisplay_obj_refresh_soon(mp_obj_t self_in) { +STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); bool ok = common_hal_displayio_epaperdisplay_refresh(self); if (!ok) { @@ -216,7 +216,7 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_refresh_soon(mp_obj_t self_in) { } return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_soon_obj, displayio_epaperdisplay_obj_refresh_soon); +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperdisplay_obj_refresh); //| .. attribute:: time_to_refresh //| @@ -225,7 +225,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_soon_obj, displayio_ep //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); - return mp_obj_new_float(common_hal_displayio_epaperdisplay_get_time_to_refresh(self)); + return mp_obj_new_float(common_hal_displayio_epaperdisplay_get_time_to_refresh(self) / 1000.0); } MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_time_to_refresh_obj, displayio_epaperdisplay_obj_get_time_to_refresh); @@ -279,7 +279,7 @@ const mp_obj_property_t displayio_epaperdisplay_height_obj = { //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_bus(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); - return self->bus; + return common_hal_displayio_epaperdisplay_get_bus(self); } MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_bus_obj, displayio_epaperdisplay_obj_get_bus); @@ -293,7 +293,7 @@ const mp_obj_property_t displayio_epaperdisplay_bus_obj = { STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, - { MP_ROM_QSTR(MP_QSTR_refresh_soon), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_epaperdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_epaperdisplay_height_obj) }, diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 87feb4da08..2a3cb921f9 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -46,23 +46,12 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select); -int32_t common_hal_displayio_epaperdisplay_wait_for_frame(displayio_epaperdisplay_obj_t* self); +bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self); bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self, displayio_group_t* root_group); -bool displayio_epaperdisplay_begin_transaction(displayio_epaperdisplay_obj_t* self); -void displayio_epaperdisplay_end_transaction(displayio_epaperdisplay_obj_t* self); - -bool displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self); - -mp_float_t displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); - -// The second point of the region is exclusive. -void displayio_epaperdisplay_set_region_to_update(displayio_epaperdisplay_obj_t* self, displayio_area_t* area); -bool displayio_epaperdisplay_frame_queued(displayio_epaperdisplay_obj_t* self); - -void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self); -void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length); +// Returns time in milliseconds. +uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); bool common_hal_displayio_epaperdisplay_get_auto_brightness(displayio_epaperdisplay_obj_t* self); void common_hal_displayio_epaperdisplay_set_auto_brightness(displayio_epaperdisplay_obj_t* self, bool auto_brightness); @@ -73,4 +62,6 @@ uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_o mp_float_t common_hal_displayio_epaperdisplay_get_brightness(displayio_epaperdisplay_obj_t* self); bool common_hal_displayio_epaperdisplay_set_brightness(displayio_epaperdisplay_obj_t* self, mp_float_t brightness); +mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index ca71b758e6..bfef165e7b 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -57,7 +57,7 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, index += 1; // The buffer is full, send it. if (index >= buffer_size) { - display->send(display->bus, false, ((uint8_t*)buffer), + display->core.send(display->core.bus, false, false, ((uint8_t*)buffer), buffer_size * 2); index = 0; } @@ -67,6 +67,6 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, } // Send the remaining data. if (index) { - display->send(display->bus, false, ((uint8_t*)buffer), index * 2); + display->core.send(display->core.bus, false, false, ((uint8_t*)buffer), index * 2); } } diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index fafb35f43c..86800328fe 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -33,7 +33,9 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/time/__init__.h" #include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/display_core.h" #include "supervisor/shared/display.h" +#include "supervisor/usb.h" #include #include @@ -41,48 +43,34 @@ #include "tick.h" void common_hal_displayio_display_construct(displayio_display_obj_t* self, - mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, uint16_t rotation, - uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, - uint8_t set_column_command, uint8_t set_row_command, - uint8_t write_ram_command, uint8_t set_vertical_scroll, uint8_t* init_sequence, uint16_t init_sequence_len, - const mcu_pin_obj_t* backlight_pin, uint16_t brightness_command, mp_float_t brightness, bool auto_brightness, - bool single_byte_bounds, bool data_as_commands) { - self->colorspace.depth = color_depth; - self->colorspace.grayscale = grayscale; - self->colorspace.pixels_in_byte_share_row = pixels_in_byte_share_row; - self->colorspace.bytes_per_cell = bytes_per_cell; - self->colorspace.reverse_pixels_in_byte = reverse_pixels_in_byte; + mp_obj_t bus, uint16_t width, uint16_t height, int16_t colstart, int16_t rowstart, + uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, + uint8_t bytes_per_cell, bool reverse_pixels_in_byte, uint8_t set_column_command, + uint8_t set_row_command, uint8_t write_ram_command, uint8_t set_vertical_scroll, + uint8_t* init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t* backlight_pin, + uint16_t brightness_command, mp_float_t brightness, bool auto_brightness, + bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second) { + uint16_t ram_width = 0x100; + uint16_t ram_height = 0x100; + if (single_byte_bounds) { + ram_width = 0xff; + ram_height = 0xff; + } + displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, + color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte); + self->set_column_command = set_column_command; self->set_row_command = set_row_command; self->write_ram_command = write_ram_command; - self->refresh = false; - self->current_group = NULL; - self->colstart = colstart; - self->rowstart = rowstart; self->brightness_command = brightness_command; self->auto_brightness = auto_brightness; self->data_as_commands = data_as_commands; - self->single_byte_bounds = single_byte_bounds; - if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { - self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; - self->send = common_hal_displayio_parallelbus_send; - self->end_transaction = common_hal_displayio_parallelbus_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { - self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; - self->send = common_hal_displayio_fourwire_send; - self->end_transaction = common_hal_displayio_fourwire_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { - self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; - self->send = common_hal_displayio_i2cdisplay_send; - self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; - } else { - mp_raise_ValueError(translate("Unsupported display bus type")); - } - self->bus = bus; + self->native_frames_per_second = native_frames_per_second; + self->native_frame_time = 1000 / native_frames_per_second; uint32_t i = 0; - while (!self->begin_transaction(self->bus)) { + while (!displayio_display_core_begin_transaction(&self->core)) { RUN_BACKGROUND_TASKS; } while (i < init_sequence_len) { @@ -95,10 +83,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, uint8_t full_command[data_size + 1]; full_command[0] = cmd[0]; memcpy(full_command + 1, data, data_size); - self->send(self->bus, true, true, full_command, data_size + 1); + self->core.send(self->core.bus, true, true, full_command, data_size + 1); } else { - self->send(self->bus, true, true, cmd, 1); - self->send(self->bus, false, false, data, data_size); + self->core.send(self->core.bus, true, true, cmd, 1); + self->core.send(self->core.bus, false, false, data, data_size); } uint16_t delay_length_ms = 10; if (delay) { @@ -111,33 +99,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, common_hal_time_delay_ms(delay_length_ms); i += 2 + data_size; } - self->end_transaction(self->bus); + self->core.end_transaction(self->core.bus); supervisor_start_terminal(width, height); - self->width = width; - self->height = height; - self->rotation = rotation % 360; - self->transform.x = 0; - self->transform.y = 0; - self->transform.scale = 1; - self->transform.mirror_x = false; - self->transform.mirror_y = false; - self->transform.transpose_xy = false; - if (rotation == 0 || rotation == 180) { - if (rotation == 180) { - self->transform.mirror_x = true; - self->transform.mirror_y = true; - } - } else { - self->transform.transpose_xy = true; - if (rotation == 270) { - self->transform.mirror_y = true; - } else { - self->transform.mirror_x = true; - } - } - // Always set the backlight type in case we're reusing memory. self->backlight_inout.base.type = &mp_type_NoneType; if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) { @@ -158,101 +123,98 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, self->current_brightness = -1.0; } - self->area.x1 = 0; - self->area.y1 = 0; - self->area.next = NULL; - - self->transform.dx = 1; - self->transform.dy = 1; - if (self->transform.transpose_xy) { - self->area.x2 = height; - self->area.y2 = width; - if (self->transform.mirror_x) { - self->transform.x = height; - self->transform.dx = -1; - } - if (self->transform.mirror_y) { - self->transform.y = width; - self->transform.dy = -1; - } - } else { - self->area.x2 = width; - self->area.y2 = height; - if (self->transform.mirror_x) { - self->transform.x = width; - self->transform.dx = -1; - } - if (self->transform.mirror_y) { - self->transform.y = height; - self->transform.dy = -1; - } - } - // Set the group after initialization otherwise we may send pixels while we delay in // initialization. common_hal_displayio_display_show(self, &circuitpython_splash); } bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group) { - if (root_group == NULL) { - if (!circuitpython_splash.in_group) { - root_group = &circuitpython_splash; - } else if (self->current_group == &circuitpython_splash) { - return false; - } - } - if (root_group == self->current_group) { - return true; - } - if (root_group != NULL && root_group->in_group) { - return false; - } - if (self->current_group != NULL) { - self->current_group->in_group = false; - } - - if (root_group != NULL) { - displayio_group_update_transform(root_group, &self->transform); - root_group->in_group = true; - } - self->current_group = root_group; - self->full_refresh = true; - common_hal_displayio_display_refresh_soon(self); - return true; + return displayio_display_core_show(&self->core, root_group); } -const displayio_area_t* displayio_display_get_refresh_areas(displayio_display_obj_t *self) { - if (self->full_refresh) { - self->area.next = NULL; - return &self->area; +uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self){ + return displayio_display_core_get_width(&self->core); +} + +uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self){ + return displayio_display_core_get_height(&self->core); +} + +bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self) { + return self->auto_brightness; +} + +void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness) { + self->auto_brightness = auto_brightness; +} + +mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self) { + return self->current_brightness; +} + +bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness) { + self->updating_backlight = true; + bool ok = false; + if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { + common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness)); + ok = true; + } else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) { + common_hal_digitalio_digitalinout_set_value(&self->backlight_inout, brightness > 0.99); + ok = true; + } else if (self->brightness_command != NO_BRIGHTNESS_COMMAND) { + ok = displayio_display_core_begin_transaction(&self->core); + if (ok) { + if (self->data_as_commands) { + uint8_t set_brightness[2] = {self->brightness_command, (uint8_t) (0xff * brightness)}; + self->core.send(self->core.bus, true, true, set_brightness, 2); + } else { + uint8_t command = self->brightness_command; + uint8_t hex_brightness = 0xff * brightness; + self->core.send(self->core.bus, true, true, &command, 1); + self->core.send(self->core.bus, false, false, &hex_brightness, 1); + } + displayio_display_core_end_transaction(&self->core); + } + + } + self->updating_backlight = false; + if (ok) { + self->current_brightness = brightness; + } + return ok; +} + +mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t* self) { + return self->core.bus; +} + +STATIC const displayio_area_t* _get_refresh_areas(displayio_display_obj_t *self) { + if (self->core.full_refresh) { + self->core.area.next = NULL; + return &self->core.area; } else { - if (self->current_group == NULL || self->current_group->base.type != &displayio_group_type) { - asm("bkpt"); - } - return displayio_group_get_refresh_areas(self->current_group, NULL); + return displayio_group_get_refresh_areas(self->core.current_group, NULL); } } -int32_t common_hal_displayio_display_wait_for_frame(displayio_display_obj_t* self) { - uint64_t last_refresh = self->last_refresh; - // Don't try to refresh if we got an exception. - while (last_refresh == self->last_refresh && MP_STATE_VM(mp_pending_exception) == NULL) { - RUN_BACKGROUND_TASKS; +STATIC void _send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length) { + if (!self->data_as_commands) { + self->core.send(self->core.bus, true, true, &self->write_ram_command, 1); } - return 0; + self->core.send(self->core.bus, false, false, pixels, length); } -STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_t* area) { +STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t* area) { uint16_t buffer_size = 128; // In uint32_ts displayio_area_t clipped; // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. - if (!displayio_display_clip_area(display, area, &clipped)) { + if (!displayio_display_core_clip_area(&self->core, area, &clipped)) { return true; } uint16_t subrectangles = 1; uint16_t rows_per_buffer = displayio_area_height(&clipped); - uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / display->colorspace.depth; + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth; uint16_t pixels_per_buffer = displayio_area_size(&clipped); if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); @@ -260,8 +222,8 @@ STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_ rows_per_buffer = 1; } // If pixels are packed by column then ensure rows_per_buffer is on a byte boundary. - if (display->colorspace.depth < 8 && !display->colorspace.pixels_in_byte_share_row) { - uint8_t pixels_per_byte = 8 / display->colorspace.depth; + if (self->core.colorspace.depth < 8 && !self->core.colorspace.pixels_in_byte_share_row) { + uint8_t pixels_per_byte = 8 / self->core.colorspace.depth; if (rows_per_buffer % pixels_per_byte != 0) { rows_per_buffer -= rows_per_buffer % pixels_per_byte; } @@ -296,15 +258,13 @@ STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_ } remaining_rows -= rows_per_buffer; - displayio_display_begin_transaction(display); - displayio_display_set_region_to_update(display, &subrectangle); - displayio_display_end_transaction(display); + displayio_display_core_set_region_to_update(&self->core, self->set_column_command, self->set_row_command, NO_COMMAND, NO_COMMAND, self->data_as_commands, false, &subrectangle); uint16_t subrectangle_size_bytes; - if (display->colorspace.depth >= 8) { - subrectangle_size_bytes = displayio_area_size(&subrectangle) * (display->colorspace.depth / 8); + if (self->core.colorspace.depth >= 8) { + subrectangle_size_bytes = displayio_area_size(&subrectangle) * (self->core.colorspace.depth / 8); } else { - subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / display->colorspace.depth); + subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); } for (uint16_t k = 0; k < mask_length; k++) { @@ -314,14 +274,16 @@ STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_ buffer[k] = 0x00000000; } - displayio_display_fill_area(display, &subrectangle, mask, buffer); + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); - if (!displayio_display_begin_transaction(display)) { - // Can't acquire display bus; skip the rest of the data. Try next display. + // Can't acquire display bus; skip the rest of the data. + if (!displayio_display_core_bus_free(&self->core)) { return false; } - displayio_display_send_pixels(display, (uint8_t*) buffer, subrectangle_size_bytes); - displayio_display_end_transaction(display); + + displayio_display_core_begin_transaction(&self->core); + _send_pixels(self, (uint8_t*) buffer, subrectangle_size_bytes); + displayio_display_core_end_transaction(&self->core); // TODO(tannewt): Make refresh displays faster so we don't starve other // background tasks. @@ -330,182 +292,59 @@ STATIC bool refresh_area(displayio_display_obj_t* display, const displayio_area_ return true; } -STATIC void refresh_display(displayio_display_obj_t* self) { - if (!displayio_display_begin_transaction(self)) { +STATIC void _refresh_display(displayio_display_obj_t* self) { + if (!displayio_display_core_bus_free(&self->core)) { // Can't acquire display bus; skip updating this display. Try next display. - continue; + return; } - displayio_display_end_transaction(self); - displayio_display_start_refresh(self); - const displayio_area_t* current_area = displayio_display_get_refresh_areas(self); + displayio_display_core_start_refresh(&self->core); + const displayio_area_t* current_area = _get_refresh_areas(self); while (current_area != NULL) { - refresh_area(self, current_area); + _refresh_area(self, current_area); current_area = current_area->next; } - displayio_display_finish_refresh(self); -} - -void common_hal_displayio_display_refresh(displayio_display_obj_t* self) { - // Time to refresh at specified frame rate? - while (!displayio_display_frame_queued(self)) { - // Too soon. Try next display. - continue; - } - refresh_display(self); -} - -bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self) { - return self->auto_brightness; -} - -uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self){ - return self->width; -} - -uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self){ - return self->height; + displayio_display_core_finish_refresh(&self->core); } uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self){ - return self->rotation; + return self->core.rotation; } -void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness) { - self->auto_brightness = auto_brightness; -} - -mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t* self) { - return self->current_brightness; -} - -bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, mp_float_t brightness) { - self->updating_backlight = true; - bool ok = false; - if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { - common_hal_pulseio_pwmout_set_duty_cycle(&self->backlight_pwm, (uint16_t) (0xffff * brightness)); - ok = true; - } else if (self->backlight_inout.base.type == &digitalio_digitalinout_type) { - common_hal_digitalio_digitalinout_set_value(&self->backlight_inout, brightness > 0.99); - ok = true; - } else if (self->brightness_command != NO_BRIGHTNESS_COMMAND) { - ok = self->begin_transaction(self->bus); - if (ok) { - if (self->data_as_commands) { - uint8_t set_brightness[2] = {self->brightness_command, (uint8_t) (0xff * brightness)}; - self->send(self->bus, true, true, set_brightness, 2); - } else { - uint8_t command = self->brightness_command; - uint8_t hex_brightness = 0xff * brightness; - self->send(self->bus, true, true, &command, 1); - self->send(self->bus, false, false, &hex_brightness, 1); - } - self->end_transaction(self->bus); +void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_frame_time, uint32_t maximum_frame_time) { + if (!self->auto_refresh) { + uint64_t current_time = ticks_ms; + uint32_t current_frame_time = current_time - self->core.last_refresh; + // Test to see if the real frame time is below our minimum. + if (current_frame_time > maximum_frame_time) { + mp_raise_RuntimeError(translate("Below minimum frame rate")); } - - } - self->updating_backlight = false; - if (ok) { - self->current_brightness = brightness; - } - return ok; -} - -bool displayio_display_begin_transaction(displayio_display_obj_t* self) { - return self->begin_transaction(self->bus); -} - -void displayio_display_end_transaction(displayio_display_obj_t* self) { - self->end_transaction(self->bus); -} - -void displayio_display_set_region_to_update(displayio_display_obj_t* self, displayio_area_t* area) { - uint16_t x1 = area->x1; - uint16_t x2 = area->x2; - uint16_t y1 = area->y1; - uint16_t y2 = area->y2; - // Collapse down the dimension where multiple pixels are in a byte. - if (self->colorspace.depth < 8) { - uint8_t pixels_per_byte = 8 / self->colorspace.depth; - if (self->colorspace.pixels_in_byte_share_row) { - x1 /= pixels_per_byte * self->colorspace.bytes_per_cell; - x2 /= pixels_per_byte * self->colorspace.bytes_per_cell; - } else { - y1 /= pixels_per_byte * self->colorspace.bytes_per_cell; - y2 /= pixels_per_byte * self->colorspace.bytes_per_cell; + uint32_t current_call_time = current_time - self->last_refresh_call; + self->last_refresh_call = current_time; + // Skip the actual refresh to help catch up. + if (current_call_time > target_frame_time) { + return; + } + uint32_t remaining_time = target_frame_time - (current_frame_time % target_frame_time); + // We're ahead of the game so wait until we align with the frame rate. + while (ticks_ms - self->last_refresh_call < remaining_time) { + #ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP ; + #endif } } - - // Set column. - uint8_t data[5]; - data[0] = self->set_column_command; - uint8_t data_length = 1; - if (!self->data_as_commands) { - self->send(self->bus, true, true, data, 1); - data_length = 0; - } - if (self->single_byte_bounds) { - data[data_length++] = x1 + self->colstart; - data[data_length++] = x2 - 1 + self->colstart; - } else { - x1 += self->colstart; - x2 += self->colstart - 1; - data[data_length++] = x1 >> 8; - data[data_length++] = x1 & 0xff; - data[data_length++] = x2 >> 8; - data[data_length++] = x2 & 0xff; - } - self->send(self->bus, self->data_as_commands, self->data_as_commands, data, data_length); - - // Set row. - data[0] = self->set_row_command; - data_length = 1; - if (!self->data_as_commands) { - self->send(self->bus, true, true, data, 1); - data_length = 0; - } - if (self->single_byte_bounds) { - data[data_length++] = y1 + self->rowstart; - data[data_length++] = y2 - 1 + self->rowstart; - } else { - y1 += self->rowstart; - y2 += self->rowstart - 1; - data[data_length++] = y1 >> 8; - data[data_length++] = y1 & 0xff; - data[data_length++] = y2 >> 8; - data[data_length++] = y2 & 0xff; - } - self->send(self->bus, self->data_as_commands, self->data_as_commands, data, data_length); + _refresh_display(self); } -void displayio_display_start_refresh(displayio_display_obj_t* self) { - self->last_refresh = ticks_ms; +bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self) { + return self->auto_refresh; } -bool displayio_display_frame_queued(displayio_display_obj_t* self) { - if (self->current_group == NULL) { - return false; - } - // Refresh at ~60 fps. - return (ticks_ms - self->last_refresh) > 16; +void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self, + bool auto_refresh) { + self->auto_refresh = auto_refresh; } -void displayio_display_finish_refresh(displayio_display_obj_t* self) { - if (self->current_group != NULL) { - displayio_group_finish_refresh(self->current_group); - } - self->refresh = false; - self->full_refresh = false; - self->last_refresh = ticks_ms; -} - -void displayio_display_send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length) { - if (!self->data_as_commands) { - self->send(self->bus, true, true, &self->write_ram_command, 1); - } - self->send(self->bus, false, false, pixels, length); -} - -void displayio_display_update_backlight(displayio_display_obj_t* self) { +STATIC void _update_backlight(displayio_display_obj_t* self) { if (!self->auto_brightness || self->updating_backlight) { return; } @@ -520,17 +359,15 @@ void displayio_display_update_backlight(displayio_display_obj_t* self) { } void displayio_display_background(displayio_display_obj_t* self) { - displayio_display_update_backlight(self); + _update_backlight(self); - if (self->auto_refresh && (ticks_ms - self->last_refresh) > 16) { - display_refresh(self); + if (self->auto_refresh && (ticks_ms - self->core.last_refresh) > self->native_frame_time) { + _refresh_display(self); } } void release_display(displayio_display_obj_t* self) { - if (self->current_group != NULL) { - self->current_group->in_group = false; - } + release_display_core(&self->core); if (self->backlight_pwm.base.type == &pulseio_pwmout_type) { common_hal_pulseio_pwmout_reset_ok(&self->backlight_pwm); common_hal_pulseio_pwmout_deinit(&self->backlight_pwm); @@ -539,34 +376,6 @@ void release_display(displayio_display_obj_t* self) { } } -bool displayio_display_fill_area(displayio_display_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer) { - return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); -} - -bool displayio_display_clip_area(displayio_display_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped) { - bool overlaps = displayio_area_compute_overlap(&self->area, area, clipped); - if (!overlaps) { - return false; - } - // Expand the area if we have multiple pixels per byte and we need to byte - // align the bounds. - if (self->colorspace.depth < 8) { - uint8_t pixels_per_byte = 8 / self->colorspace.depth * self->colorspace.bytes_per_cell; - if (self->colorspace.pixels_in_byte_share_row) { - if (clipped->x1 % pixels_per_byte != 0) { - clipped->x1 -= clipped->x1 % pixels_per_byte; - } - if (clipped->x2 % pixels_per_byte != 0) { - clipped->x2 += pixels_per_byte - clipped->x2 % pixels_per_byte; - } - } else { - if (clipped->y1 % pixels_per_byte != 0) { - clipped->y1 -= clipped->y1 % pixels_per_byte; - } - if (clipped->y2 % pixels_per_byte != 0) { - clipped->y2 += pixels_per_byte - clipped->y2 % pixels_per_byte; - } - } - } - return true; +void displayio_display_collect_ptrs(displayio_display_obj_t* self) { + displayio_display_core_collect_ptrs(&self->core); } diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index db0a23012d..cff566a619 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -32,46 +32,33 @@ #include "shared-bindings/pulseio/PWMOut.h" #include "shared-module/displayio/area.h" - -typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); -typedef void (*display_bus_end_transaction)(mp_obj_t bus); +#include "shared-module/displayio/display_core.h" typedef struct { mp_obj_base_t base; - mp_obj_t bus; - displayio_group_t *current_group; - uint64_t last_refresh; - display_bus_begin_transaction begin_transaction; - display_bus_send send; - display_bus_end_transaction end_transaction; + displayio_display_core_t core; union { digitalio_digitalinout_obj_t backlight_inout; pulseio_pwmout_obj_t backlight_pwm; }; uint64_t last_backlight_refresh; - displayio_buffer_transform_t transform; - displayio_area_t area; + uint64_t last_refresh_call; mp_float_t current_brightness; - uint16_t width; - uint16_t height; - uint16_t rotation; - _displayio_colorspace_t colorspace; - int16_t colstart; - int16_t rowstart; uint16_t brightness_command; + uint16_t native_frames_per_second; + uint16_t native_frame_time; uint8_t set_column_command; uint8_t set_row_command; uint8_t write_ram_command; bool auto_refresh; - bool single_byte_bounds; bool data_as_commands; bool auto_brightness; bool updating_backlight; - bool full_refresh; // New group means we need to refresh the whole display. } displayio_display_obj_t; void displayio_display_background(displayio_display_obj_t* self); void release_display(displayio_display_obj_t* self); +void displayio_display_collect_ptrs(displayio_display_obj_t* self); + #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 434adbdf4e..6ff060a6a6 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -50,18 +50,14 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t set_current_column_command, uint16_t set_current_row_command, uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select) { - self->colorspace.depth = 1; - self->colorspace.grayscale = true; - self->colorspace.pixels_in_byte_share_row = true; - self->colorspace.bytes_per_cell = 1; - self->colorspace.reverse_pixels_in_byte = true; - if (highlight_color != 0x000000) { - self->colorspace.tricolor = true; - self->colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); - self->colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color); + self->core.colorspace.tricolor = true; + self->core.colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); + self->core.colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color); } + displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, 1, true, true, 1, true); + self->set_column_window_command = set_column_window_command; self->set_row_window_command = set_row_window_command; self->set_current_column_command = set_current_column_command; @@ -72,10 +68,6 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->color_bits_inverted = color_bits_inverted; self->refresh_display_command = refresh_display_command; self->busy_state = busy_state; - self->refresh = true; - self->current_group = NULL; - self->colstart = colstart; - self->rowstart = rowstart; self->refreshing = false; self->milliseconds_per_frame = seconds_per_frame * 1000; self->always_toggle_chip_select = always_toggle_chip_select; @@ -85,88 +77,6 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->stop_sequence = stop_sequence; self->stop_sequence_len = stop_sequence_len; - - if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { - self->bus_reset = common_hal_displayio_parallelbus_reset; - self->bus_free = common_hal_displayio_parallelbus_bus_free; - self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; - self->send = common_hal_displayio_parallelbus_send; - self->end_transaction = common_hal_displayio_parallelbus_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { - self->bus_reset = common_hal_displayio_fourwire_reset; - self->bus_free = common_hal_displayio_fourwire_bus_free; - self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; - self->send = common_hal_displayio_fourwire_send; - self->end_transaction = common_hal_displayio_fourwire_end_transaction; - } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { - self->bus_reset = common_hal_displayio_i2cdisplay_reset; - self->bus_free = common_hal_displayio_i2cdisplay_bus_free; - self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; - self->send = common_hal_displayio_i2cdisplay_send; - self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; - } else { - mp_raise_ValueError(translate("Unsupported display bus type")); - } - self->bus = bus; - - supervisor_start_terminal(width, height); - - self->width = width; - self->height = height; - rotation = rotation % 360; - self->transform.x = 0; - self->transform.y = 0; - self->transform.scale = 1; - self->transform.mirror_x = false; - self->transform.mirror_y = false; - self->transform.transpose_xy = false; - if (rotation == 0 || rotation == 180) { - if (rotation == 180) { - self->transform.mirror_x = true; - self->transform.mirror_y = true; - } - } else { - self->transform.transpose_xy = true; - if (rotation == 270) { - self->transform.mirror_y = true; - } else { - self->transform.mirror_x = true; - } - } - - self->ram_width = ram_width; - self->ram_height = ram_height; - - self->area.x1 = 0; - self->area.y1 = 0; - self->area.next = NULL; - - self->transform.dx = 1; - self->transform.dy = 1; - if (self->transform.transpose_xy) { - self->area.x2 = height; - self->area.y2 = width; - if (self->transform.mirror_x) { - self->transform.x = height; - self->transform.dx = -1; - } - if (self->transform.mirror_y) { - self->transform.y = width; - self->transform.dy = -1; - } - } else { - self->area.x2 = width; - self->area.y2 = height; - if (self->transform.mirror_x) { - self->transform.x = width; - self->transform.dx = -1; - } - if (self->transform.mirror_y) { - self->transform.y = height; - self->transform.dy = -1; - } - } - self->busy.base.type = &mp_type_NoneType; if (busy_pin != NULL) { self->busy.base.type = &digitalio_digitalinout_type; @@ -179,77 +89,37 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* // TODO: Clear } + supervisor_start_terminal(width, height); + // Set the group after initialization otherwise we may send pixels while we delay in // initialization. common_hal_displayio_epaperdisplay_show(self, &circuitpython_splash); } bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self, displayio_group_t* root_group) { - if (root_group == NULL && !circuitpython_splash.in_group) { - root_group = &circuitpython_splash; - } - if (root_group == self->current_group) { - return true; - } - if (root_group != NULL && root_group->in_group) { - return false; - } - if (self->current_group != NULL) { - self->current_group->in_group = false; - } - if (root_group != NULL) { - displayio_group_update_transform(root_group, &self->transform); - root_group->in_group = true; - self->current_group = root_group; - } - self->full_refresh = true; - return true; + return displayio_display_core_show(&self->core, root_group); } const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { const displayio_area_t* first_area; - if (self->current_group == NULL || self->current_group->base.type != &displayio_group_type) { - asm("bkpt"); - } - if (self->full_refresh) { - first_area = &self->area; + if (self->core.full_refresh) { + first_area = &self->core.area; } else { - first_area = displayio_group_get_refresh_areas(self->current_group, NULL); + first_area = displayio_group_get_refresh_areas(self->core.current_group, NULL); } if (first_area != NULL && self->set_row_window_command == NO_COMMAND) { - self->area.next = NULL; - return &self->area; + self->core.area.next = NULL; + return &self->core.area; } return first_area; } -int32_t common_hal_displayio_epaperdisplay_wait_for_frame(displayio_epaperdisplay_obj_t* self) { - uint64_t last_refresh = self->last_refresh; - // Don't try to refresh if we got an exception. - while (last_refresh == self->last_refresh && MP_STATE_VM(mp_pending_exception) == NULL) { - MICROPY_VM_HOOK_LOOP - } - return 0; -} - uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self){ - return self->width; + return displayio_display_core_get_width(&self->core); } uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self){ - return self->height; -} - -bool displayio_epaperdisplay_bus_free(displayio_epaperdisplay_obj_t *self) { - return self->bus_free(self->bus); -} - -bool displayio_epaperdisplay_begin_transaction(displayio_epaperdisplay_obj_t* self) { - return self->begin_transaction(self->bus); -} - -void displayio_epaperdisplay_end_transaction(displayio_epaperdisplay_obj_t* self) { - self->end_transaction(self->bus); + return displayio_display_core_get_height(&self->core); } STATIC void wait_for_busy(displayio_epaperdisplay_obj_t* self) { @@ -271,10 +141,10 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool shou bool delay = (data_size & DELAY) != 0; data_size &= ~DELAY; uint8_t *data = cmd + 2; - self->begin_transaction(self->bus); - self->send(self->bus, true, self->always_toggle_chip_select, cmd, 1); - self->send(self->bus, false, self->always_toggle_chip_select, data, data_size); - self->end_transaction(self->bus); + displayio_display_core_begin_transaction(&self->core); + self->core.send(self->core.bus, true, self->always_toggle_chip_select, cmd, 1); + self->core.send(self->core.bus, false, self->always_toggle_chip_select, data, data_size); + displayio_display_core_end_transaction(&self->core); uint16_t delay_length_ms = 0; if (delay) { data_size++; @@ -291,87 +161,17 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool shou } } -void displayio_epaperdisplay_set_region_to_update(displayio_epaperdisplay_obj_t* self, displayio_area_t* area) { - if (self->set_row_window_command == NO_COMMAND) { - return; - } - uint16_t x1 = area->x1; - uint16_t x2 = area->x2; - uint16_t y1 = area->y1; - uint16_t y2 = area->y2; - // Collapse down the dimension where multiple pixels are in a byte. - uint8_t pixels_per_byte = 8 / self->colorspace.depth; - x1 /= pixels_per_byte * self->colorspace.bytes_per_cell; - x2 /= pixels_per_byte * self->colorspace.bytes_per_cell; - - - // Set column. - uint8_t data[5]; - data[0] = self->set_column_window_command; - self->send(self->bus, true, self->always_toggle_chip_select, data, 1); - uint8_t data_length = 0; - if (self->ram_width / pixels_per_byte < 0x100) { - data[data_length++] = x1 + self->colstart; - data[data_length++] = x2 - 1 + self->colstart; - } else { - x1 += self->colstart; - x2 += self->colstart - 1; - data[data_length++] = x1 >> 8; - data[data_length++] = x1 & 0xff; - data[data_length++] = x2 >> 8; - data[data_length++] = x2 & 0xff; - } - self->send(self->bus, false, self->always_toggle_chip_select, data, data_length); - if (self->set_current_column_command != NO_COMMAND) { - uint8_t command = self->set_current_column_command; - self->send(self->bus, true, self->always_toggle_chip_select, &command, 1); - self->send(self->bus, false, self->always_toggle_chip_select, data, data_length / 2); - } - - // Set row. - data[0] = self->set_row_window_command; - self->send(self->bus, true, self->always_toggle_chip_select, data, 1); - data_length = 0; - if (self->ram_height < 0x100) { - data[data_length++] = y1 + self->rowstart; - data[data_length++] = y2 - 1 + self->rowstart; - } else { - y1 += self->rowstart; - y2 += self->rowstart - 1; - data[data_length++] = y1 & 0xff; - data[data_length++] = y1 >> 8; - data[data_length++] = y2 & 0xff; - data[data_length++] = y2 >> 8; - } - self->send(self->bus, false, self->always_toggle_chip_select, data, data_length); - if (self->set_current_row_command != NO_COMMAND) { - uint8_t command = self->set_current_row_command; - self->send(self->bus, true, self->always_toggle_chip_select, &command, 1); - self->send(self->bus, false, self->always_toggle_chip_select, data, data_length / 2); - } -} - void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self) { // run start sequence - self->bus_reset(self->bus); + self->core.bus_reset(self->core.bus); send_command_sequence(self, true, self->start_sequence, self->start_sequence_len); - self->last_refresh = ticks_ms; -} - -void displayio_epaperdisplay_background_task(displayio_epaperdisplay_obj_t* self) { - if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { - if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { - self->refreshing = false; - // Run stop sequence but don't wait for busy because busy is set when sleeping. - send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); - } - } + displayio_display_core_start_refresh(&self->core); } uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self) { // Refresh at seconds per frame rate. - uint32_t elapsed_time = ticks_ms - self->last_refresh; + uint32_t elapsed_time = ticks_ms - self->core.last_refresh; if (elapsed_time > self->milliseconds_per_frame) { return 0; } @@ -380,20 +180,16 @@ uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaper void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) { // Actually refresh the display now that all pixel RAM has been updated. - displayio_epaperdisplay_begin_transaction(self); - self->send(self->bus, true, self->always_toggle_chip_select, &self->refresh_display_command, 1); - displayio_epaperdisplay_end_transaction(self); + displayio_display_core_begin_transaction(&self->core); + self->core.send(self->core.bus, true, self->always_toggle_chip_select, &self->refresh_display_command, 1); + displayio_display_core_end_transaction(&self->core); self->refreshing = true; - if (self->current_group != NULL) { - displayio_group_finish_refresh(self->current_group); - } - self->refresh = false; - self->full_refresh = false; - self->last_refresh = ticks_ms; + displayio_display_core_finish_refresh(&self->core); } -void displayio_epaperdisplay_send_pixels(displayio_epaperdisplay_obj_t* self, uint8_t* pixels, uint32_t length) { +mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self) { + return self->core.bus; } bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, const displayio_area_t* area) { @@ -401,12 +197,12 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c displayio_area_t clipped; // Clip the area to the display by overlapping the areas. If there is no overlap then we're done. - if (!displayio_epaperdisplay_clip_area(self, area, &clipped)) { + if (!displayio_display_core_clip_area(&self->core, area, &clipped)) { return true; } uint16_t subrectangles = 1; uint16_t rows_per_buffer = displayio_area_height(&clipped); - uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->colorspace.depth; + uint8_t pixels_per_word = (sizeof(uint32_t) * 8) / self->core.colorspace.depth; uint16_t pixels_per_buffer = displayio_area_size(&clipped); if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { rows_per_buffer = buffer_size * pixels_per_word / displayio_area_width(&clipped); @@ -431,23 +227,23 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c uint32_t mask[mask_length]; uint8_t passes = 1; - if (self->colorspace.tricolor) { + if (self->core.colorspace.tricolor) { passes = 2; } for (uint8_t pass = 0; pass < passes; pass++) { uint16_t remaining_rows = displayio_area_height(&clipped); - displayio_epaperdisplay_begin_transaction(self); - displayio_epaperdisplay_set_region_to_update(self, &clipped); - displayio_epaperdisplay_end_transaction(self); + if (self->set_row_window_command != NO_COMMAND) { + displayio_display_core_set_region_to_update(&self->core, self->set_column_window_command, self->set_row_window_command, self->set_current_column_command, self->set_current_row_command, false, self->always_toggle_chip_select, &clipped); + } uint8_t write_command = self->write_black_ram_command; if (pass == 1) { write_command = self->write_color_ram_command; } - displayio_epaperdisplay_begin_transaction(self); - self->send(self->bus, true, self->always_toggle_chip_select, &write_command, 1); - displayio_epaperdisplay_end_transaction(self); + displayio_display_core_begin_transaction(&self->core); + self->core.send(self->core.bus, true, self->always_toggle_chip_select, &write_command, 1); + displayio_display_core_end_transaction(&self->core); for (uint16_t j = 0; j < subrectangles; j++) { displayio_area_t subrectangle = { @@ -462,7 +258,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c remaining_rows -= rows_per_buffer; - uint16_t subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->colorspace.depth); + uint16_t subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); for (uint16_t k = 0; k < mask_length; k++) { mask[k] = 0x00000000; @@ -471,11 +267,11 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c buffer[k] = 0x00000000; } - self->colorspace.grayscale = true; + self->core.colorspace.grayscale = true; if (pass == 1) { - self->colorspace.grayscale = false; + self->core.colorspace.grayscale = false; } - displayio_group_fill_area(self->current_group, &self->colorspace, &subrectangle, mask, buffer); + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); // Invert it all. if ((pass == 1 && self->color_bits_inverted) || @@ -485,12 +281,12 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c } } - if (!displayio_epaperdisplay_begin_transaction(self)) { + if (!displayio_display_core_begin_transaction(&self->core)) { // Can't acquire display bus; skip the rest of the data. Try next display. return false; } - self->send(self->bus, false, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); - displayio_epaperdisplay_end_transaction(self); + self->core.send(self->core.bus, false, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); + displayio_display_core_end_transaction(&self->core); // TODO(tannewt): Make refresh displays faster so we don't starve other // background tasks. @@ -512,57 +308,47 @@ bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* s return false; } } - if (self->current_group == NULL) { - return false; + if (self->core.current_group == NULL) { + return true; } // Refresh at seconds per frame rate. - if (ticks_ms - self->last_refresh) > self->milliseconds_per_frame; - - if (displayio_epaperdisplay_get_time_to_refresh(display) > 0) { + if (common_hal_displayio_epaperdisplay_get_time_to_refresh(self) > 0) { return false; } - if (!displayio_epaperdisplay_bus_free(display)) { + if (!displayio_display_core_bus_free(&self->core)) { // Can't acquire display bus; skip updating this display. Try next display. - continue; + return false; } - const displayio_area_t* current_area = displayio_epaperdisplay_get_refresh_areas(display); + const displayio_area_t* current_area = displayio_epaperdisplay_get_refresh_areas(self); if (current_area == NULL) { - continue; + return true; } - displayio_epaperdisplay_start_refresh(display); + displayio_epaperdisplay_start_refresh(self); while (current_area != NULL) { - displayio_epaperdisplay_refresh_area(display, current_area); + displayio_epaperdisplay_refresh_area(self, current_area); current_area = current_area->next; } - displayio_epaperdisplay_finish_refresh(display); + displayio_epaperdisplay_finish_refresh(self); + return true; +} + +void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { + if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { + if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { + self->refreshing = false; + // Run stop sequence but don't wait for busy because busy is set when sleeping. + send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); + } + } } void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { - if (self->current_group != NULL) { - self->current_group->in_group = false; - } + release_display_core(&self->core); if (self->busy.base.type == &digitalio_digitalinout_type) { common_hal_digitalio_digitalinout_deinit(&self->busy); } } -bool displayio_epaperdisplay_fill_area(displayio_epaperdisplay_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer) { - return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); -} - -bool displayio_epaperdisplay_clip_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped) { - bool overlaps = displayio_area_compute_overlap(&self->area, area, clipped); - if (!overlaps) { - return false; - } - // Expand the area if we have multiple pixels per byte and we need to byte - // align the bounds. - uint8_t pixels_per_byte = 8; - if (clipped->x1 % pixels_per_byte != 0) { - clipped->x1 -= clipped->x1 % pixels_per_byte; - } - if (clipped->x2 % pixels_per_byte != 0) { - clipped->x2 += pixels_per_byte - clipped->x2 % pixels_per_byte; - } - return true; +void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self) { + displayio_display_core_collect_ptrs(&self->core); } diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index cc7db6f6d1..88b5ebfaf2 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -32,38 +32,17 @@ #include "shared-bindings/pulseio/PWMOut.h" #include "shared-module/displayio/area.h" - -typedef void (*display_bus_bus_reset)(mp_obj_t bus); -typedef bool (*display_bus_bus_free)(mp_obj_t bus); -typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); -typedef void (*display_bus_end_transaction)(mp_obj_t bus); +#include "shared-module/displayio/display_core.h" typedef struct { mp_obj_base_t base; - mp_obj_t bus; - displayio_group_t *current_group; - uint64_t last_refresh; - display_bus_bus_reset bus_reset; - display_bus_bus_free bus_free; - display_bus_begin_transaction begin_transaction; - display_bus_send send; - display_bus_end_transaction end_transaction; + displayio_display_core_t core; digitalio_digitalinout_obj_t busy; uint32_t milliseconds_per_frame; uint8_t* start_sequence; uint32_t start_sequence_len; uint8_t* stop_sequence; uint32_t stop_sequence_len; - displayio_buffer_transform_t transform; - displayio_area_t area; - uint16_t width; - uint16_t height; - uint16_t ram_width; - uint16_t ram_height; - _displayio_colorspace_t colorspace; - int16_t colstart; - int16_t rowstart; uint16_t set_column_window_command; uint16_t set_row_window_command; uint16_t set_current_column_command; @@ -76,11 +55,12 @@ typedef struct { bool black_bits_inverted; bool color_bits_inverted; bool refreshing; - bool full_refresh; // New group means we need to refresh the whole display. bool always_toggle_chip_select; } displayio_epaperdisplay_obj_t; void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self); void release_epaperdisplay(displayio_epaperdisplay_obj_t* self); +void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self); + #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 0ebed58c24..0a3b1fd108 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -4,7 +4,6 @@ #include "shared-module/displayio/__init__.h" #include "lib/utils/interrupt_char.h" -#include "py/gc.h" #include "py/reload.h" #include "py/runtime.h" #include "shared-bindings/board/__init__.h" @@ -16,7 +15,6 @@ #include "supervisor/shared/autoreload.h" #include "supervisor/shared/display.h" #include "supervisor/memory.h" -#include "supervisor/usb.h" primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; @@ -46,8 +44,8 @@ void displayio_background(void) { } if (displays[i].display.base.type == &displayio_display_type) { displayio_display_background(&displays[i].display); - } else if (displays[i].epaperdisplay.base.type == &displayio_epaperdisplay_type) { - displayio_epaperdisplay_background(&displays[i].epaperdisplay); + } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + displayio_epaperdisplay_background(&displays[i].epaper_display); } } @@ -162,9 +160,9 @@ void displayio_gc_collect(void) { // Alternatively, we could use gc_collect_root over the whole object, // but this is more precise, and is the only field that needs marking. if (displays[i].display.base.type == &displayio_display_type) { - gc_collect_ptr(displays[i].display.current_group); + displayio_display_collect_ptrs(&displays[i].display); } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { - gc_collect_ptr(displays[i].epaper_display.current_group); + displayio_epaperdisplay_collect_ptrs(&displays[i].epaper_display); } } } diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c new file mode 100644 index 0000000000..f8a8d8feaa --- /dev/null +++ b/shared-module/displayio/display_core.c @@ -0,0 +1,309 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/displayio/Display.h" + +#include "py/gc.h" +#include "py/runtime.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/displayio/I2CDisplay.h" +#include "shared-bindings/displayio/ParallelBus.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/display.h" + +#include +#include + +#include "tick.h" + +void displayio_display_core_construct(displayio_display_core_t* self, + mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte) { + self->colorspace.depth = color_depth; + self->colorspace.grayscale = grayscale; + self->colorspace.pixels_in_byte_share_row = pixels_in_byte_share_row; + self->colorspace.bytes_per_cell = bytes_per_cell; + self->colorspace.reverse_pixels_in_byte = reverse_pixels_in_byte; + self->current_group = NULL; + self->colstart = colstart; + self->rowstart = rowstart; + + if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { + self->bus_reset = common_hal_displayio_parallelbus_reset; + self->bus_free = common_hal_displayio_parallelbus_bus_free; + self->begin_transaction = common_hal_displayio_parallelbus_begin_transaction; + self->send = common_hal_displayio_parallelbus_send; + self->end_transaction = common_hal_displayio_parallelbus_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_fourwire_type)) { + self->bus_reset = common_hal_displayio_fourwire_reset; + self->bus_free = common_hal_displayio_fourwire_bus_free; + self->begin_transaction = common_hal_displayio_fourwire_begin_transaction; + self->send = common_hal_displayio_fourwire_send; + self->end_transaction = common_hal_displayio_fourwire_end_transaction; + } else if (MP_OBJ_IS_TYPE(bus, &displayio_i2cdisplay_type)) { + self->bus_reset = common_hal_displayio_i2cdisplay_reset; + self->bus_free = common_hal_displayio_i2cdisplay_bus_free; + self->begin_transaction = common_hal_displayio_i2cdisplay_begin_transaction; + self->send = common_hal_displayio_i2cdisplay_send; + self->end_transaction = common_hal_displayio_i2cdisplay_end_transaction; + } else { + mp_raise_ValueError(translate("Unsupported display bus type")); + } + self->bus = bus; + + + supervisor_start_terminal(width, height); + + self->width = width; + self->height = height; + self->ram_width = width; + self->ram_height = height; + rotation = rotation % 360; + self->transform.x = 0; + self->transform.y = 0; + self->transform.scale = 1; + self->transform.mirror_x = false; + self->transform.mirror_y = false; + self->transform.transpose_xy = false; + if (rotation == 0 || rotation == 180) { + if (rotation == 180) { + self->transform.mirror_x = true; + self->transform.mirror_y = true; + } + } else { + self->transform.transpose_xy = true; + if (rotation == 270) { + self->transform.mirror_y = true; + } else { + self->transform.mirror_x = true; + } + } + + self->area.x1 = 0; + self->area.y1 = 0; + self->area.next = NULL; + + self->transform.dx = 1; + self->transform.dy = 1; + if (self->transform.transpose_xy) { + self->area.x2 = height; + self->area.y2 = width; + if (self->transform.mirror_x) { + self->transform.x = height; + self->transform.dx = -1; + } + if (self->transform.mirror_y) { + self->transform.y = width; + self->transform.dy = -1; + } + } else { + self->area.x2 = width; + self->area.y2 = height; + if (self->transform.mirror_x) { + self->transform.x = width; + self->transform.dx = -1; + } + if (self->transform.mirror_y) { + self->transform.y = height; + self->transform.dy = -1; + } + } +} + +bool displayio_display_core_show(displayio_display_core_t* self, displayio_group_t* root_group) { + if (root_group == NULL) { + if (!circuitpython_splash.in_group) { + root_group = &circuitpython_splash; + } else if (self->current_group == &circuitpython_splash) { + return false; + } + } + if (root_group == self->current_group) { + return true; + } + if (root_group != NULL && root_group->in_group) { + return false; + } + if (self->current_group != NULL) { + self->current_group->in_group = false; + } + + if (root_group != NULL) { + displayio_group_update_transform(root_group, &self->transform); + root_group->in_group = true; + } + self->current_group = root_group; + self->full_refresh = true; + return true; +} + +uint16_t displayio_display_core_get_width(displayio_display_core_t* self){ + return self->width; +} + +uint16_t displayio_display_core_get_height(displayio_display_core_t* self){ + return self->height; +} + +bool displayio_display_core_bus_free(displayio_display_core_t *self) { + return self->bus_free(self->bus); +} + +bool displayio_display_core_begin_transaction(displayio_display_core_t* self) { + return self->begin_transaction(self->bus); +} + +void displayio_display_core_end_transaction(displayio_display_core_t* self) { + self->end_transaction(self->bus); +} + +void displayio_display_core_set_region_to_update(displayio_display_core_t* self, uint8_t column_command, uint8_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, bool data_as_commands, bool always_toggle_chip_select, displayio_area_t* area) { + displayio_display_core_begin_transaction(self); + uint16_t x1 = area->x1; + uint16_t x2 = area->x2; + uint16_t y1 = area->y1; + uint16_t y2 = area->y2; + // Collapse down the dimension where multiple pixels are in a byte. + if (self->colorspace.depth < 8) { + uint8_t pixels_per_byte = 8 / self->colorspace.depth; + if (self->colorspace.pixels_in_byte_share_row) { + x1 /= pixels_per_byte * self->colorspace.bytes_per_cell; + x2 /= pixels_per_byte * self->colorspace.bytes_per_cell; + } else { + y1 /= pixels_per_byte * self->colorspace.bytes_per_cell; + y2 /= pixels_per_byte * self->colorspace.bytes_per_cell; + } + } + + // Set column. + uint8_t data[5]; + data[0] = column_command; + uint8_t data_length = 1; + if (!data_as_commands) { + self->send(self->bus, true, true, data, 1); + data_length = 0; + } + if (self->ram_width < 0x100) { + data[data_length++] = x1 + self->colstart; + data[data_length++] = x2 - 1 + self->colstart; + } else { + x1 += self->colstart; + x2 += self->colstart - 1; + data[data_length++] = x1 >> 8; + data[data_length++] = x1 & 0xff; + data[data_length++] = x2 >> 8; + data[data_length++] = x2 & 0xff; + } + self->send(self->bus, data_as_commands, data_as_commands, data, data_length); + if (set_current_column_command != NO_COMMAND) { + uint8_t command = set_current_column_command; + self->send(self->bus, true, always_toggle_chip_select, &command, 1); + self->send(self->bus, false, always_toggle_chip_select, data, data_length / 2); + } + + // Set row. + data[0] = row_command; + data_length = 1; + if (!data_as_commands) { + self->send(self->bus, true, true, data, 1); + data_length = 0; + } + if (self->ram_height < 0x100) { + data[data_length++] = y1 + self->rowstart; + data[data_length++] = y2 - 1 + self->rowstart; + } else { + y1 += self->rowstart; + y2 += self->rowstart - 1; + data[data_length++] = y1 >> 8; + data[data_length++] = y1 & 0xff; + data[data_length++] = y2 >> 8; + data[data_length++] = y2 & 0xff; + } + self->send(self->bus, data_as_commands, data_as_commands, data, data_length); + if (set_current_row_command != NO_COMMAND) { + uint8_t command = set_current_row_command; + self->send(self->bus, true, always_toggle_chip_select, &command, 1); + self->send(self->bus, false, always_toggle_chip_select, data, data_length / 2); + } + + displayio_display_core_end_transaction(self); +} + +void displayio_display_core_start_refresh(displayio_display_core_t* self) { + self->last_refresh = ticks_ms; +} + +void displayio_display_core_finish_refresh(displayio_display_core_t* self) { + if (self->current_group != NULL) { + displayio_group_finish_refresh(self->current_group); + } + self->full_refresh = false; + self->last_refresh = ticks_ms; +} + +void release_display_core(displayio_display_core_t* self) { + if (self->current_group != NULL) { + self->current_group->in_group = false; + } +} + +void displayio_display_core_collect_ptrs(displayio_display_core_t* self) { + gc_collect_ptr(self->current_group); +} + +bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer) { + return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); +} + +bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t* area, displayio_area_t* clipped) { + bool overlaps = displayio_area_compute_overlap(&self->area, area, clipped); + if (!overlaps) { + return false; + } + // Expand the area if we have multiple pixels per byte and we need to byte + // align the bounds. + if (self->colorspace.depth < 8) { + uint8_t pixels_per_byte = 8 / self->colorspace.depth * self->colorspace.bytes_per_cell; + if (self->colorspace.pixels_in_byte_share_row) { + if (clipped->x1 % pixels_per_byte != 0) { + clipped->x1 -= clipped->x1 % pixels_per_byte; + } + if (clipped->x2 % pixels_per_byte != 0) { + clipped->x2 += pixels_per_byte - clipped->x2 % pixels_per_byte; + } + } else { + if (clipped->y1 % pixels_per_byte != 0) { + clipped->y1 -= clipped->y1 % pixels_per_byte; + } + if (clipped->y2 % pixels_per_byte != 0) { + clipped->y2 += pixels_per_byte - clipped->y2 % pixels_per_byte; + } + } + } + return true; +} diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h new file mode 100644 index 0000000000..c837ce913c --- /dev/null +++ b/shared-module/displayio/display_core.h @@ -0,0 +1,90 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_CORE_H +#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_CORE_H + +#include "shared-bindings/displayio/Group.h" + +#include "shared-module/displayio/area.h" + +#define NO_COMMAND 0x100 + +typedef void (*display_bus_bus_reset)(mp_obj_t bus); +typedef bool (*display_bus_bus_free)(mp_obj_t bus); +typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); +typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_end_transaction)(mp_obj_t bus); + +typedef struct { + mp_obj_t bus; + displayio_group_t *current_group; + uint64_t last_refresh; + display_bus_bus_reset bus_reset; + display_bus_bus_free bus_free; + display_bus_begin_transaction begin_transaction; + display_bus_send send; + display_bus_end_transaction end_transaction; + displayio_buffer_transform_t transform; + displayio_area_t area; + uint16_t width; + uint16_t height; + uint16_t rotation; + uint16_t ram_width; + uint16_t ram_height; + _displayio_colorspace_t colorspace; + int16_t colstart; + int16_t rowstart; + bool full_refresh; // New group means we need to refresh the whole display. +} displayio_display_core_t; + +void displayio_display_core_construct(displayio_display_core_t* self, + mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte); + +bool displayio_display_core_show(displayio_display_core_t* self, displayio_group_t* root_group); + +uint16_t displayio_display_core_get_width(displayio_display_core_t* self); +uint16_t displayio_display_core_get_height(displayio_display_core_t* self); + +bool displayio_display_core_bus_free(displayio_display_core_t *self); +bool displayio_display_core_begin_transaction(displayio_display_core_t* self); +void displayio_display_core_end_transaction(displayio_display_core_t* self); + +void displayio_display_core_set_region_to_update(displayio_display_core_t* self, uint8_t column_command, uint8_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, bool data_as_commands, bool always_toggle_chip_select, displayio_area_t* area); + +void release_display_core(displayio_display_core_t* self); + +void displayio_display_core_start_refresh(displayio_display_core_t* self); +void displayio_display_core_finish_refresh(displayio_display_core_t* self); + +void displayio_display_core_collect_ptrs(displayio_display_core_t* self); + +bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer); + +bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t* area, displayio_area_t* clipped); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_CORE_H From 24b30965c41ae32b82c56b166f3287cf2c14f419 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 20 Aug 2019 21:35:42 -0700 Subject: [PATCH 07/41] Refresh ePaper displays once code.py is done running --- main.c | 8 ++++++++ shared-bindings/displayio/__init__.c | 2 +- shared-module/displayio/EPaperDisplay.c | 27 +++++++++++++++++++++++++ shared-module/displayio/EPaperDisplay.h | 1 + shared-module/displayio/__init__.c | 24 ++++++++++++---------- shared-module/displayio/display_core.c | 3 ++- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/main.c b/main.c index 6ab50fc3ca..076674c442 100755 --- a/main.c +++ b/main.c @@ -253,6 +253,7 @@ bool run_code_py(safe_mode_t safe_mode) { } bool serial_connected_before_animation = false; + bool refreshed_epaper_display = false; rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { @@ -290,6 +291,13 @@ bool run_code_py(safe_mode_t safe_mode) { } serial_connected_before_animation = serial_connected(); + // Refresh the ePaper display if we have one. That way it'll show an error message. + #if CIRCUITPY_DISPLAYIO + if (!refreshed_epaper_display) { + refreshed_epaper_display = maybe_refresh_epaperdisplay(); + } + #endif + tick_rgb_status_animation(&animation); } } diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 8c5d1f2284..f783255930 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -77,7 +77,7 @@ //| //| Releases any actively used displays so their busses and pins can be used again. This will also //| release the builtin display on boards that have one. You will need to reinitialize it yourself -//| afterwards. +//| afterwards. This may take seconds to complete if an active EPaperDisplay is refreshing. //| //| Use this once in your code.py if you initialize a display. Place it right before the //| initialization so the display is active as long as possible. diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 6ff060a6a6..7e65502d4d 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -170,6 +170,9 @@ void displayio_epaperdisplay_start_refresh(displayio_epaperdisplay_obj_t* self) } uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self) { + if (self->core.last_refresh == 0) { + return 0; + } // Refresh at seconds per frame rate. uint32_t elapsed_time = ticks_ms - self->core.last_refresh; if (elapsed_time > self->milliseconds_per_frame) { @@ -343,6 +346,13 @@ void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { } void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { + if (self->refreshing) { + wait_for_busy(self); + self->refreshing = false; + // Run stop sequence but don't wait for busy because busy is set when sleeping. + send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); + } + release_display_core(&self->core); if (self->busy.base.type == &digitalio_digitalinout_type) { common_hal_digitalio_digitalinout_deinit(&self->busy); @@ -352,3 +362,20 @@ void release_epaperdisplay(displayio_epaperdisplay_obj_t* self) { void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self) { displayio_display_core_collect_ptrs(&self->core); } + +bool maybe_refresh_epaperdisplay(void) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + if (displays[i].epaper_display.base.type != &displayio_epaperdisplay_type || + displays[i].epaper_display.core.current_group != &circuitpython_splash) { + // Skip regular displays and those not showing the splash. + continue; + } + displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; + if (common_hal_displayio_epaperdisplay_get_time_to_refresh(display) != 0) { + return false; + } + return common_hal_displayio_epaperdisplay_refresh(display); + } + // Return true if no ePaper displays are available to pretend it was updated. + return true; +} diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 88b5ebfaf2..2be2add4b7 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -60,6 +60,7 @@ typedef struct { void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self); void release_epaperdisplay(displayio_epaperdisplay_obj_t* self); +bool maybe_refresh_epaperdisplay(void); void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 0a3b1fd108..a41884c78c 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -54,6 +54,19 @@ void displayio_background(void) { } void common_hal_displayio_release_displays(void) { + // Release displays before busses so that they can send any final commands to turn the display + // off properly. + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t display_type = displays[i].display.base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { + continue; + } else if (display_type == &displayio_display_type) { + release_display(&displays[i].display); + } else if (display_type == &displayio_epaperdisplay_type) { + release_epaperdisplay(&displays[i].epaper_display); + } + displays[i].display.base.type = &mp_type_NoneType; + } for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; if (bus_type == NULL || bus_type == &mp_type_NoneType) { @@ -67,17 +80,6 @@ void common_hal_displayio_release_displays(void) { } displays[i].fourwire_bus.base.type = &mp_type_NoneType; } - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t display_type = displays[i].display.base.type; - if (display_type == NULL || display_type == &mp_type_NoneType) { - continue; - } else if (display_type == &displayio_display_type) { - release_display(&displays[i].display); - } else if (display_type == &displayio_epaperdisplay_type) { - release_epaperdisplay(&displays[i].epaper_display); - } - displays[i].display.base.type = &mp_type_NoneType; - } supervisor_stop_terminal(); } diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index f8a8d8feaa..24d8ab51f0 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -52,6 +52,7 @@ void displayio_display_core_construct(displayio_display_core_t* self, self->current_group = NULL; self->colstart = colstart; self->rowstart = rowstart; + self->last_refresh = 0; if (MP_OBJ_IS_TYPE(bus, &displayio_parallelbus_type)) { self->bus_reset = common_hal_displayio_parallelbus_reset; @@ -140,7 +141,7 @@ bool displayio_display_core_show(displayio_display_core_t* self, displayio_group if (!circuitpython_splash.in_group) { root_group = &circuitpython_splash; } else if (self->current_group == &circuitpython_splash) { - return false; + return true; } } if (root_group == self->current_group) { From 3a98de12368a63de1538f61da7690e9fa230b540 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 11:49:49 -0700 Subject: [PATCH 08/41] Add reset() to display busses to detect whether it works --- .../boards/itsybitsy_m0_express/mpconfigboard.mk | 3 +++ .../common-hal/displayio/ParallelBus.c | 7 ++++++- shared-bindings/displayio/FourWire.c | 16 ++++++++++++++++ shared-bindings/displayio/FourWire.h | 2 +- shared-bindings/displayio/I2CDisplay.c | 16 ++++++++++++++++ shared-bindings/displayio/I2CDisplay.h | 2 +- shared-bindings/displayio/ParallelBus.c | 16 ++++++++++++++++ shared-bindings/displayio/ParallelBus.h | 2 +- shared-module/displayio/FourWire.c | 8 +++++++- shared-module/displayio/I2CDisplay.c | 10 +++++++--- shared-module/displayio/display_core.h | 2 +- 11 files changed, 75 insertions(+), 9 deletions(-) diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk index fd66f425da..410a0e0877 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk @@ -12,6 +12,9 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_I2CSLAVE = 0 +CIRCUITPY_RTC = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/common-hal/displayio/ParallelBus.c b/ports/atmel-samd/common-hal/displayio/ParallelBus.c index a43d205113..e2ce9952b4 100644 --- a/ports/atmel-samd/common-hal/displayio/ParallelBus.c +++ b/ports/atmel-samd/common-hal/displayio/ParallelBus.c @@ -79,6 +79,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel self->write_group = &PORT->Group[write->number / 32]; self->write_mask = 1 << (write->number % 32); + self->reset.base.type = &mp_type_NoneType; if (reset != NULL) { self->reset.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->reset, reset); @@ -108,12 +109,16 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) reset_pin_number(self->reset.pin->number); } -void common_hal_displayio_parallelbus_reset(mp_obj_t obj) { +bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + if (self->reset.base.type == &mp_type_NoneType) { + return false; + } common_hal_digitalio_digitalinout_set_value(&self->reset, false); common_hal_mcu_delay_us(4); common_hal_digitalio_digitalinout_set_value(&self->reset, true); + return true; } bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index efd553e2e8..c696233442 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -103,6 +103,21 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ return self; } +//| .. method:: reset() +//| +//| Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin +//| is available. +//| +STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) { + displayio_fourwire_obj_t *self = self_in; + + if (!common_hal_displayio_fourwire_reset(self)) { + mp_raise_RuntimeError(translate("no reset pin available")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset); + //| .. method:: send(command, data, *, toggle_every_byte=False) //| //| Sends the given command value followed by the full set of data. Display state, such as @@ -140,6 +155,7 @@ STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_a MP_DEFINE_CONST_FUN_OBJ_KW(displayio_fourwire_send_obj, 3, displayio_fourwire_obj_send); STATIC const mp_rom_map_elem_t displayio_fourwire_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_fourwire_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_fourwire_send_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_fourwire_locals_dict, displayio_fourwire_locals_dict_table); diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h index ee69a63acb..9c71d63cc9 100644 --- a/shared-bindings/displayio/FourWire.h +++ b/shared-bindings/displayio/FourWire.h @@ -40,7 +40,7 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self, void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self); -void common_hal_displayio_fourwire_reset(mp_obj_t self); +bool common_hal_displayio_fourwire_reset(mp_obj_t self); bool common_hal_displayio_fourwire_bus_free(mp_obj_t self); bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 4428e8dbb4..4de5e83ef1 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -95,6 +95,21 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t return self; } +//| .. method:: reset() +//| +//| Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin +//| is available. +//| +STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) { + displayio_i2cdisplay_obj_t *self = self_in; + + if (!common_hal_displayio_i2cdisplay_reset(self)) { + mp_raise_RuntimeError(translate("no reset pin available")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_obj_reset); + //| .. method:: send(command, data) //| //| Sends the given command value followed by the full set of data. Display state, such as @@ -124,6 +139,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob MP_DEFINE_CONST_FUN_OBJ_3(displayio_i2cdisplay_send_obj, displayio_i2cdisplay_obj_send); STATIC const mp_rom_map_elem_t displayio_i2cdisplay_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_i2cdisplay_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_i2cdisplay_send_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_i2cdisplay_locals_dict, displayio_i2cdisplay_locals_dict_table); diff --git a/shared-bindings/displayio/I2CDisplay.h b/shared-bindings/displayio/I2CDisplay.h index 6a75fc488d..683cff383b 100644 --- a/shared-bindings/displayio/I2CDisplay.h +++ b/shared-bindings/displayio/I2CDisplay.h @@ -37,7 +37,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self, void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self); -void common_hal_displayio_i2cdisplay_reset(mp_obj_t self); +bool common_hal_displayio_i2cdisplay_reset(mp_obj_t self); bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self); bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index e260f9b7eb..a08c37679b 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -106,6 +106,21 @@ STATIC mp_obj_t displayio_parallelbus_make_new(const mp_obj_type_t *type, size_t return self; } +//| .. method:: reset() +//| +//| Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin +//| is available. +//| +STATIC mp_obj_t displayio_parallelbus_obj_reset(mp_obj_t self_in) { + displayio_parallelbus_obj_t *self = self_in; + + if (!common_hal_displayio_parallelbus_reset(self)) { + mp_raise_RuntimeError(translate("no reset pin available")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_parallelbus_reset_obj, displayio_parallelbus_obj_reset); + //| .. method:: send(command, data) //| //| Sends the given command value followed by the full set of data. Display state, such as @@ -133,6 +148,7 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o MP_DEFINE_CONST_FUN_OBJ_3(displayio_parallelbus_send_obj, displayio_parallelbus_obj_send); STATIC const mp_rom_map_elem_t displayio_parallelbus_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&displayio_parallelbus_reset_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&displayio_parallelbus_send_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_parallelbus_locals_dict, displayio_parallelbus_locals_dict_table); diff --git a/shared-bindings/displayio/ParallelBus.h b/shared-bindings/displayio/ParallelBus.h index b8da910411..a0f967332c 100644 --- a/shared-bindings/displayio/ParallelBus.h +++ b/shared-bindings/displayio/ParallelBus.h @@ -40,7 +40,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self); -void common_hal_displayio_parallelbus_reset(mp_obj_t self); +bool common_hal_displayio_parallelbus_reset(mp_obj_t self); bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self); bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self); diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 64ad80665d..7294e9772c 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -55,7 +55,9 @@ void common_hal_displayio_fourwire_construct(displayio_fourwire_obj_t* self, common_hal_digitalio_digitalinout_construct(&self->chip_select, chip_select); common_hal_digitalio_digitalinout_switch_to_output(&self->chip_select, true, DRIVE_MODE_PUSH_PULL); + self->reset.base.type = &mp_type_NoneType; if (reset != NULL) { + self->reset.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->reset, reset); common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); never_reset_pin_number(reset->number); @@ -76,12 +78,16 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) { reset_pin_number(self->reset.pin->number); } -void common_hal_displayio_fourwire_reset(mp_obj_t obj) { +bool common_hal_displayio_fourwire_reset(mp_obj_t obj) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); + if (self->reset.base.type == &mp_type_NoneType) { + return false; + } common_hal_digitalio_digitalinout_set_value(&self->reset, false); common_hal_time_delay_ms(1); common_hal_digitalio_digitalinout_set_value(&self->reset, true); common_hal_time_delay_ms(1); + return true; } bool common_hal_displayio_fourwire_bus_free(mp_obj_t obj) { diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 23ebc0889d..95830ba0e8 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -55,7 +55,9 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self, self->address = device_address; + self->reset.base.type = &mp_type_NoneType; if (reset != NULL) { + self->reset.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->reset, reset); common_hal_digitalio_digitalinout_switch_to_output(&self->reset, true, DRIVE_MODE_PUSH_PULL); never_reset_pin_number(reset->number); @@ -71,16 +73,18 @@ void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) { reset_pin_number(self->reset.pin->number); } - -void common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) { +bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); + if (self->reset.base.type == &mp_type_NoneType) { + return false; + } common_hal_digitalio_digitalinout_set_value(&self->reset, false); common_hal_mcu_delay_us(1); common_hal_digitalio_digitalinout_set_value(&self->reset, true); + return true; } - bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); if (!common_hal_busio_i2c_try_lock(self->bus)) { diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index c837ce913c..b1a412883c 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -33,7 +33,7 @@ #define NO_COMMAND 0x100 -typedef void (*display_bus_bus_reset)(mp_obj_t bus); +typedef bool (*display_bus_bus_reset)(mp_obj_t bus); typedef bool (*display_bus_bus_free)(mp_obj_t bus); typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); From f2a1972ba8a3eeeed33f9ac693ef4176c883aec4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 13:15:35 -0700 Subject: [PATCH 09/41] Add refresh_time to use if busy_pin is not given --- shared-bindings/displayio/EPaperDisplay.c | 11 +++++++---- shared-bindings/displayio/EPaperDisplay.h | 2 +- shared-module/displayio/EPaperDisplay.c | 14 +++++++++++--- shared-module/displayio/EPaperDisplay.h | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8f3c16efd4..dd773e410c 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -51,7 +51,7 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum. //| -//| .. class:: EPaperDisplay(display_bus, start_sequence, stop_sequence, *, width, height, ram_width, ram_height, colstart=0, rowstart=0, rotation=0, set_column_window_command=None, set_row_window_command=None, single_byte_bounds=False, write_black_ram_command, black_bits_inverted=False, write_color_ram_command=None, color_bits_inverted=False, highlight_color=0x000000, refresh_display_command, busy_pin=None, busy_state=True, seconds_per_frame=180, always_toggle_chip_select=False) +//| .. class:: EPaperDisplay(display_bus, start_sequence, stop_sequence, *, width, height, ram_width, ram_height, colstart=0, rowstart=0, rotation=0, set_column_window_command=None, set_row_window_command=None, single_byte_bounds=False, write_black_ram_command, black_bits_inverted=False, write_color_ram_command=None, color_bits_inverted=False, highlight_color=0x000000, refresh_display_command, refresh_time=40, busy_pin=None, busy_state=True, seconds_per_frame=180, always_toggle_chip_select=False) //| //| Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| @@ -83,13 +83,14 @@ //| :param bool color_bits_inverted: True if 0 bits are used to show the color. Otherwise, 1 means to show color. //| :param int highlight_color: RGB888 of source color to highlight with third ePaper color. //| :param int refresh_display_command: Command used to start a display refresh +//| :param float refresh_time: Time it takes to refresh the display before the stop_sequence should be sent. Ignored when busy_pin is provided. //| :param microcontroller.Pin busy_pin: Pin used to signify the display is busy //| :param bool busy_state: State of the busy pin when the display is busy -//| :param int seconds_per_frame: Minimum number of seconds between screen refreshes +//| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| STATIC mp_obj_t displayio_epaperdisplay_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_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, ARG_refresh_display_command, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; + enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, ARG_set_column_window_command, ARG_set_row_window_command, ARG_set_current_column_command, ARG_set_current_row_command, ARG_write_black_ram_command, ARG_black_bits_inverted, ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, ARG_refresh_display_command, ARG_refresh_time, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -111,6 +112,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size { MP_QSTR_color_bits_inverted, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_highlight_color, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0x000000} }, { MP_QSTR_refresh_display_command, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_refresh_time, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(40)} }, { MP_QSTR_busy_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, { MP_QSTR_busy_state, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_seconds_per_frame, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(180)} }, @@ -152,6 +154,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size mp_raise_RuntimeError(translate("Too many displays")); } + mp_float_t refresh_time = mp_obj_get_float(args[ARG_refresh_time].u_obj); mp_float_t seconds_per_frame = mp_obj_get_float(args[ARG_seconds_per_frame].u_obj); mp_int_t write_color_ram_command = NO_COMMAND; @@ -168,7 +171,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size args[ARG_width].u_int, args[ARG_height].u_int, args[ARG_ram_width].u_int, args[ARG_ram_height].u_int, args[ARG_colstart].u_int, args[ARG_rowstart].u_int, rotation, args[ARG_set_column_window_command].u_int, args[ARG_set_row_window_command].u_int, args[ARG_set_current_column_command].u_int, args[ARG_set_current_row_command].u_int, - args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, highlight_color, args[ARG_refresh_display_command].u_int, + args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, highlight_color, args[ARG_refresh_display_command].u_int, refresh_time, busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, args[ARG_always_toggle_chip_select].u_bool ); diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 2a3cb921f9..786fc3628f 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -43,7 +43,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, mp_float_t refresh_time, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select); bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 7e65502d4d..bf0e6676fe 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -48,7 +48,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, + uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, mp_float_t refresh_time, const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select) { if (highlight_color != 0x000000) { self->core.colorspace.tricolor = true; @@ -67,6 +67,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->write_color_ram_command = write_color_ram_command; self->color_bits_inverted = color_bits_inverted; self->refresh_display_command = refresh_display_command; + self->refresh_time = refresh_time * 1000; self->busy_state = busy_state; self->refreshing = false; self->milliseconds_per_frame = seconds_per_frame * 1000; @@ -336,8 +337,15 @@ bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t* s } void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self) { - if (self->refreshing && self->busy.base.type == &digitalio_digitalinout_type) { - if (common_hal_digitalio_digitalinout_get_value(&self->busy) != self->busy_state) { + if (self->refreshing) { + bool refresh_done = false; + if (self->busy.base.type == &digitalio_digitalinout_type) { + bool busy = common_hal_digitalio_digitalinout_get_value(&self->busy); + refresh_done = busy != self->busy_state; + } else { + refresh_done = ticks_ms - self->core.last_refresh > self->refresh_time; + } + if (refresh_done) { self->refreshing = false; // Run stop sequence but don't wait for busy because busy is set when sleeping. send_command_sequence(self, false, self->stop_sequence, self->stop_sequence_len); diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 2be2add4b7..a5d4ec93f9 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -43,6 +43,7 @@ typedef struct { uint32_t start_sequence_len; uint8_t* stop_sequence; uint32_t stop_sequence_len; + uint16_t refresh_time; uint16_t set_column_window_command; uint16_t set_row_window_command; uint16_t set_current_column_command; From f8e4ccac45fff441da135a55fb794c340939a403 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 13:18:43 -0700 Subject: [PATCH 10/41] Fix builds without displayio --- main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.c b/main.c index 076674c442..6b56f5ff6f 100755 --- a/main.c +++ b/main.c @@ -253,7 +253,9 @@ bool run_code_py(safe_mode_t safe_mode) { } bool serial_connected_before_animation = false; + #if CIRCUITPY_DISPLAYIO bool refreshed_epaper_display = false; + #endif rgb_status_animation_t animation; prep_rgb_status_animation(&result, found_main, safe_mode, &animation); while (true) { From 2497cbe186359feac880cc127298a5945ed95456 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 14:14:47 -0700 Subject: [PATCH 11/41] Fix nrf builds --- ports/nrf/common-hal/displayio/ParallelBus.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/nrf/common-hal/displayio/ParallelBus.c b/ports/nrf/common-hal/displayio/ParallelBus.c index efb8c15b91..a8c2b9f73c 100644 --- a/ports/nrf/common-hal/displayio/ParallelBus.c +++ b/ports/nrf/common-hal/displayio/ParallelBus.c @@ -90,6 +90,7 @@ void common_hal_displayio_parallelbus_construct(displayio_parallelbus_obj_t* sel } self->write_mask = 1 << (write->number % num_pins_in_write_port); + self->reset.base.type = &mp_type_NoneType; if (reset != NULL) { self->reset.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->reset, reset); @@ -119,12 +120,16 @@ void common_hal_displayio_parallelbus_deinit(displayio_parallelbus_obj_t* self) reset_pin_number(self->reset.pin->number); } -void common_hal_displayio_parallelbus_reset(mp_obj_t obj) { +bool common_hal_displayio_parallelbus_reset(mp_obj_t obj) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); + if (self->reset.base.type == &mp_type_NoneType) { + return false; + } common_hal_digitalio_digitalinout_set_value(&self->reset, false); common_hal_mcu_delay_us(4); common_hal_digitalio_digitalinout_set_value(&self->reset, true); + return true; } bool common_hal_displayio_parallelbus_bus_free(mp_obj_t obj) { From 9993a999065d81282df67bacceda4056a404f05f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 21 Aug 2019 23:41:28 -0700 Subject: [PATCH 12/41] Add initial Monster M4SK build --- .travis.yml | 2 +- ports/atmel-samd/boards/monster_m4sk/board.c | 100 ++++++++++++++++++ .../boards/monster_m4sk/mpconfigboard.h | 31 ++++++ .../boards/monster_m4sk/mpconfigboard.mk | 18 ++++ ports/atmel-samd/boards/monster_m4sk/pins.c | 48 +++++++++ py/circuitpy_mpconfig.h | 4 + supervisor/shared/filesystem.c | 2 +- 7 files changed, 203 insertions(+), 2 deletions(-) create mode 100644 ports/atmel-samd/boards/monster_m4sk/board.c create mode 100644 ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/monster_m4sk/pins.c diff --git a/.travis.yml b/.travis.yml index 9a058aa643..d084a3042e 100755 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ env: - TRAVIS_BOARDS="itsybitsy_m0_express metro_m0_express pirkey_m0 pyruler trinket_m0 trinket_m0_haxpress arduino_mkr1300 arduino_mkrzero arduino_zero bast_pro_mini_m0 catwan_usbstick datum_distance datum_imu datum_weather" TRAVIS_SDK=arm - TRAVIS_BOARDS="escornabot_makech meowmeow pewpew10 robohatmm1_m0 snekboard sparkfun_lumidrive sparkfun_redboard_turbo sparkfun_samd21_dev sparkfun_samd21_mini uchip ugame10" TRAVIS_SDK=arm # Adafruit SAMD51 (M4) + Other SAMD51 - - TRAVIS_BOARDS="feather_m4_express grandcentral_m4_express itsybitsy_m4_express metro_m4_airlift_lite metro_m4_express pybadge pybadge_airlift pygamer pygamer_advance" TRAVIS_SDK=arm + - TRAVIS_BOARDS="feather_m4_express grandcentral_m4_express itsybitsy_m4_express metro_m4_airlift_lite metro_m4_express pybadge pybadge_airlift pygamer pygamer_advance monster_m4sk" TRAVIS_SDK=arm - TRAVIS_BOARDS="pyportal pyportal_titano trellis_m4_express capablerobot_usbhub cp32-m4 datalore_ip_m4 datum_light kicksat-sprite mini_sam_m4 robohatmm1_m4 sam32" TRAVIS_SDK=arm diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c new file mode 100644 index 0000000000..2377f4a9da --- /dev/null +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -0,0 +1,100 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "tick.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. + 0x3a, 1, 0x55, // COLMOD - 16bit color + 0x38, 0, // Idle mode off + 0x21, 0, // _INVON + 0x13, 0, // _NORON + 0x29, 0 | DELAY, 255 // _DISPON +}; + +void board_init(void) { + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_PA07, // TFT_DC Command or data + &pin_PA06, // TFT_CS Chip select + &pin_PA04, // TFT_RST Reset + 60000000); + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 240, // Height (after rotation) + 0, // column start + 0, // row start + 180, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_PA23, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60); // native_frames_per_second +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h new file mode 100644 index 0000000000..484f3d7b2f --- /dev/null +++ b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h @@ -0,0 +1,31 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Monster M4SK" +#define MICROPY_HW_MCU_NAME "samd51j19" + +#define CIRCUITPY_MCU_FAMILY samd51 + +#define MICROPY_HW_LED_STATUS (&pin_PA27) + +// These are pins not to reset. +// QSPI Data pins +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) +// DotStar pins, QSPI CS, and QSPI SCK +#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +#define AUTORESET_DELAY_MS 500 + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 8192 + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +#define DEFAULT_I2C_BUS_SCL (&pin_PA01) +#define DEFAULT_I2C_BUS_SDA (&pin_PA00) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + +#define CIRCUITPY_FS_NAME "MONSTERM4SK" diff --git a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk new file mode 100644 index 0000000000..534b7468f4 --- /dev/null +++ b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk @@ -0,0 +1,18 @@ +LD_FILE = boards/samd51x19-bootloader-external-flash.ld +USB_VID = 0x239A +USB_PID = 0x8048 +USB_PRODUCT = "Monster M4SK" +USB_MANUFACTURER = "Adafruit Industries LLC" + +CHIP_VARIANT = SAMD51J19A +CHIP_FAMILY = samd51 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = GD25Q64C +LONGINT_IMPL = MPZ + +CIRCUITPY_AUDIOIO = 1 +CIRCUITPY_DISPLAYIO = 1 +# No touch on SAMD51 yet +CIRCUITPY_TOUCHIO = 0 diff --git a/ports/atmel-samd/boards/monster_m4sk/pins.c b/ports/atmel-samd/boards/monster_m4sk/pins.c new file mode 100644 index 0000000000..11f9a063fc --- /dev/null +++ b/ports/atmel-samd/boards/monster_m4sk/pins.c @@ -0,0 +1,48 @@ +#include "shared-bindings/board/__init__.h" + +#include "boards/board.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_HEADPHONE_LEFT), MP_ROM_PTR(&pin_PA02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_HEADPHONE_RIGHT), MP_ROM_PTR(&pin_PA05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NOSE), MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA27) }, + + // I2C + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PA22) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PA14) }, + + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_PA17) }, + + // Right TFT control pins + { MP_OBJ_NEW_QSTR(MP_QSTR_RIGHT_TFT_LITE), MP_ROM_PTR(&pin_PA23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RIGHT_TFT_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RIGHT_TFT_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RIGHT_TFT_RST), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_RIGHT_TFT_CS), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_RIGHT_TFT_DC), MP_ROM_PTR(&pin_PA07) }, + + // Left TFT control pins. Some pins are attached through the SeeSaw chip. + { MP_OBJ_NEW_QSTR(MP_QSTR_LEFT_TFT_MOSI), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LEFT_TFT_SCK), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_LEFT_TFT_CS), MP_ROM_PTR(&pin_PB23) }, + { MP_ROM_QSTR(MP_QSTR_LEFT_TFT_DC), MP_ROM_PTR(&pin_PB22) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, + { MP_ROM_QSTR(MP_QSTR_RIGHT_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c2e2e2d023..923c02b9ef 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -657,4 +657,8 @@ void run_background_tasks(void); #define CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS 1000 #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" +#ifndef CIRCUITPY_FS_NAME +#define CIRCUITPY_FS_NAME "CIRCUITPY" +#endif + #endif // __INCLUDED_MPCONFIG_CIRCUITPY_H diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index c50d7f4eeb..36b30f4622 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -91,7 +91,7 @@ void filesystem_init(bool create_allowed, bool force_create) { } // set label - f_setlabel(&vfs_fat->fatfs, "CIRCUITPY"); + f_setlabel(&vfs_fat->fatfs, CIRCUITPY_FS_NAME); // inhibit file indexing on MacOS f_mkdir(&vfs_fat->fatfs, "/.fseventsd"); From 8d836fa248d10b8943945423a069a3fba387f8a2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Aug 2019 00:33:27 -0700 Subject: [PATCH 13/41] Regular display fixes including refresh tweaks --- shared-module/displayio/Display.c | 25 ++++++++++++++++++------- shared-module/displayio/Display.h | 2 ++ shared-module/displayio/EPaperDisplay.c | 8 +++++--- shared-module/displayio/TileGrid.c | 2 +- shared-module/displayio/TileGrid.h | 2 +- shared-module/displayio/__init__.c | 4 +--- shared-module/displayio/display_core.c | 11 +++++++---- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 86800328fe..109b915074 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -64,21 +64,23 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, self->write_ram_command = write_ram_command; self->brightness_command = brightness_command; self->auto_brightness = auto_brightness; + self->auto_refresh = auto_refresh; + self->first_manual_refresh = !auto_refresh; self->data_as_commands = data_as_commands; self->native_frames_per_second = native_frames_per_second; self->native_frame_time = 1000 / native_frames_per_second; uint32_t i = 0; - while (!displayio_display_core_begin_transaction(&self->core)) { - RUN_BACKGROUND_TASKS; - } while (i < init_sequence_len) { uint8_t *cmd = init_sequence + i; uint8_t data_size = *(cmd + 1); bool delay = (data_size & DELAY) != 0; data_size &= ~DELAY; uint8_t *data = cmd + 2; + while (!displayio_display_core_begin_transaction(&self->core)) { + RUN_BACKGROUND_TASKS; + } if (self->data_as_commands) { uint8_t full_command[data_size + 1]; full_command[0] = cmd[0]; @@ -88,6 +90,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, self->core.send(self->core.bus, true, true, cmd, 1); self->core.send(self->core.bus, false, false, data, data_size); } + self->core.end_transaction(self->core.bus); uint16_t delay_length_ms = 10; if (delay) { data_size++; @@ -99,7 +102,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, common_hal_time_delay_ms(delay_length_ms); i += 2 + data_size; } - self->core.end_transaction(self->core.bus); supervisor_start_terminal(width, height); @@ -192,9 +194,10 @@ STATIC const displayio_area_t* _get_refresh_areas(displayio_display_obj_t *self) if (self->core.full_refresh) { self->core.area.next = NULL; return &self->core.area; - } else { + } else if (self->core.current_group != NULL) { return displayio_group_get_refresh_areas(self->core.current_group, NULL); } + return NULL; } STATIC void _send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length) { @@ -242,7 +245,7 @@ STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t* // Allocated and shared as a uint32_t array so the compiler knows the // alignment everywhere. uint32_t buffer[buffer_size]; - volatile uint32_t mask_length = (pixels_per_buffer / 32) + 1; + uint32_t mask_length = (pixels_per_buffer / 32) + 1; uint32_t mask[mask_length]; uint16_t remaining_rows = displayio_area_height(&clipped); @@ -311,7 +314,7 @@ uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self } void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_frame_time, uint32_t maximum_frame_time) { - if (!self->auto_refresh) { + if (!self->auto_refresh && !self->first_manual_refresh) { uint64_t current_time = ticks_ms; uint32_t current_frame_time = current_time - self->core.last_refresh; // Test to see if the real frame time is below our minimum. @@ -332,6 +335,7 @@ void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_ #endif } } + self->first_manual_refresh = false; _refresh_display(self); } @@ -341,6 +345,7 @@ bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self, bool auto_refresh) { + self->first_manual_refresh = !auto_refresh; self->auto_refresh = auto_refresh; } @@ -376,6 +381,12 @@ void release_display(displayio_display_obj_t* self) { } } +void reset_display(displayio_display_obj_t* self) { + self->auto_refresh = true; + self->auto_brightness = true; + common_hal_displayio_display_show(self, NULL); +} + void displayio_display_collect_ptrs(displayio_display_obj_t* self) { displayio_display_core_collect_ptrs(&self->core); } diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index cff566a619..bf2889c6d2 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -51,6 +51,7 @@ typedef struct { uint8_t set_row_command; uint8_t write_ram_command; bool auto_refresh; + bool first_manual_refresh; bool data_as_commands; bool auto_brightness; bool updating_backlight; @@ -58,6 +59,7 @@ typedef struct { void displayio_display_background(displayio_display_obj_t* self); void release_display(displayio_display_obj_t* self); +void reset_display(displayio_display_obj_t* self); void displayio_display_collect_ptrs(displayio_display_obj_t* self); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index bf0e6676fe..48143f14ff 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -102,10 +102,12 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self } const displayio_area_t* displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { - const displayio_area_t* first_area; if (self->core.full_refresh) { - first_area = &self->core.area; - } else { + self->core.area.next = NULL; + return &self->core.area; + } + const displayio_area_t* first_area = NULL; + if (self->core.current_group != NULL) { first_area = displayio_group_get_refresh_areas(self->core.current_group, NULL); } if (first_area != NULL && self->set_row_window_command == NO_COMMAND) { diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 6553cf9012..f34d2fc52d 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -207,7 +207,7 @@ uint8_t common_hal_displayio_tilegrid_get_tile(displayio_tilegrid_t *self, uint1 void common_hal_displayio_tilegrid_set_tile(displayio_tilegrid_t *self, uint16_t x, uint16_t y, uint8_t tile_index) { if (tile_index >= self->tiles_in_bitmap) { - mp_raise_ValueError(translate("Tile value out of bounds")); + mp_raise_ValueError(translate("Tile index out of bounds")); } uint8_t* tiles = self->tiles; if (self->inline_tiles) { diff --git a/shared-module/displayio/TileGrid.h b/shared-module/displayio/TileGrid.h index 222aaed19b..0a414b0620 100644 --- a/shared-module/displayio/TileGrid.h +++ b/shared-module/displayio/TileGrid.h @@ -43,7 +43,7 @@ typedef struct { uint16_t pixel_width; uint16_t pixel_height; uint16_t bitmap_width_in_tiles;; - uint8_t tiles_in_bitmap; + uint16_t tiles_in_bitmap; uint16_t width_in_tiles; uint16_t height_in_tiles; uint16_t tile_width; diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index a41884c78c..af22cb0df8 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -143,9 +143,7 @@ void reset_displays(void) { // Reset the displayed group. Only the first will get the terminal but // that's ok. if (displays[i].display.base.type == &displayio_display_type) { - displayio_display_obj_t* display = &displays[i].display; - display->auto_brightness = true; - common_hal_displayio_display_show(display, NULL); + reset_display(&displays[i].display); } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_obj_t* display = &displays[i].epaper_display; common_hal_displayio_epaperdisplay_show(display, NULL); diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 24d8ab51f0..88878866a5 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -82,8 +82,8 @@ void displayio_display_core_construct(displayio_display_core_t* self, self->width = width; self->height = height; - self->ram_width = width; - self->ram_height = height; + self->ram_width = ram_width; + self->ram_height = ram_height; rotation = rotation % 360; self->transform.x = 0; self->transform.y = 0; @@ -206,7 +206,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self, data[0] = column_command; uint8_t data_length = 1; if (!data_as_commands) { - self->send(self->bus, true, true, data, 1); + self->send(self->bus, true, false, data, 1); data_length = 0; } if (self->ram_width < 0x100) { @@ -227,11 +227,14 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self, self->send(self->bus, false, always_toggle_chip_select, data, data_length / 2); } + displayio_display_core_end_transaction(self); + displayio_display_core_begin_transaction(self); + // Set row. data[0] = row_command; data_length = 1; if (!data_as_commands) { - self->send(self->bus, true, true, data, 1); + self->send(self->bus, true, false, data, 1); data_length = 0; } if (self->ram_height < 0x100) { From d2d27a01b9671c74ae34b5fcc7146e29a4ac59f0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Aug 2019 12:59:17 -0700 Subject: [PATCH 14/41] Update translations --- locale/ID.po | 28 ++++++++++++++++++++++------ locale/circuitpython.pot | 28 ++++++++++++++++++++++------ locale/de_DE.po | 28 ++++++++++++++++++++++------ locale/en_US.po | 28 ++++++++++++++++++++++------ locale/en_x_pirate.po | 28 ++++++++++++++++++++++------ locale/es.po | 37 +++++++++++++++++++++++++++++-------- locale/fil.po | 28 ++++++++++++++++++++++------ locale/fr.po | 36 +++++++++++++++++++++++++++++------- locale/it_IT.po | 28 ++++++++++++++++++++++------ locale/pl.po | 35 ++++++++++++++++++++++++++++------- locale/pt_BR.po | 28 ++++++++++++++++++++++------ locale/zh_Latn_pinyin.po | 35 ++++++++++++++++++++++++++++------- 12 files changed, 290 insertions(+), 77 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 61991e6110..95b1c26dce 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -301,6 +301,10 @@ msgstr "" "Auto-reload aktif. Silahkan simpan data-data (files) melalui USB untuk " "menjalankannya atau masuk ke REPL untukmenonaktifkan.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock dan word harus memiliki kesamaan pada clock unit" @@ -533,6 +537,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -749,6 +754,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1026,8 +1032,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1104,6 +1110,10 @@ msgstr "sistem file (filesystem) bersifat Read-only" msgid "Read-only object" msgstr "sistem file (filesystem) bersifat Read-only" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Channel Kanan tidak didukung" @@ -1218,11 +1228,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1244,6 +1254,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1315,7 +1326,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "Baudrate tidak didukung" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "Baudrate tidak didukung" @@ -2198,6 +2209,11 @@ msgstr "tidak ada ikatan/bind pada temuan nonlocal" msgid "no module named '%q'" msgstr "tidak ada modul yang bernama '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 50de690fe4..d478baef44 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -297,6 +297,10 @@ msgid "" "disable.\n" msgstr "" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" @@ -522,6 +526,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -734,6 +739,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1010,8 +1016,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1085,6 +1091,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -1195,11 +1205,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1221,6 +1231,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1292,7 +1303,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "" @@ -2163,6 +2174,11 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index c74e5b1ff5..e39d157f45 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -301,6 +301,10 @@ msgstr "" "Automatisches Neuladen ist aktiv. Speichere Dateien über USB um sie " "auszuführen oder verbinde dich mit der REPL zum Deaktivieren.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock und word select müssen eine clock unit teilen" @@ -526,6 +530,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Die Rotation der Anzeige muss in 90-Grad-Schritten erfolgen" @@ -738,6 +743,7 @@ msgid "Function requires lock" msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1025,8 +1031,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1102,6 +1108,10 @@ msgstr "Schreibgeschützte Dateisystem" msgid "Read-only object" msgstr "Schreibgeschützte Objekt" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Rechter Kanal wird nicht unterstützt" @@ -1224,11 +1234,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1250,6 +1260,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Zu viele displays" @@ -1323,7 +1334,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "Baudrate wird nicht unterstützt" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "Nicht unterstützter display bus type" @@ -2210,6 +2221,11 @@ msgstr "" msgid "no module named '%q'" msgstr "Kein Modul mit dem Namen '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/en_US.po b/locale/en_US.po index ff4643875a..186ac9a4fb 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -297,6 +297,10 @@ msgid "" "disable.\n" msgstr "" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" @@ -522,6 +526,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -734,6 +739,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1010,8 +1016,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1085,6 +1091,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -1195,11 +1205,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1221,6 +1231,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1292,7 +1303,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "" @@ -2163,6 +2174,11 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 08b3db299a..21c49745cd 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -301,6 +301,10 @@ msgstr "" "Auto-reload be on. Put yer files on USB to weigh anchor, er' bring'er about " "t' the REPL t' scuttle.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" @@ -526,6 +530,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -738,6 +743,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1014,8 +1020,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1089,6 +1095,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -1199,11 +1209,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1225,6 +1235,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1296,7 +1307,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "" @@ -2167,6 +2178,11 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/es.po b/locale/es.po index 3b1b8ece5e..89052a6ba6 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -305,6 +305,10 @@ msgstr "" "Auto-reload habilitado. Simplemente guarda los archivos via USB para " "ejecutarlos o entra al REPL para desabilitarlos.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock y word select deben compartir una unidad de reloj" @@ -530,6 +534,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Rotación de display debe ser en incrementos de 90 grados" @@ -743,6 +748,7 @@ msgid "Function requires lock" msgstr "La función requiere lock" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1029,11 +1035,9 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" -"Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:% d " -"bppdado" #: shared-bindings/_pixelbuf/PixelBuf.c #, fuzzy @@ -1113,6 +1117,10 @@ msgstr "Sistema de archivos de solo-Lectura" msgid "Read-only object" msgstr "Solo-lectura" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal derecho no soportado" @@ -1235,11 +1243,11 @@ msgstr "El signo del sample no iguala al del mixer" msgid "Tile height must exactly divide bitmap height" msgstr "La altura del Tile debe dividir exacto la altura del bitmap" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1261,6 +1269,7 @@ msgid "Too many display busses" msgstr "Demasiados buses de pantalla" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Muchos displays" @@ -1332,7 +1341,7 @@ msgstr "Número incomparable de elementos en RHS (%d esperado,%d obtenido)" msgid "Unsupported baudrate" msgstr "Baudrate no soportado" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "tipo de bitmap no soportado" @@ -2222,6 +2231,11 @@ msgstr "no se ha encontrado ningún enlace para nonlocal" msgid "no module named '%q'" msgstr "ningún módulo se llama '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -2887,6 +2901,13 @@ msgstr "paso cero" #~ msgid "Only bit maps of 8 bit color or less are supported" #~ msgstr "Solo se admiten bit maps de color de 8 bits o menos" +#~ msgid "" +#~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " +#~ "bpp given" +#~ msgstr "" +#~ "Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:" +#~ "% d bppdado" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo color verdadero (24 bpp o superior) BMP admitido %x" diff --git a/locale/fil.po b/locale/fil.po index 3abdd882f8..b034afba01 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -303,6 +303,10 @@ msgstr "" "Ang awtomatikong pag re-reload ay ON. i-save lamang ang mga files sa USB " "para patakbuhin sila o pasukin ang REPL para i-disable ito.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Ang bit clock at word select dapat makibahagi sa isang clock unit" @@ -534,6 +538,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -752,6 +757,7 @@ msgid "Function requires lock" msgstr "Function nangangailangan ng lock" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1037,8 +1043,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1118,6 +1124,10 @@ msgstr "Basahin-lamang mode" msgid "Read-only object" msgstr "Basahin-lamang" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Hindi supportado ang kanang channel" @@ -1238,11 +1248,11 @@ msgstr "Ang signedness ng sample hindi tugma sa mixer" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1264,6 +1274,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1336,7 +1347,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "Hindi supportadong baudrate" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "Hindi supportadong tipo ng bitmap" @@ -2234,6 +2245,11 @@ msgstr "no binding para sa nonlocal, nahanap" msgid "no module named '%q'" msgstr "walang module na '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "walang ganoon na attribute" diff --git a/locale/fr.po b/locale/fr.po index c9c81da61e..d386723ebb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -308,6 +308,10 @@ msgstr "" "Auto-chargement activé. Copiez simplement les fichiers en USB pour les " "lancer ou entrez sur REPL pour le désactiver.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "'bit clock' et 'word select' doivent partager une horloge" @@ -538,6 +542,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "La rotation d'affichage doit se faire par incréments de 90 degrés" @@ -757,6 +762,7 @@ msgid "Function requires lock" msgstr "La fonction nécessite un verrou" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1049,10 +1055,9 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" -"Seul les BMP monochromes, 8bit indexé et 16bit sont supportés: %d bpp fourni" #: shared-bindings/_pixelbuf/PixelBuf.c #, fuzzy @@ -1134,6 +1139,10 @@ msgstr "Système de fichier en lecture seule" msgid "Read-only object" msgstr "Objet en lecture seule" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal droit non supporté" @@ -1259,11 +1268,11 @@ msgstr "Le signe de l'échantillon ne correspond pas à celui du mixer" msgid "Tile height must exactly divide bitmap height" msgstr "La hauteur de la tuile doit diviser exactement la hauteur de l'image" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1285,6 +1294,7 @@ msgid "Too many display busses" msgstr "Trop de bus d'affichage" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Trop d'affichages" @@ -1361,7 +1371,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "Débit non supporté" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "Type de bus d'affichage non supporté" @@ -2268,6 +2278,11 @@ msgstr "pas de lien trouvé pour nonlocal" msgid "no module named '%q'" msgstr "pas de module '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -2938,6 +2953,13 @@ msgstr "'step' nul" #~ msgid "Only bit maps of 8 bit color or less are supported" #~ msgstr "Seules les bitmaps de 8bits par couleur ou moins sont supportées" +#~ msgid "" +#~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " +#~ "bpp given" +#~ msgstr "" +#~ "Seul les BMP monochromes, 8bit indexé et 16bit sont supportés: %d bpp " +#~ "fourni" + #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Seul les BMP 24bits ou plus sont supportés %x" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4fb0b502f9..293ae97a0e 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -302,6 +302,10 @@ msgstr "" "L'auto-reload è attivo. Salva i file su USB per eseguirli o entra nel REPL " "per disabilitarlo.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" @@ -534,6 +538,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -751,6 +756,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1037,8 +1043,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1122,6 +1128,10 @@ msgstr "Filesystem in sola lettura" msgid "Read-only object" msgstr "Sola lettura" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canale destro non supportato" @@ -1237,11 +1247,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1263,6 +1273,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Troppi schermi" @@ -1335,7 +1346,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "baudrate non supportato" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "tipo di bitmap non supportato" @@ -2228,6 +2239,11 @@ msgstr "nessun binding per nonlocal trovato" msgid "no module named '%q'" msgstr "nessun modulo chiamato '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "attributo inesistente" diff --git a/locale/pl.po b/locale/pl.po index 8d995d93ab..c275bd4d05 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -300,6 +300,10 @@ msgstr "" "Samo-przeładowywanie włączone. Po prostu zapisz pliki przez USB aby je " "uruchomić, albo wejdź w konsolę aby wyłączyć.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Zegar bitowy i wybór słowa muszą współdzielić jednostkę zegara" @@ -525,6 +529,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Wyświetlacz można obracać co 90 stopni" @@ -737,6 +742,7 @@ msgid "Function requires lock" msgstr "Funkcja wymaga blokady" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1020,9 +1026,9 @@ msgstr "Wspierane są tylko nieskompresowane pliki BMP: wielkość nagłówka %d #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" -msgstr "Wspierane są tylko pliki BMP czarno-białe, 8bpp i 16bpp: %d bpp " +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" +msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Only slices with step=1 (aka None) are supported" @@ -1095,6 +1101,10 @@ msgstr "System plików tylko do odczytu" msgid "Read-only object" msgstr "Obiekt tylko do odczytu" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Prawy kanał jest niewspierany" @@ -1215,11 +1225,11 @@ msgstr "Znak nie pasuje do miksera" msgid "Tile height must exactly divide bitmap height" msgstr "Wysokość bitmapy musi być wielokrotnością wysokości kafelka" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1241,6 +1251,7 @@ msgid "Too many display busses" msgstr "Zbyt wiele magistrali" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Zbyt wiele wyświetlaczy" @@ -1312,7 +1323,7 @@ msgstr "Zła liczba obiektów po prawej stronie (oczekiwano %d, jest %d)." msgid "Unsupported baudrate" msgstr "Zła szybkość transmisji" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "Zły typ magistrali wyświetlaczy" @@ -2188,6 +2199,11 @@ msgstr "brak wiązania dla zmiennej nielokalnej" msgid "no module named '%q'" msgstr "brak modułu o nazwie '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" @@ -2769,6 +2785,11 @@ msgstr "zerowy krok" #~ msgid "Must be a Group subclass." #~ msgstr "Musi dziedziczyć z Group." +#~ msgid "" +#~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " +#~ "bpp given" +#~ msgstr "Wspierane są tylko pliki BMP czarno-białe, 8bpp i 16bpp: %d bpp " + #~ msgid "Tile indices must be 0 - 255" #~ msgstr "Indeks kafelka musi być pomiędzy 0 a 255 włącznie" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 6e7edbc2f7..2ae16f9922 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -300,6 +300,10 @@ msgid "" "disable.\n" msgstr "" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "" @@ -529,6 +533,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "" @@ -746,6 +751,7 @@ msgid "Function requires lock" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1028,8 +1034,8 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" #: shared-bindings/_pixelbuf/PixelBuf.c @@ -1105,6 +1111,10 @@ msgstr "Sistema de arquivos somente leitura" msgid "Read-only object" msgstr "Somente leitura" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal direito não suportado" @@ -1215,11 +1225,11 @@ msgstr "" msgid "Tile height must exactly divide bitmap height" msgstr "" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1241,6 +1251,7 @@ msgid "Too many display busses" msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "" @@ -1312,7 +1323,7 @@ msgstr "" msgid "Unsupported baudrate" msgstr "Taxa de transmissão não suportada" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c #, fuzzy msgid "Unsupported display bus type" msgstr "Taxa de transmissão não suportada" @@ -2189,6 +2200,11 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9a380fefc4..886bba62a3 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 15:20-0400\n" +"POT-Creation-Date: 2019-08-22 14:29-0700\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -301,6 +301,10 @@ msgstr "" "Zìdòng chóngxīn jiāzài. Zhǐ xū tōngguò USB bǎocún wénjiàn lái yùnxíng tāmen " "huò shūrù REPL jìnyòng.\n" +#: shared-module/displayio/Display.c +msgid "Below minimum frame rate" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" msgstr "Bǐtè shízhōng hé dānzì xuǎnzé bìxū gòngxiǎng shízhōng dānwèi" @@ -526,6 +530,7 @@ msgid "Display must have a 16 bit colorspace." msgstr "" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Display rotation must be in 90 degree increments" msgstr "Xiǎnshì xuánzhuǎn bìxū 90 dù jiā xīn" @@ -738,6 +743,7 @@ msgid "Function requires lock" msgstr "Hánshù xūyào suǒdìng" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" msgstr "" @@ -1023,10 +1029,9 @@ msgstr "" #: shared-module/displayio/OnDiskBitmap.c #, c-format msgid "" -"Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d bpp " -"given" +"Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " +"%d bpp given" msgstr "" -"Jǐn zhīchí dān sè, suǒyǐn 8bpp hé 16bpp huò gèng dà de BMP: %d bpp tígōng" #: shared-bindings/_pixelbuf/PixelBuf.c msgid "Only slices with step=1 (aka None) are supported" @@ -1100,6 +1105,10 @@ msgstr "Zhǐ dú wénjiàn xìtǒng" msgid "Read-only object" msgstr "Zhǐ dú duìxiàng" +#: shared-bindings/displayio/EPaperDisplay.c +msgid "Refresh too soon" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Bù zhīchí yòu tōngdào" @@ -1222,11 +1231,11 @@ msgstr "Yàngběn de qiānmíng yǔ hǔn yīn qì de qiānmíng bù pǐpèi" msgid "Tile height must exactly divide bitmap height" msgstr "Píng pū gāodù bìxū huàfēn wèi tú gāodù" -#: shared-bindings/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c +#: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" msgstr "" @@ -1248,6 +1257,7 @@ msgid "Too many display busses" msgstr "Xiǎnshì zǒngxiàn tài duōle" #: shared-bindings/displayio/Display.c +#: shared-bindings/displayio/EPaperDisplay.c msgid "Too many displays" msgstr "Xiǎnshì tài duō" @@ -1319,7 +1329,7 @@ msgstr "RHS (yùqí %d, huòdé %d) shàng wèi pǐpèi de xiàngmù." msgid "Unsupported baudrate" msgstr "Bù zhīchí de baudrate" -#: shared-module/displayio/Display.c +#: shared-module/displayio/display_core.c msgid "Unsupported display bus type" msgstr "Bù zhīchí de gōnggòng qìchē lèixíng" @@ -2202,6 +2212,11 @@ msgstr "zhǎo bù dào fēi běndì de bǎng dìng" msgid "no module named '%q'" msgstr "méiyǒu mókuài '%q'" +#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/displayio/ParallelBus.c +msgid "no reset pin available" +msgstr "" + #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -2798,6 +2813,12 @@ msgstr "líng bù" #~ msgid "Only bit maps of 8 bit color or less are supported" #~ msgstr "Jǐn zhīchí 8 wèi yánsè huò xiǎoyú" +#~ msgid "" +#~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " +#~ "bpp given" +#~ msgstr "" +#~ "Jǐn zhīchí dān sè, suǒyǐn 8bpp hé 16bpp huò gèng dà de BMP: %d bpp tígōng" + #~ msgid "Tile indices must be 0 - 255" #~ msgstr "Píng pū zhǐshù bìxū wèi 0 - 255" From fd8050b36956718acfc740132aa27498c24d846b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Aug 2019 15:19:45 -0700 Subject: [PATCH 15/41] Turn off features to make room for ePaper --- .../boards/feather_m0_express/mpconfigboard.mk | 4 ++++ .../boards/feather_m0_supersized/mpconfigboard.mk | 4 ++++ .../boards/hallowing_m0_express/mpconfigboard.h | 4 ++++ .../boards/hallowing_m0_express/mpconfigboard.mk | 9 +++++++-- .../atmel-samd/boards/metro_m0_express/mpconfigboard.mk | 3 +++ .../boards/sparkfun_redboard_turbo/mpconfigboard.mk | 3 +++ .../boards/trinket_m0_haxpress/mpconfigboard.mk | 4 ++++ ports/atmel-samd/boards/ugame10/board.c | 4 +++- 8 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index 756c293ad9..5b89f1be4f 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -12,5 +12,9 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CSLAVE = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index e34d069623..c5fef4373c 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -12,5 +12,9 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "S25FL064L" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CSLAVE = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h index 4b5460706b..d5c2745009 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.h @@ -35,3 +35,7 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 + +// SWD is only available on the test pads so skip the pin objects. +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 diff --git a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk index 92374721f8..988d10d1cd 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m0_express/mpconfigboard.mk @@ -13,10 +13,15 @@ EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, GD25Q64C" LONGINT_IMPL = MPZ # To keep the build small -CIRCUITPY_I2CSLAVE = 0 -CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_GAMEPAD = 0 +CIRCUITPY_I2CSLAVE = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_RTC = 0 + +CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 # Include these Python libraries in firmware. diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 93a8ffc117..d3f35ba8b0 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -12,5 +12,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_I2CSLAVE = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 3be1a17d3a..e80ef62771 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -12,5 +12,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "W25Q32FV" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_I2CSLAVE = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk index 76c33a333a..c20358e19f 100644 --- a/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trinket_m0_haxpress/mpconfigboard.mk @@ -12,4 +12,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = W25Q32BV LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CSLAVE = 0 + SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 72b0ed5777..ce389a2b1c 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -106,7 +106,9 @@ void board_init(void) { 1.0f, // brightness false, // auto_brightness false, // single_byte_bounds - false); // data as commands + false, // data as commands + true, // auto_refresh + 60); // native_frames_per_second } bool board_requests_safe_mode(void) { From 72e7ffa324f8184cb2d9a5ca9fa620a2a5a56b69 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Aug 2019 16:16:09 -0700 Subject: [PATCH 16/41] More cleanup --- ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 3 +++ shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/EPaperDisplay.h | 6 ------ shared-module/displayio/ColorConverter.c | 1 - shared-module/displayio/Group.c | 3 --- shared-module/displayio/OnDiskBitmap.c | 4 +--- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index 9892ade8f2..6ad78b0daf 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -12,5 +12,8 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "W25Q16JV_IQ" LONGINT_IMPL = MPZ +CIRCUITPY_GAMEPAD = 0 +CIRCUITPY_I2CSLAVE = 0 + CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index dd773e410c..5d0d8ac949 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -42,7 +42,7 @@ //| .. currentmodule:: displayio //| //| :class:`EPaperDisplay` -- Manage updating an epaper display over a display bus -//| ========================================================================== +//| ============================================================================== //| //| This initializes an epaper display and connects it into CircuitPython. Unlike other //| objects in CircuitPython, EPaperDisplay objects live until `displayio.release_displays()` diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 786fc3628f..e4b81c8838 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -53,15 +53,9 @@ bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t* self // Returns time in milliseconds. uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t* self); -bool common_hal_displayio_epaperdisplay_get_auto_brightness(displayio_epaperdisplay_obj_t* self); -void common_hal_displayio_epaperdisplay_set_auto_brightness(displayio_epaperdisplay_obj_t* self, bool auto_brightness); - uint16_t common_hal_displayio_epaperdisplay_get_width(displayio_epaperdisplay_obj_t* self); uint16_t common_hal_displayio_epaperdisplay_get_height(displayio_epaperdisplay_obj_t* self); -mp_float_t common_hal_displayio_epaperdisplay_get_brightness(displayio_epaperdisplay_obj_t* self); -bool common_hal_displayio_epaperdisplay_set_brightness(displayio_epaperdisplay_obj_t* self, mp_float_t brightness); - mp_obj_t common_hal_displayio_epaperdisplay_get_bus(displayio_epaperdisplay_obj_t* self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_EPAPERDISPLAY_H diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 0277c79f0f..e0c4ca2869 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -142,7 +142,6 @@ bool displayio_colorconverter_convert(displayio_colorconverter_t *self, const _d uint8_t luma = displayio_colorconverter_compute_luma(input_color); *output_color = luma >> (8 - colorspace->depth); return true; - } else if (!colorspace->grayscale && colorspace->depth == 1) { } return false; } diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index eb6e9a4537..38418a0299 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -304,9 +304,6 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t* displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t* tail) { - if (self->base.type != &displayio_group_type) { - asm("bkpt"); - } if (self->item_removed) { self->dirty_area.next = tail; tail = &self->dirty_area; diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 10fc0c4a2e..993fc03de6 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -149,10 +149,8 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s if (self->bits_per_pixel == 1) { if (index == 1) { return 0xFFFFFF; - } else if (index == 0) { - return 0x000000; } else { - asm("bkpt"); + return 0x000000; } } return self->palette_data[index]; From b992ca80e77ccd95397ed0f12063c30f6161e08f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Aug 2019 20:29:58 -0700 Subject: [PATCH 17/41] Rejigger builds to fit under 50 minute limit --- .travis.yml | 5 +++-- .../atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk | 3 +-- ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d084a3042e..47e7dea781 100755 --- a/.travis.yml +++ b/.travis.yml @@ -35,8 +35,9 @@ env: - TRAVIS_BOARDS="itsybitsy_m0_express metro_m0_express pirkey_m0 pyruler trinket_m0 trinket_m0_haxpress arduino_mkr1300 arduino_mkrzero arduino_zero bast_pro_mini_m0 catwan_usbstick datum_distance datum_imu datum_weather" TRAVIS_SDK=arm - TRAVIS_BOARDS="escornabot_makech meowmeow pewpew10 robohatmm1_m0 snekboard sparkfun_lumidrive sparkfun_redboard_turbo sparkfun_samd21_dev sparkfun_samd21_mini uchip ugame10" TRAVIS_SDK=arm # Adafruit SAMD51 (M4) + Other SAMD51 - - TRAVIS_BOARDS="feather_m4_express grandcentral_m4_express itsybitsy_m4_express metro_m4_airlift_lite metro_m4_express pybadge pybadge_airlift pygamer pygamer_advance monster_m4sk" TRAVIS_SDK=arm - - TRAVIS_BOARDS="pyportal pyportal_titano trellis_m4_express capablerobot_usbhub cp32-m4 datalore_ip_m4 datum_light kicksat-sprite mini_sam_m4 robohatmm1_m4 sam32" TRAVIS_SDK=arm + - TRAVIS_BOARDS="feather_m4_express grandcentral_m4_express itsybitsy_m4_express metro_m4_airlift_lite metro_m4_express pybadge pybadge_airlift" TRAVIS_SDK=arm + - TRAVIS_BOARDS="pyportal pyportal_titano trellis_m4_express capablerobot_usbhub cp32-m4 datalore_ip_m4 datum_light" TRAVIS_SDK=arm + - TRAVIS_BOARDS="pygamer pygamer_advance monster_m4sk kicksat-sprite mini_sam_m4 robohatmm1_m4 sam32" TRAVIS_SDK=arm addons: diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk index 410a0e0877..10975931ff 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk @@ -12,11 +12,10 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_RTC = 0 CFLAGS_INLINE_LIMIT = 60 SUPEROPT_GC = 0 -CIRCUITPY_I2CSLAVE = 0 -CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index 6ad78b0daf..db2e511abf 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -12,6 +12,7 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = "W25Q16JV_IQ" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANGIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 From 5662b5813e477a515dc3252fef29d6a92d338a4b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 23 Aug 2019 12:13:11 -0700 Subject: [PATCH 18/41] Use size_t and document buffers can be the same. --- shared-bindings/bitbangio/I2C.c | 7 ++++--- shared-bindings/busio/I2C.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index a6276dca0b..01a128393b 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -180,7 +180,7 @@ STATIC void readfrom(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffe mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, end, &length); if (length == 0) { mp_raise_ValueError(translate("Buffer must be at least length 1")); @@ -238,7 +238,7 @@ STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, end, &length); // do the transfer @@ -275,7 +275,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr //| .. method:: writeto_then_readfrom(address, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) //| //| Write the bytes from ``out_buffer`` to the slave specified by ``address``, generate no stop -//| bit, generate a repeated start and read into ``in_buffer``. +//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and +//| ``in_buffer`` can be the same buffer because they are used sequentially. //| //| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index f3c1503edb..3bd89e2e20 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -194,7 +194,7 @@ STATIC void readfrom(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, i mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, end, &length); if (length == 0) { mp_raise_ValueError(translate("Buffer must be at least length 1")); @@ -253,7 +253,7 @@ STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, in mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, end, &length); // do the transfer @@ -288,7 +288,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); //| .. method:: writeto_then_readfrom(address, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) //| //| Write the bytes from ``out_buffer`` to the slave specified by ``address``, generate no stop -//| bit, generate a repeated start and read into ``in_buffer``. +//| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and +//| ``in_buffer`` can be the same buffer because they are used sequentially. //| //| If ``start`` or ``end`` is provided, then the corresponding buffer will be sliced //| as if ``buffer[start:end]``. This will not cause an allocation like ``buf[start:end]`` From 7324b70a7c231a20be971ed81050c8359b87aaab Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 23 Aug 2019 15:27:21 -0700 Subject: [PATCH 19/41] Rework based on Dan's review --- .../boards/monster_m4sk/mpconfigboard.h | 2 - .../common-hal/displayio/ParallelBus.c | 4 +- ports/nrf/common-hal/displayio/ParallelBus.c | 5 +- py/circuitpy_mpconfig.h | 4 -- shared-bindings/_stage/__init__.c | 2 +- shared-bindings/displayio/Display.c | 24 +++++++--- shared-bindings/displayio/Display.h | 2 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/displayio/FourWire.c | 8 +++- shared-bindings/displayio/FourWire.h | 4 +- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/displayio/I2CDisplay.h | 4 +- shared-bindings/displayio/ParallelBus.c | 4 +- shared-bindings/displayio/ParallelBus.h | 5 +- shared-bindings/displayio/__init__.h | 19 ++++++++ shared-module/_stage/__init__.c | 4 +- shared-module/displayio/ColorConverter.c | 38 +++------------ shared-module/displayio/Display.c | 47 +++++++++---------- shared-module/displayio/Display.h | 2 +- shared-module/displayio/EPaperDisplay.c | 24 ++++------ shared-module/displayio/EPaperDisplay.h | 2 +- shared-module/displayio/FourWire.c | 7 +-- shared-module/displayio/I2CDisplay.c | 7 +-- shared-module/displayio/display_core.c | 38 ++++++++++----- shared-module/displayio/display_core.h | 7 +-- supervisor/shared/filesystem.c | 2 +- 26 files changed, 137 insertions(+), 132 deletions(-) diff --git a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h index 484f3d7b2f..fc77520f5f 100644 --- a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h +++ b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.h @@ -27,5 +27,3 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 - -#define CIRCUITPY_FS_NAME "MONSTERM4SK" diff --git a/ports/atmel-samd/common-hal/displayio/ParallelBus.c b/ports/atmel-samd/common-hal/displayio/ParallelBus.c index e2ce9952b4..2479e3b40e 100644 --- a/ports/atmel-samd/common-hal/displayio/ParallelBus.c +++ b/ports/atmel-samd/common-hal/displayio/ParallelBus.c @@ -131,9 +131,9 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); - common_hal_digitalio_digitalinout_set_value(&self->command, !command); + common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR.reg; uint32_t* set_write = (uint32_t*) &self->write_group->OUTSET.reg; uint32_t mask = self->write_mask; diff --git a/ports/nrf/common-hal/displayio/ParallelBus.c b/ports/nrf/common-hal/displayio/ParallelBus.c index a8c2b9f73c..be4b28a6e6 100644 --- a/ports/nrf/common-hal/displayio/ParallelBus.c +++ b/ports/nrf/common-hal/displayio/ParallelBus.c @@ -142,9 +142,10 @@ bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_parallelbus_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { +// This ignores chip_select behaviour because data is clocked in by the write line toggling. +void common_hal_displayio_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { displayio_parallelbus_obj_t* self = MP_OBJ_TO_PTR(obj); - common_hal_digitalio_digitalinout_set_value(&self->command, !command); + common_hal_digitalio_digitalinout_set_value(&self->command, byte_type == DISPLAY_DATA); uint32_t* clear_write = (uint32_t*) &self->write_group->OUTCLR; uint32_t* set_write = (uint32_t*) &self->write_group->OUTSET; uint32_t mask = self->write_mask; diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 923c02b9ef..c2e2e2d023 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -657,8 +657,4 @@ void run_background_tasks(void); #define CIRCUITPY_FILESYSTEM_FLUSH_INTERVAL_MS 1000 #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" -#ifndef CIRCUITPY_FS_NAME -#define CIRCUITPY_FS_NAME "CIRCUITPY" -#endif - #endif // __INCLUDED_MPCONFIG_CIRCUITPY_H diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 1d970cce4b..d18d306f44 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -107,7 +107,7 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { area.y2 = y1; displayio_display_core_set_region_to_update(&display->core, display->set_column_command, display->set_row_command, NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area); - display->core.send(display->core.bus, true, true, &display->write_ram_command, 1); + display->core.send(display->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &display->write_ram_command, 1); render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, display, scale); displayio_display_core_end_transaction(&display->core); diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index ded4119ca5..1eb1943b82 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -218,16 +218,22 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) } MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); -//| .. method:: refresh(*, target_frames_per_second=None, minimum_frames_per_second=1) +//| .. method:: refresh(*, target_frames_per_second=60, minimum_frames_per_second=1) //| -//| When auto refresh is off, waits for the target frame rate and then refreshes the display. If -//| the call is too late for the given target frame rate, then the refresh returns immediately -//| without updating the screen to hopefully help getting caught up. If the current frame rate -//| is below the minimum frame rate, then an exception will be raised. +//| When auto refresh is off, waits for the target frame rate and then refreshes the display, +//| returning True. If the call has taken too long since the last refresh call for the given +//| target frame rate, then the refresh returns False immediately without updating the screen to +//| hopefully help getting caught up. +//| +//| If the time since the last successful refresh is below the minimum frame rate, then an +//| exception will be raised. Set minimum_frames_per_second to 0 to disable. //| //| When auto refresh is on, updates the display immediately. (The display will also update //| without calls to this.) //| +//| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; static const mp_arg_t allowed_args[] = { @@ -238,8 +244,12 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); displayio_display_obj_t *self = native_display(pos_args[0]); - common_hal_displayio_display_refresh(self, 1000 / args[ARG_target_frames_per_second].u_int, 1000 / args[ARG_minimum_frames_per_second].u_int); - return mp_const_none; + uint32_t maximum_ms_per_real_frame = 0xffffffff; + mp_int_t minimum_frames_per_second = args[ARG_minimum_frames_per_second].u_int; + if (minimum_frames_per_second > 0) { + maximum_ms_per_real_frame = 1000 / minimum_frames_per_second; + } + return mp_obj_new_bool(common_hal_displayio_display_refresh(self, 1000 / args[ARG_target_frames_per_second].u_int, maximum_ms_per_real_frame)); } MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_obj_refresh); diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 06c848d0d3..2d7b68c4ed 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -51,7 +51,7 @@ bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); // Times in ms. -void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_frame_time, uint32_t maximum_frame_time); +bool common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame); bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self); void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self, bool auto_refresh); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 5d0d8ac949..81e06f82f9 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -55,7 +55,7 @@ //| //| Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `displayio.ParallelBus`). //| -//| The ``start_sequence`` and ``stop_sequence`` bitpacked to minimize the ram impact. Every +//| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every //| command begins with a command byte followed by a byte to determine the parameter count and if //| a delay is need after. When the top bit of the second byte is 1, the next byte will be the //| delay time in milliseconds. The remaining 7 bits are the parameter count excluding any delay diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index c696233442..51203d4604 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -146,8 +146,12 @@ STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_a while (!common_hal_displayio_fourwire_begin_transaction(self)) { RUN_BACKGROUND_TASKS; } - common_hal_displayio_fourwire_send(self, true, args[ARG_toggle_every_byte].u_bool, &command, 1); - common_hal_displayio_fourwire_send(self, false, args[ARG_toggle_every_byte].u_bool, ((uint8_t*) bufinfo.buf), bufinfo.len); + display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED; + if (args[ARG_toggle_every_byte].u_bool) { + chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE; + } + common_hal_displayio_fourwire_send(self, DISPLAY_COMMAND, chip_select, &command, 1); + common_hal_displayio_fourwire_send(self, DISPLAY_DATA, chip_select, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_fourwire_end_transaction(self); return mp_const_none; diff --git a/shared-bindings/displayio/FourWire.h b/shared-bindings/displayio/FourWire.h index 9c71d63cc9..d0935f0639 100644 --- a/shared-bindings/displayio/FourWire.h +++ b/shared-bindings/displayio/FourWire.h @@ -28,6 +28,8 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_FOURWIRE_H #include "shared-module/displayio/FourWire.h" + +#include "shared-bindings/displayio/__init__.h" #include "common-hal/microcontroller/Pin.h" #include "shared-module/displayio/Group.h" @@ -45,7 +47,7 @@ bool common_hal_displayio_fourwire_bus_free(mp_obj_t self); bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t self); -void common_hal_displayio_fourwire_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); +void common_hal_displayio_fourwire_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); void common_hal_displayio_fourwire_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 4de5e83ef1..4339d182f4 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -131,7 +131,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_ob uint8_t full_command[bufinfo.len + 1]; full_command[0] = command; memcpy(full_command + 1, ((uint8_t*) bufinfo.buf), bufinfo.len); - common_hal_displayio_i2cdisplay_send(self, true, false, full_command, bufinfo.len + 1); + common_hal_displayio_i2cdisplay_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, full_command, bufinfo.len + 1); common_hal_displayio_i2cdisplay_end_transaction(self); return mp_const_none; diff --git a/shared-bindings/displayio/I2CDisplay.h b/shared-bindings/displayio/I2CDisplay.h index 683cff383b..bae53c4914 100644 --- a/shared-bindings/displayio/I2CDisplay.h +++ b/shared-bindings/displayio/I2CDisplay.h @@ -28,6 +28,8 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_I2CDISPLAY_H #include "shared-module/displayio/I2CDisplay.h" + +#include "shared-bindings/displayio/__init__.h" #include "common-hal/microcontroller/Pin.h" extern const mp_obj_type_t displayio_i2cdisplay_type; @@ -42,7 +44,7 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t self); bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t self); -void common_hal_displayio_i2cdisplay_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); +void common_hal_displayio_i2cdisplay_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); void common_hal_displayio_i2cdisplay_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/ParallelBus.c b/shared-bindings/displayio/ParallelBus.c index a08c37679b..f7195b9ccb 100644 --- a/shared-bindings/displayio/ParallelBus.c +++ b/shared-bindings/displayio/ParallelBus.c @@ -139,8 +139,8 @@ STATIC mp_obj_t displayio_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_o while (!common_hal_displayio_parallelbus_begin_transaction(self)) { RUN_BACKGROUND_TASKS; } - common_hal_displayio_parallelbus_send(self, true, false, &command, 1); - common_hal_displayio_parallelbus_send(self, false, false, ((uint8_t*) bufinfo.buf), bufinfo.len); + common_hal_displayio_parallelbus_send(self, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, &command, 1); + common_hal_displayio_parallelbus_send(self, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*) bufinfo.buf), bufinfo.len); common_hal_displayio_parallelbus_end_transaction(self); return mp_const_none; diff --git a/shared-bindings/displayio/ParallelBus.h b/shared-bindings/displayio/ParallelBus.h index a0f967332c..be2aef7d44 100644 --- a/shared-bindings/displayio/ParallelBus.h +++ b/shared-bindings/displayio/ParallelBus.h @@ -28,8 +28,9 @@ #define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYBUSIO_PARALLELBUS_H #include "common-hal/displayio/ParallelBus.h" -#include "common-hal/microcontroller/Pin.h" +#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/displayio/__init__.h" #include "shared-module/displayio/Group.h" extern const mp_obj_type_t displayio_parallelbus_type; @@ -45,7 +46,7 @@ bool common_hal_displayio_parallelbus_bus_free(mp_obj_t self); bool common_hal_displayio_parallelbus_begin_transaction(mp_obj_t self); -void common_hal_displayio_parallelbus_send(mp_obj_t self, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); +void common_hal_displayio_parallelbus_send(mp_obj_t self, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); void common_hal_displayio_parallelbus_end_transaction(mp_obj_t self); diff --git a/shared-bindings/displayio/__init__.h b/shared-bindings/displayio/__init__.h index 427ddb47dd..122b1fbcbe 100644 --- a/shared-bindings/displayio/__init__.h +++ b/shared-bindings/displayio/__init__.h @@ -27,6 +27,25 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H +#include "py/obj.h" + +typedef enum { + DISPLAY_COMMAND, + DISPLAY_DATA +} display_byte_type_t; + + +typedef enum { + CHIP_SELECT_UNTOUCHED, + CHIP_SELECT_TOGGLE_EVERY_BYTE +} display_chip_select_behavior_t; + +typedef bool (*display_bus_bus_reset)(mp_obj_t bus); +typedef bool (*display_bus_bus_free)(mp_obj_t bus); +typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); +typedef void (*display_bus_send)(mp_obj_t bus, display_byte_type_t byte_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length); +typedef void (*display_bus_end_transaction)(mp_obj_t bus); + void common_hal_displayio_release_displays(void); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO___INIT___H diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index bfef165e7b..2c525be87e 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -57,7 +57,7 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, index += 1; // The buffer is full, send it. if (index >= buffer_size) { - display->core.send(display->core.bus, false, false, ((uint8_t*)buffer), + display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer), buffer_size * 2); index = 0; } @@ -67,6 +67,6 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, } // Send the remaining data. if (index) { - display->core.send(display->core.bus, false, false, ((uint8_t*)buffer), index * 2); + display->core.send(display->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, ((uint8_t*)buffer), index * 2); } } diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index e0c4ca2869..940aaa1c6d 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -26,6 +26,8 @@ #include "shared-bindings/displayio/ColorConverter.h" +#include "py/misc.h" + void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t* self) { } @@ -45,39 +47,12 @@ uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888) { return (r8 * 19) / 255 + (g8 * 182) / 255 + (b8 + 54) / 255; } -void compute_bounds(uint8_t r8, uint8_t g8, uint8_t b8, uint8_t* min, uint8_t* max) { - if (r8 > g8) { - if (b8 > r8) { - *max = b8; - } else { - *max = r8; - } - if (b8 < g8) { - *min = b8; - } else { - *min = g8; - } - } else { - if (b8 > g8) { - *max = b8; - } else { - *max = g8; - } - if (b8 < r8) { - *min = b8; - } else { - *min = r8; - } - } -} - uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888) { uint32_t r8 = (color_rgb888 >> 16); uint32_t g8 = (color_rgb888 >> 8) & 0xff; uint32_t b8 = color_rgb888 & 0xff; - uint8_t max; - uint8_t min; - compute_bounds(r8, g8, b8, &min, &max); + uint8_t max = MAX(r8, MAX(g8, b8)); + uint8_t min = MIN(r8, MIN(g8, b8)); return max - min; } @@ -85,9 +60,8 @@ uint8_t displayio_colorconverter_compute_hue(uint32_t color_rgb888) { uint32_t r8 = (color_rgb888 >> 16); uint32_t g8 = (color_rgb888 >> 8) & 0xff; uint32_t b8 = color_rgb888 & 0xff; - uint8_t max; - uint8_t min; - compute_bounds(r8, g8, b8, &min, &max); + uint8_t max = MAX(r8, MAX(g8, b8)); + uint8_t min = MIN(r8, MIN(g8, b8)); uint8_t c = max - min; if (c == 0) { return 0; diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 109b915074..cb5051bb76 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -69,7 +69,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, self->data_as_commands = data_as_commands; self->native_frames_per_second = native_frames_per_second; - self->native_frame_time = 1000 / native_frames_per_second; + self->native_ms_per_frame = 1000 / native_frames_per_second; uint32_t i = 0; while (i < init_sequence_len) { @@ -85,10 +85,10 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, uint8_t full_command[data_size + 1]; full_command[0] = cmd[0]; memcpy(full_command + 1, data, data_size); - self->core.send(self->core.bus, true, true, full_command, data_size + 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, full_command, data_size + 1); } else { - self->core.send(self->core.bus, true, true, cmd, 1); - self->core.send(self->core.bus, false, false, data, data_size); + self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1); + self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, data, data_size); } self->core.end_transaction(self->core.bus); uint16_t delay_length_ms = 10; @@ -168,12 +168,12 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t* self, if (ok) { if (self->data_as_commands) { uint8_t set_brightness[2] = {self->brightness_command, (uint8_t) (0xff * brightness)}; - self->core.send(self->core.bus, true, true, set_brightness, 2); + self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, set_brightness, 2); } else { uint8_t command = self->brightness_command; uint8_t hex_brightness = 0xff * brightness; - self->core.send(self->core.bus, true, true, &command, 1); - self->core.send(self->core.bus, false, false, &hex_brightness, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &command, 1); + self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, &hex_brightness, 1); } displayio_display_core_end_transaction(&self->core); } @@ -202,9 +202,9 @@ STATIC const displayio_area_t* _get_refresh_areas(displayio_display_obj_t *self) STATIC void _send_pixels(displayio_display_obj_t* self, uint8_t* pixels, uint32_t length) { if (!self->data_as_commands) { - self->core.send(self->core.bus, true, true, &self->write_ram_command, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &self->write_ram_command, 1); } - self->core.send(self->core.bus, false, false, pixels, length); + self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, pixels, length); } STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t* area) { @@ -270,12 +270,8 @@ STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t* subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); } - for (uint16_t k = 0; k < mask_length; k++) { - mask[k] = 0x00000000; - } - for (uint16_t k = 0; k < buffer_size; k++) { - buffer[k] = 0x00000000; - } + memset(mask, 0, mask_length * sizeof(uint32_t)); + memset(buffer, 0, buffer_size * sizeof(uint32_t)); displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); @@ -313,30 +309,29 @@ uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self return self->core.rotation; } -void common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_frame_time, uint32_t maximum_frame_time) { +bool common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame) { if (!self->auto_refresh && !self->first_manual_refresh) { uint64_t current_time = ticks_ms; - uint32_t current_frame_time = current_time - self->core.last_refresh; + uint32_t current_ms_since_real_refresh = current_time - self->core.last_refresh; // Test to see if the real frame time is below our minimum. - if (current_frame_time > maximum_frame_time) { + if (current_ms_since_real_refresh > maximum_ms_per_real_frame) { mp_raise_RuntimeError(translate("Below minimum frame rate")); } - uint32_t current_call_time = current_time - self->last_refresh_call; + uint32_t current_ms_since_last_call = current_time - self->last_refresh_call; self->last_refresh_call = current_time; // Skip the actual refresh to help catch up. - if (current_call_time > target_frame_time) { - return; + if (current_ms_since_last_call > target_ms_per_frame) { + return false; } - uint32_t remaining_time = target_frame_time - (current_frame_time % target_frame_time); + uint32_t remaining_time = target_ms_per_frame - (current_ms_since_real_refresh % target_ms_per_frame); // We're ahead of the game so wait until we align with the frame rate. while (ticks_ms - self->last_refresh_call < remaining_time) { - #ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP ; - #endif + RUN_BACKGROUND_TASKS; } } self->first_manual_refresh = false; _refresh_display(self); + return true; } bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self) { @@ -366,7 +361,7 @@ STATIC void _update_backlight(displayio_display_obj_t* self) { void displayio_display_background(displayio_display_obj_t* self) { _update_backlight(self); - if (self->auto_refresh && (ticks_ms - self->core.last_refresh) > self->native_frame_time) { + if (self->auto_refresh && (ticks_ms - self->core.last_refresh) > self->native_ms_per_frame) { _refresh_display(self); } } diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index bf2889c6d2..e5fe0a7088 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -46,7 +46,7 @@ typedef struct { mp_float_t current_brightness; uint16_t brightness_command; uint16_t native_frames_per_second; - uint16_t native_frame_time; + uint16_t native_ms_per_frame; uint8_t set_column_command; uint8_t set_row_command; uint8_t write_ram_command; diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 48143f14ff..38b63df0fd 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -71,7 +71,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->busy_state = busy_state; self->refreshing = false; self->milliseconds_per_frame = seconds_per_frame * 1000; - self->always_toggle_chip_select = always_toggle_chip_select; + self->always_toggle_chip_select = always_toggle_chip_select ? CHIP_SELECT_TOGGLE_EVERY_BYTE : CHIP_SELECT_UNTOUCHED; self->start_sequence = start_sequence; self->start_sequence_len = start_sequence_len; @@ -130,9 +130,7 @@ STATIC void wait_for_busy(displayio_epaperdisplay_obj_t* self) { return; } while (common_hal_digitalio_digitalinout_get_value(&self->busy) == self->busy_state) { - #ifdef MICROPY_VM_HOOK_LOOP - MICROPY_VM_HOOK_LOOP - #endif + RUN_BACKGROUND_TASKS; } } @@ -145,8 +143,8 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool shou data_size &= ~DELAY; uint8_t *data = cmd + 2; displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, true, self->always_toggle_chip_select, cmd, 1); - self->core.send(self->core.bus, false, self->always_toggle_chip_select, data, data_size); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, cmd, 1); + self->core.send(self->core.bus, DISPLAY_DATA, self->always_toggle_chip_select, data, data_size); displayio_display_core_end_transaction(&self->core); uint16_t delay_length_ms = 0; if (delay) { @@ -187,7 +185,7 @@ uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaper void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) { // Actually refresh the display now that all pixel RAM has been updated. displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, true, self->always_toggle_chip_select, &self->refresh_display_command, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, &self->refresh_display_command, 1); displayio_display_core_end_transaction(&self->core); self->refreshing = true; @@ -248,7 +246,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c write_command = self->write_color_ram_command; } displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, true, self->always_toggle_chip_select, &write_command, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, &write_command, 1); displayio_display_core_end_transaction(&self->core); for (uint16_t j = 0; j < subrectangles; j++) { @@ -266,12 +264,8 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c uint16_t subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); - for (uint16_t k = 0; k < mask_length; k++) { - mask[k] = 0x00000000; - } - for (uint16_t k = 0; k < buffer_size; k++) { - buffer[k] = 0x00000000; - } + memset(mask, 0, mask_length * sizeof(uint32_t)); + memset(buffer, 0, buffer_size * sizeof(uint32_t)); self->core.colorspace.grayscale = true; if (pass == 1) { @@ -291,7 +285,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c // Can't acquire display bus; skip the rest of the data. Try next display. return false; } - self->core.send(self->core.bus, false, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); + self->core.send(self->core.bus, DISPLAY_DATA, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); displayio_display_core_end_transaction(&self->core); // TODO(tannewt): Make refresh displays faster so we don't starve other diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index a5d4ec93f9..580171a5f1 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -56,7 +56,7 @@ typedef struct { bool black_bits_inverted; bool color_bits_inverted; bool refreshing; - bool always_toggle_chip_select; + display_chip_select_behavior_t always_toggle_chip_select; } displayio_epaperdisplay_obj_t; void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self); diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 7294e9772c..fcc4c1a20a 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -33,6 +33,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/display_core.h" #include "tick.h" @@ -110,10 +111,10 @@ bool common_hal_displayio_fourwire_begin_transaction(mp_obj_t obj) { return true; } -void common_hal_displayio_fourwire_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_fourwire_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { displayio_fourwire_obj_t* self = MP_OBJ_TO_PTR(obj); - common_hal_digitalio_digitalinout_set_value(&self->command, !command); - if (toggle_every_byte) { + common_hal_digitalio_digitalinout_set_value(&self->command, data_type == DISPLAY_DATA); + if (chip_select == CHIP_SELECT_TOGGLE_EVERY_BYTE) { // Toggle chip select after each command byte in case the display driver // IC latches commands based on it. for (size_t i = 0; i < data_length; i++) { diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 95830ba0e8..87261dca00 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -35,6 +35,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/time/__init__.h" +#include "shared-module/displayio/display_core.h" #include "tick.h" @@ -80,7 +81,7 @@ bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) { } common_hal_digitalio_digitalinout_set_value(&self->reset, false); - common_hal_mcu_delay_us(1); + common_hal_mcu_delay_us(4); common_hal_digitalio_digitalinout_set_value(&self->reset, true); return true; } @@ -97,9 +98,9 @@ bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { return common_hal_displayio_i2cdisplay_bus_free(obj); } -void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length) { +void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); - if (command) { + if (data_type == DISPLAY_COMMAND) { uint8_t command_bytes[2 * data_length]; for (uint32_t i = 0; i < data_length; i++) { command_bytes[2 * i] = 0x80; diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 88878866a5..0f449ea34d 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -184,7 +184,6 @@ void displayio_display_core_end_transaction(displayio_display_core_t* self) { } void displayio_display_core_set_region_to_update(displayio_display_core_t* self, uint8_t column_command, uint8_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, bool data_as_commands, bool always_toggle_chip_select, displayio_area_t* area) { - displayio_display_core_begin_transaction(self); uint16_t x1 = area->x1; uint16_t x2 = area->x2; uint16_t y1 = area->y1; @@ -201,13 +200,22 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self, } } + display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED; + if (always_toggle_chip_select || data_as_commands) { + chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE; + } + // Set column. + displayio_display_core_begin_transaction(self); uint8_t data[5]; data[0] = column_command; uint8_t data_length = 1; + display_byte_type_t data_type = DISPLAY_DATA; if (!data_as_commands) { - self->send(self->bus, true, false, data, 1); + self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); data_length = 0; + } else { + data_type = DISPLAY_COMMAND; } if (self->ram_width < 0x100) { data[data_length++] = x1 + self->colstart; @@ -220,21 +228,23 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self, data[data_length++] = x2 >> 8; data[data_length++] = x2 & 0xff; } - self->send(self->bus, data_as_commands, data_as_commands, data, data_length); + self->send(self->bus, data_type, chip_select, data, data_length); + displayio_display_core_end_transaction(self); if (set_current_column_command != NO_COMMAND) { uint8_t command = set_current_column_command; - self->send(self->bus, true, always_toggle_chip_select, &command, 1); - self->send(self->bus, false, always_toggle_chip_select, data, data_length / 2); + displayio_display_core_begin_transaction(self); + self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1); + self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2); + displayio_display_core_end_transaction(self); } - displayio_display_core_end_transaction(self); - displayio_display_core_begin_transaction(self); // Set row. + displayio_display_core_begin_transaction(self); data[0] = row_command; data_length = 1; if (!data_as_commands) { - self->send(self->bus, true, false, data, 1); + self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); data_length = 0; } if (self->ram_height < 0x100) { @@ -248,14 +258,16 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t* self, data[data_length++] = y2 >> 8; data[data_length++] = y2 & 0xff; } - self->send(self->bus, data_as_commands, data_as_commands, data, data_length); + self->send(self->bus, data_type, chip_select, data, data_length); + displayio_display_core_end_transaction(self); + if (set_current_row_command != NO_COMMAND) { uint8_t command = set_current_row_command; - self->send(self->bus, true, always_toggle_chip_select, &command, 1); - self->send(self->bus, false, always_toggle_chip_select, data, data_length / 2); + displayio_display_core_begin_transaction(self); + self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1); + self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2); + displayio_display_core_end_transaction(self); } - - displayio_display_core_end_transaction(self); } void displayio_display_core_start_refresh(displayio_display_core_t* self) { diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index b1a412883c..e92fdbc9f1 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -27,18 +27,13 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_CORE_H #define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_CORE_H +#include "shared-bindings/displayio/__init__.h" #include "shared-bindings/displayio/Group.h" #include "shared-module/displayio/area.h" #define NO_COMMAND 0x100 -typedef bool (*display_bus_bus_reset)(mp_obj_t bus); -typedef bool (*display_bus_bus_free)(mp_obj_t bus); -typedef bool (*display_bus_begin_transaction)(mp_obj_t bus); -typedef void (*display_bus_send)(mp_obj_t bus, bool command, bool toggle_every_byte, uint8_t *data, uint32_t data_length); -typedef void (*display_bus_end_transaction)(mp_obj_t bus); - typedef struct { mp_obj_t bus; displayio_group_t *current_group; diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 36b30f4622..c50d7f4eeb 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -91,7 +91,7 @@ void filesystem_init(bool create_allowed, bool force_create) { } // set label - f_setlabel(&vfs_fat->fatfs, CIRCUITPY_FS_NAME); + f_setlabel(&vfs_fat->fatfs, "CIRCUITPY"); // inhibit file indexing on MacOS f_mkdir(&vfs_fat->fatfs, "/.fseventsd"); From 76446f634b7f712949b3972d3249d739d254cf40 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 25 Aug 2019 21:38:13 -0400 Subject: [PATCH 20/41] BLE HID WIP: works everywhere except iOS; fixed a bunch of bugs; pretend bonding --- ports/nrf/common-hal/bleio/Adapter.c | 15 ++++ ports/nrf/common-hal/bleio/Attribute.h | 4 +- ports/nrf/common-hal/bleio/Peripheral.c | 110 +++++++++++++++++------- ports/nrf/common-hal/bleio/Peripheral.h | 4 + ports/nrf/common-hal/bleio/Service.c | 23 ++--- ports/nrf/common-hal/bleio/__init__.h | 6 ++ shared-bindings/bleio/Attribute.h | 1 + shared-bindings/bleio/Peripheral.c | 7 +- shared-bindings/bleio/__init__.h | 2 +- 9 files changed, 127 insertions(+), 45 deletions(-) diff --git a/ports/nrf/common-hal/bleio/Adapter.c b/ports/nrf/common-hal/bleio/Adapter.c index 15ae8840b6..618870541e 100644 --- a/ports/nrf/common-hal/bleio/Adapter.c +++ b/ports/nrf/common-hal/bleio/Adapter.c @@ -40,6 +40,11 @@ #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) +#define BLE_SLAVE_LATENCY 0 +#define BLE_CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) + STATIC void softdevice_assert_handler(uint32_t id, uint32_t pc, uint32_t info) { mp_raise_msg_varg(&mp_type_AssertionError, translate("Soft device assert, id: 0x%08lX, pc: 0x%08lX"), id, pc); @@ -97,6 +102,16 @@ STATIC uint32_t ble_stack_enable(void) { return err_code; err_code = sd_ble_enable(&app_ram_start); + if (err_code != NRF_SUCCESS) + return err_code; + + ble_gap_conn_params_t gap_conn_params = { + .min_conn_interval = BLE_MIN_CONN_INTERVAL, + .max_conn_interval = BLE_MAX_CONN_INTERVAL, + .slave_latency = BLE_SLAVE_LATENCY, + .conn_sup_timeout = BLE_CONN_SUP_TIMEOUT, + }; + err_code = sd_ble_gap_ppcp_set(&gap_conn_params); return err_code; } diff --git a/ports/nrf/common-hal/bleio/Attribute.h b/ports/nrf/common-hal/bleio/Attribute.h index 44c2fdfa17..cf84f01dcf 100644 --- a/ports/nrf/common-hal/bleio/Attribute.h +++ b/ports/nrf/common-hal/bleio/Attribute.h @@ -27,6 +27,8 @@ #ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_ATTRIBUTE_H #define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_ATTRIBUTE_H -// Nothing yet. +#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); #endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_ATTRIBUTE_H diff --git a/ports/nrf/common-hal/bleio/Peripheral.c b/ports/nrf/common-hal/bleio/Peripheral.c index ed35516fc9..39e0ea7478 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.c +++ b/ports/nrf/common-hal/bleio/Peripheral.c @@ -38,22 +38,18 @@ #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" -#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS) -#define BLE_MAX_CONN_INTERVAL MSEC_TO_UNITS(300, UNIT_0_625_MS) -#define BLE_SLAVE_LATENCY 0 -#define BLE_CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) - #define BLE_ADV_LENGTH_FIELD_SIZE 1 #define BLE_ADV_AD_TYPE_FIELD_SIZE 1 #define BLE_AD_TYPE_FLAGS_DATA_SIZE 1 static const ble_gap_sec_params_t pairing_sec_params = { - .bond = 0, // TODO: add bonding + .bond = 1, .mitm = 0, .lesc = 0, .keypress = 0, @@ -75,15 +71,23 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { bleio_peripheral_obj_t *self = (bleio_peripheral_obj_t*)self_in; // For debugging. - // mp_printf(&mp_plat_print, "Peripheral event: 0x%04x\n", ble_evt->header.evt_id); + mp_printf(&mp_plat_print, "Peripheral event: 0x%04x\n", ble_evt->header.evt_id); switch (ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: { // Central has connected. - ble_gap_conn_params_t conn_params; + ble_gap_evt_connected_t* connected = &ble_evt->evt.gap_evt.params.connected; + self->conn_handle = ble_evt->evt.gap_evt.conn_handle; + + // See if connection interval set by Central is out of range. + // If so, negotiate our preferred range. + ble_gap_conn_params_t conn_params; sd_ble_gap_ppcp_get(&conn_params); - sd_ble_gap_conn_param_update(ble_evt->evt.gap_evt.conn_handle, &conn_params); + if (conn_params.min_conn_interval < connected->conn_params.min_conn_interval || + conn_params.min_conn_interval > connected->conn_params.max_conn_interval) { + sd_ble_gap_conn_param_update(ble_evt->evt.gap_evt.conn_handle, &conn_params); + } break; } @@ -102,21 +106,16 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { } case BLE_GAP_EVT_ADV_SET_TERMINATED: - // Someday may handle timeouts or limit reached. + // TODO: Someday may handle timeouts or limit reached. break; - case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: { - ble_gap_evt_conn_param_update_request_t *request = - &ble_evt->evt.gap_evt.params.conn_param_update_request; - sd_ble_gap_conn_param_update(self->conn_handle, &request->conn_params); - break; - } - case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST: + // SoftDevice will respond to a length update request. sd_ble_gap_data_length_update(self->conn_handle, NULL, NULL); break; case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: { + // We only handle MTU of size BLE_GATT_ATT_MTU_DEFAULT. sd_ble_gatts_exchange_mtu_reply(self->conn_handle, BLE_GATT_ATT_MTU_DEFAULT); break; } @@ -125,9 +124,27 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0); break; - case BLE_GAP_EVT_SEC_PARAMS_REQUEST: - sd_ble_gap_sec_params_reply(self->conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &pairing_sec_params, NULL); + case BLE_GAP_EVT_SEC_PARAMS_REQUEST: { + ble_gap_sec_keyset_t keyset = { + .keys_own = { + .p_enc_key = &self->bonding_keys.own_enc, + .p_id_key = NULL, + .p_sign_key = NULL, + .p_pk = NULL + }, + + .keys_peer = { + .p_enc_key = &self->bonding_keys.peer_enc, + .p_id_key = &self->bonding_keys.peer_id, + .p_sign_key = NULL, + .p_pk = NULL + } + }; + + sd_ble_gap_sec_params_reply(self->conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, + &pairing_sec_params, &keyset); break; + } case BLE_GAP_EVT_LESC_DHKEY_REQUEST: // TODO for LESC pairing: @@ -138,15 +155,44 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { // Pairing process completed ble_gap_evt_auth_status_t* status = &ble_evt->evt.gap_evt.params.auth_status; if (BLE_GAP_SEC_STATUS_SUCCESS == status->auth_status) { - // mp_printf(&mp_plat_print, "Pairing succeeded, status: 0x%04x\n", status->auth_status); + // TODO _ediv = bonding_keys->own_enc.master_id.ediv; + mp_printf(&mp_plat_print, "Pairing succeeded, status: 0x%04x\n", status->auth_status); self->pair_status = PAIR_PAIRED; } else { - // mp_printf(&mp_plat_print, "Pairing failed, status: 0x%04x\n", status->auth_status); + mp_printf(&mp_plat_print, "Pairing failed, status: 0x%04x\n", status->auth_status); self->pair_status = PAIR_NOT_PAIRED; } break; } + case BLE_GAP_EVT_SEC_INFO_REQUEST: { + // Peer asks for the stored keys. + // - load key and return if bonded previously. + // - Else return NULL --> Initiate key exchange + ble_gap_evt_sec_info_request_t* sec_info_request = &ble_evt->evt.gap_evt.params.sec_info_request; + (void) sec_info_request; + //if ( bond_load_keys(_role, sec_req->master_id.ediv, &bkeys) ) { + //sd_ble_gap_sec_info_reply(_conn_hdl, &bkeys.own_enc.enc_info, &bkeys.peer_id.id_info, NULL); + // + //_ediv = bkeys.own_enc.master_id.ediv; + // } else { + sd_ble_gap_sec_info_reply(self->conn_handle, NULL, NULL, NULL); + // } + break; + } + + // case BLE_GATTS_EVT_WRITE: { + // ble_gatts_evt_write_t* write = &ble_evt->evt.gatts_evt.params.write; + // mp_printf(&mp_plat_print, "GATTS write uuid %x\n", write->uuid.uuid); + // break; + // } + + // case BLE_GATTS_EVT_HVN_TX_COMPLETE: { + // ble_gatts_evt_hvn_tx_complete_t* complete = &ble_evt->evt.gatts_evt.params.hvn_tx_complete; + // mp_printf(&mp_plat_print, "HVN TX COMPLETE finished write num %d\n", complete->count); + // break; + // } + case BLE_GAP_EVT_CONN_SEC_UPDATE: { ble_gap_conn_sec_t* conn_sec = &ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec; if (conn_sec->sec_mode.sm <= 1 && conn_sec->sec_mode.lv <= 1) { @@ -156,11 +202,13 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { // mode >=1 and/or level >=1 means encryption is set up self->pair_status = PAIR_NOT_PAIRED; } else { - // TODO: see Bluefruit lib - // if ( !bond_load_cccd(_role, _conn_hdl, _ediv) ) { - // sd_ble_gatts_sys_attr_set(_conn_hdl, NULL, 0, 0); - // } - self->pair_status = PAIR_PAIRED; + //if ( !bond_load_cccd(_role, _conn_hdl, _ediv) ) { + if (true) { // TODO: no bonding yet + // Initialize system attributes fresh. + sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0); + } + // Not quite paired yet: wait for BLE_GAP_EVT_AUTH_STATUS SUCCESS. + self->ediv = self->bonding_keys.own_enc.master_id.ediv; } break; } @@ -168,7 +216,7 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { default: // For debugging. - // mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id); + mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id); break; } } @@ -185,6 +233,8 @@ void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_ self->adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET; self->pair_status = PAIR_NOT_PAIRED; + memset(&self->bonding_keys, 0, sizeof(self->bonding_keys)); + // Add all the services. for (size_t service_idx = 0; service_idx < services_list->len; ++service_idx) { @@ -237,9 +287,9 @@ void common_hal_bleio_peripheral_start_advertising(bleio_peripheral_obj_t *self, GET_STR_DATA_LEN(self->name, name_data, name_len); if (name_len > 0) { + // Set device name, and make it available to anyone. ble_gap_conn_sec_mode_t sec_mode; BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode); - err_code = sd_ble_gap_device_name_set(&sec_mode, name_data, name_len); if (err_code != NRF_SUCCESS) { mp_raise_OSError_msg_varg(translate("Failed to set device name, err 0x%04x"), err_code); @@ -322,10 +372,12 @@ void common_hal_bleio_peripheral_pair(bleio_peripheral_obj_t *self) { } while (self->pair_status == PAIR_WAITING) { - MICROPY_VM_HOOK_LOOP; + RUN_BACKGROUND_TASKS; } if (self->pair_status == PAIR_NOT_PAIRED) { mp_raise_OSError_msg(translate("Failed to pair")); } + + } diff --git a/ports/nrf/common-hal/bleio/Peripheral.h b/ports/nrf/common-hal/bleio/Peripheral.h index e75a1641a3..b663c96012 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.h +++ b/ports/nrf/common-hal/bleio/Peripheral.h @@ -35,6 +35,7 @@ #include "py/obj.h" #include "py/objlist.h" +#include "common-hal/bleio/__init__.h" #include "shared-module/bleio/Address.h" typedef enum { @@ -54,6 +55,9 @@ typedef struct { // The advertising data and scan response buffers are held by us, not by the SD, so we must // maintain them and not change it. If we need to change the contents during advertising, // there are tricks to get the SD to notice (see DevZone - TBS). + // EDIV: Encrypted Diversifier: Identifies LTK during legacy pairing. + bonding_keys_t bonding_keys; + uint16_t ediv; uint8_t* advertising_data; uint8_t* scan_response_data; uint8_t adv_handle; diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/bleio/Service.c index a7a3a6db09..28e713cc8d 100644 --- a/ports/nrf/common-hal/bleio/Service.c +++ b/ports/nrf/common-hal/bleio/Service.c @@ -89,13 +89,6 @@ void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self) .vloc = BLE_GATTS_VLOC_STACK, }; - if (char_md.char_props.notify || char_md.char_props.indicate) { - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); - - char_md.p_cccd_md = &cccd_md; - } - ble_uuid_t char_uuid; bleio_uuid_convert_to_nrf_ble_uuid(characteristic->uuid, &char_uuid); @@ -104,8 +97,16 @@ void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self) .vlen = !characteristic->fixed_length, }; - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&char_attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&char_attr_md.write_perm); + if (char_md.char_props.notify || char_md.char_props.indicate) { + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + // Make CCCD write permission match characteristic read permission. + bleio_attribute_gatts_set_security_mode(&cccd_md.write_perm, characteristic->read_perm); + + char_md.p_cccd_md = &cccd_md; + } + + bleio_attribute_gatts_set_security_mode(&char_attr_md.read_perm, characteristic->read_perm); + bleio_attribute_gatts_set_security_mode(&char_attr_md.write_perm, characteristic->write_perm); mp_buffer_info_t char_value_bufinfo; mp_get_buffer_raise(characteristic->value, &char_value_bufinfo, MP_BUFFER_READ); @@ -146,8 +147,8 @@ void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self) .vlen = !descriptor->fixed_length, }; - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_attr_md.read_perm); - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&desc_attr_md.write_perm); + bleio_attribute_gatts_set_security_mode(&desc_attr_md.read_perm, descriptor->read_perm); + bleio_attribute_gatts_set_security_mode(&desc_attr_md.write_perm, descriptor->write_perm); mp_buffer_info_t desc_value_bufinfo; mp_get_buffer_raise(descriptor->value, &desc_value_bufinfo, MP_BUFFER_READ); diff --git a/ports/nrf/common-hal/bleio/__init__.h b/ports/nrf/common-hal/bleio/__init__.h index c0bba37994..cf1a06945d 100644 --- a/ports/nrf/common-hal/bleio/__init__.h +++ b/ports/nrf/common-hal/bleio/__init__.h @@ -29,6 +29,12 @@ void bleio_reset(void); +typedef struct { + ble_gap_enc_key_t own_enc; + ble_gap_enc_key_t peer_enc; + ble_gap_id_key_t peer_id; +} bonding_keys_t; + // We assume variable length data. // 20 bytes max (23 - 3). #define GATT_MAX_DATA_LENGTH (BLE_GATT_ATT_MTU_DEFAULT - 3) diff --git a/shared-bindings/bleio/Attribute.h b/shared-bindings/bleio/Attribute.h index 06a6eb5a9a..39bef50572 100644 --- a/shared-bindings/bleio/Attribute.h +++ b/shared-bindings/bleio/Attribute.h @@ -29,6 +29,7 @@ #include "py/obj.h" +#include "common-hal/bleio/Attribute.h" #include "shared-module/bleio/Attribute.h" extern const mp_obj_type_t bleio_attribute_type; diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c index 630e6ed364..b98e7f74bf 100644 --- a/shared-bindings/bleio/Peripheral.c +++ b/shared-bindings/bleio/Peripheral.c @@ -44,11 +44,12 @@ #include "common-hal/bleio/Peripheral.h" -#define ADV_INTERVAL_DEFAULT (1.0f) #define ADV_INTERVAL_MIN (0.0020f) #define ADV_INTERVAL_MIN_STRING "0.0020" #define ADV_INTERVAL_MAX (10.24f) #define ADV_INTERVAL_MAX_STRING "10.24" +// 20ms is recommended by Apple +#define ADV_INTERVAL_DEFAULT (0.1f) //| .. currentmodule:: bleio //| @@ -183,7 +184,7 @@ const mp_obj_property_t bleio_peripheral_name_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| .. method:: start_advertising(data, *, scan_response=None, connectable=True, interval=1) +//| .. method:: start_advertising(data, *, scan_response=None, connectable=True, interval=0.1) //| //| Starts advertising the peripheral. The peripheral's name and //| services are included in the advertisement packets. @@ -217,7 +218,7 @@ STATIC mp_obj_t bleio_peripheral_start_advertising(mp_uint_t n_args, const mp_ob } if (args[ARG_interval].u_obj == MP_OBJ_NULL) { - args[ARG_interval].u_obj = mp_obj_new_float(1.0F); + args[ARG_interval].u_obj = mp_obj_new_float(ADV_INTERVAL_DEFAULT); } const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj); diff --git a/shared-bindings/bleio/__init__.h b/shared-bindings/bleio/__init__.h index 6a4c804f55..89be710939 100644 --- a/shared-bindings/bleio/__init__.h +++ b/shared-bindings/bleio/__init__.h @@ -31,9 +31,9 @@ #include "py/objlist.h" -#include "shared-bindings/bleio/__init__.h" #include "shared-bindings/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; From 0364f1dc854ff5f30b9ab2a72a406aab684a1d20 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 26 Aug 2019 08:17:59 -0400 Subject: [PATCH 21/41] remove some debugging prints --- ports/nrf/common-hal/bleio/Adapter.c | 5 ++++- ports/nrf/common-hal/bleio/Peripheral.c | 12 ------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/ports/nrf/common-hal/bleio/Adapter.c b/ports/nrf/common-hal/bleio/Adapter.c index 618870541e..74650e2127 100644 --- a/ports/nrf/common-hal/bleio/Adapter.c +++ b/ports/nrf/common-hal/bleio/Adapter.c @@ -112,8 +112,11 @@ STATIC uint32_t ble_stack_enable(void) { .conn_sup_timeout = BLE_CONN_SUP_TIMEOUT, }; err_code = sd_ble_gap_ppcp_set(&gap_conn_params); + if (err_code != NRF_SUCCESS) + return err_code; - return err_code; + err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_UNKNOWN); + return err_code; } void common_hal_bleio_adapter_set_enabled(bool enabled) { diff --git a/ports/nrf/common-hal/bleio/Peripheral.c b/ports/nrf/common-hal/bleio/Peripheral.c index 39e0ea7478..08a6d5066f 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.c +++ b/ports/nrf/common-hal/bleio/Peripheral.c @@ -181,18 +181,6 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { break; } - // case BLE_GATTS_EVT_WRITE: { - // ble_gatts_evt_write_t* write = &ble_evt->evt.gatts_evt.params.write; - // mp_printf(&mp_plat_print, "GATTS write uuid %x\n", write->uuid.uuid); - // break; - // } - - // case BLE_GATTS_EVT_HVN_TX_COMPLETE: { - // ble_gatts_evt_hvn_tx_complete_t* complete = &ble_evt->evt.gatts_evt.params.hvn_tx_complete; - // mp_printf(&mp_plat_print, "HVN TX COMPLETE finished write num %d\n", complete->count); - // break; - // } - case BLE_GAP_EVT_CONN_SEC_UPDATE: { ble_gap_conn_sec_t* conn_sec = &ble_evt->evt.gap_evt.params.conn_sec_update.conn_sec; if (conn_sec->sec_mode.sm <= 1 && conn_sec->sec_mode.lv <= 1) { From bea77c651afd919e6cb87927341714adbddb939c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 26 Aug 2019 16:37:59 -0700 Subject: [PATCH 22/41] Minor renames --- shared-bindings/displayio/Display.h | 1 - shared-module/displayio/Display.c | 4 ++-- shared-module/displayio/EPaperDisplay.c | 20 ++++++++++---------- shared-module/displayio/EPaperDisplay.h | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 2d7b68c4ed..a3c77e4e82 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -50,7 +50,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, bool common_hal_displayio_display_show(displayio_display_obj_t* self, displayio_group_t* root_group); -// Times in ms. bool common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame); bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t* self); diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index cb5051bb76..f210a80c3c 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -270,8 +270,8 @@ STATIC bool _refresh_area(displayio_display_obj_t* self, const displayio_area_t* subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); } - memset(mask, 0, mask_length * sizeof(uint32_t)); - memset(buffer, 0, buffer_size * sizeof(uint32_t)); + memset(mask, 0, mask_length * sizeof(mask[0])); + memset(buffer, 0, buffer_size * sizeof(buffer[0])); displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 38b63df0fd..efbd9f3ddb 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -49,7 +49,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, uint16_t refresh_display_command, mp_float_t refresh_time, - const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select) { + const mcu_pin_obj_t* busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool chip_select) { if (highlight_color != 0x000000) { self->core.colorspace.tricolor = true; self->core.colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); @@ -71,7 +71,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t* self->busy_state = busy_state; self->refreshing = false; self->milliseconds_per_frame = seconds_per_frame * 1000; - self->always_toggle_chip_select = always_toggle_chip_select ? CHIP_SELECT_TOGGLE_EVERY_BYTE : CHIP_SELECT_UNTOUCHED; + self->chip_select = chip_select ? CHIP_SELECT_TOGGLE_EVERY_BYTE : CHIP_SELECT_UNTOUCHED; self->start_sequence = start_sequence; self->start_sequence_len = start_sequence_len; @@ -143,8 +143,8 @@ STATIC void send_command_sequence(displayio_epaperdisplay_obj_t* self, bool shou data_size &= ~DELAY; uint8_t *data = cmd + 2; displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, cmd, 1); - self->core.send(self->core.bus, DISPLAY_DATA, self->always_toggle_chip_select, data, data_size); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, cmd, 1); + self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, data, data_size); displayio_display_core_end_transaction(&self->core); uint16_t delay_length_ms = 0; if (delay) { @@ -185,7 +185,7 @@ uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaper void displayio_epaperdisplay_finish_refresh(displayio_epaperdisplay_obj_t* self) { // Actually refresh the display now that all pixel RAM has been updated. displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, &self->refresh_display_command, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &self->refresh_display_command, 1); displayio_display_core_end_transaction(&self->core); self->refreshing = true; @@ -238,7 +238,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c uint16_t remaining_rows = displayio_area_height(&clipped); if (self->set_row_window_command != NO_COMMAND) { - displayio_display_core_set_region_to_update(&self->core, self->set_column_window_command, self->set_row_window_command, self->set_current_column_command, self->set_current_row_command, false, self->always_toggle_chip_select, &clipped); + displayio_display_core_set_region_to_update(&self->core, self->set_column_window_command, self->set_row_window_command, self->set_current_column_command, self->set_current_row_command, false, self->chip_select, &clipped); } uint8_t write_command = self->write_black_ram_command; @@ -246,7 +246,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c write_command = self->write_color_ram_command; } displayio_display_core_begin_transaction(&self->core); - self->core.send(self->core.bus, DISPLAY_COMMAND, self->always_toggle_chip_select, &write_command, 1); + self->core.send(self->core.bus, DISPLAY_COMMAND, self->chip_select, &write_command, 1); displayio_display_core_end_transaction(&self->core); for (uint16_t j = 0; j < subrectangles; j++) { @@ -264,8 +264,8 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c uint16_t subrectangle_size_bytes = displayio_area_size(&subrectangle) / (8 / self->core.colorspace.depth); - memset(mask, 0, mask_length * sizeof(uint32_t)); - memset(buffer, 0, buffer_size * sizeof(uint32_t)); + memset(mask, 0, mask_length * sizeof(mask[0])); + memset(buffer, 0, buffer_size * sizeof(buffer[0])); self->core.colorspace.grayscale = true; if (pass == 1) { @@ -285,7 +285,7 @@ bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t* self, c // Can't acquire display bus; skip the rest of the data. Try next display. return false; } - self->core.send(self->core.bus, DISPLAY_DATA, self->always_toggle_chip_select, (uint8_t*) buffer, subrectangle_size_bytes); + self->core.send(self->core.bus, DISPLAY_DATA, self->chip_select, (uint8_t*) buffer, subrectangle_size_bytes); displayio_display_core_end_transaction(&self->core); // TODO(tannewt): Make refresh displays faster so we don't starve other diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index 580171a5f1..d08bed5462 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -56,7 +56,7 @@ typedef struct { bool black_bits_inverted; bool color_bits_inverted; bool refreshing; - display_chip_select_behavior_t always_toggle_chip_select; + display_chip_select_behavior_t chip_select; } displayio_epaperdisplay_obj_t; void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t* self); From 966a48b23a985154ff691a09de72013e2eac2512 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 27 Aug 2019 12:49:46 -0700 Subject: [PATCH 23/41] More size_t usage --- lib/utils/buffer_helper.c | 4 ++-- lib/utils/buffer_helper.h | 3 ++- shared-bindings/bitbangio/SPI.c | 4 ++-- shared-bindings/busio/SPI.c | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/utils/buffer_helper.c b/lib/utils/buffer_helper.c index f6eb8bf1e7..694952e3d2 100644 --- a/lib/utils/buffer_helper.c +++ b/lib/utils/buffer_helper.c @@ -26,10 +26,10 @@ #include "lib/utils/buffer_helper.h" -void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length) { +void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length) { if (end < 0) { end += *length; - } else if (((uint32_t) end) > *length) { + } else if (((size_t) end) > *length) { end = *length; } if (*start < 0) { diff --git a/lib/utils/buffer_helper.h b/lib/utils/buffer_helper.h index 47042e7ef1..7487b9df53 100644 --- a/lib/utils/buffer_helper.h +++ b/lib/utils/buffer_helper.h @@ -28,7 +28,8 @@ #define MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H #include +#include -void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length); +void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length); #endif // MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 88bd3d6cb3..9a51bde665 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -275,13 +275,13 @@ STATIC mp_obj_t bitbangio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_ mp_buffer_info_t buf_out_info; mp_get_buffer_raise(args[ARG_buffer_out].u_obj, &buf_out_info, MP_BUFFER_READ); int32_t out_start = args[ARG_out_start].u_int; - uint32_t out_length = buf_out_info.len; + size_t out_length = buf_out_info.len; normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); mp_buffer_info_t buf_in_info; mp_get_buffer_raise(args[ARG_buffer_in].u_obj, &buf_in_info, MP_BUFFER_WRITE); int32_t in_start = args[ARG_in_start].u_int; - uint32_t in_length = buf_in_info.len; + size_t in_length = buf_in_info.len; normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); if (out_length != in_length) { diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index a7d7d515c5..d47bf499a2 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -244,7 +244,7 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_ mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); if (length == 0) { @@ -288,7 +288,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); int32_t start = args[ARG_start].u_int; - uint32_t length = bufinfo.len; + size_t length = bufinfo.len; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); if (length == 0) { @@ -337,13 +337,13 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args mp_buffer_info_t buf_out_info; mp_get_buffer_raise(args[ARG_buffer_out].u_obj, &buf_out_info, MP_BUFFER_READ); int32_t out_start = args[ARG_out_start].u_int; - uint32_t out_length = buf_out_info.len; + size_t out_length = buf_out_info.len; normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); mp_buffer_info_t buf_in_info; mp_get_buffer_raise(args[ARG_buffer_in].u_obj, &buf_in_info, MP_BUFFER_WRITE); int32_t in_start = args[ARG_in_start].u_int; - uint32_t in_length = buf_in_info.len; + size_t in_length = buf_in_info.len; normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); if (out_length != in_length) { From 0876d5c4adf9d7289123a51728aa8a372c4e2e7b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 27 Aug 2019 15:21:47 -0700 Subject: [PATCH 24/41] Disable bitbangio on Itsy M0 Also, switch CIRCUITPY_BITBANG_APA102 to makefile setting so it can alter included files --- ports/atmel-samd/boards/gemma_m0/mpconfigboard.h | 2 -- .../boards/itsybitsy_m0_express/mpconfigboard.h | 1 - .../boards/itsybitsy_m0_express/mpconfigboard.mk | 3 +++ .../boards/itsybitsy_m4_express/mpconfigboard.h | 2 -- .../boards/itsybitsy_m4_express/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h | 2 -- ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h | 2 -- .../boards/trellis_m4_express/mpconfigboard.h | 2 -- .../boards/trellis_m4_express/mpconfigboard.mk | 2 ++ ports/atmel-samd/common-hal/busio/SPI.c | 4 ++-- py/circuitpy_defns.mk | 4 ++++ py/circuitpy_mpconfig.mk | 6 ++++++ supervisor/shared/rgb_led_status.c | 12 ++++++------ supervisor/shared/rgb_led_status.h | 2 +- 15 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h index bc60ba49ba..5f09ab4d2f 100644 --- a/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/gemma_m0/mpconfigboard.h @@ -6,8 +6,6 @@ #define MICROPY_HW_APA102_MOSI (&pin_PA00) #define MICROPY_HW_APA102_SCK (&pin_PA01) -// #define CIRCUITPY_BITBANG_APA102 - #define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h index 79d0cd269e..6f9f661d94 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h @@ -3,7 +3,6 @@ #define MICROPY_HW_LED_STATUS (&pin_PA17) -#define CIRCUITPY_BITBANG_APA102 #define MICROPY_HW_APA102_MOSI (&pin_PA01) #define MICROPY_HW_APA102_SCK (&pin_PA00) diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk index 10975931ff..2b64e90275 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk @@ -12,6 +12,9 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2 EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_BITBANG_APA102 = 1 + +CIRCUITPY_BITBANGIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h index f4d17ac648..9e4d4a10c9 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h @@ -9,8 +9,6 @@ #define MICROPY_HW_APA102_MOSI (&pin_PB03) #define MICROPY_HW_APA102_SCK (&pin_PB02) -#define CIRCUITPY_BITBANG_APA102 - // These are pins not to reset. // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index f53983ef79..5cab5bf43a 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_PS2IO = 1 # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 + +CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h index cd754924e6..c4563964f8 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h +++ b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h @@ -9,8 +9,6 @@ #define MICROPY_HW_APA102_MOSI (&pin_PB03) #define MICROPY_HW_APA102_SCK (&pin_PB02) -#define CIRCUITPY_BITBANG_APA102 - // These are pins not to reset. // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) diff --git a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk index b70b9bbb0e..4bd1d6e522 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk @@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_PS2IO = 1 # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 + +CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h index 288208f65a..5a8eb9d147 100644 --- a/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h +++ b/ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h @@ -4,8 +4,6 @@ #define MICROPY_HW_APA102_MOSI (&pin_PA00) #define MICROPY_HW_APA102_SCK (&pin_PA01) -// #define CIRCUITPY_BITBANG_APA102 - #define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) diff --git a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h index 6870b86ba0..8ca1df1621 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h @@ -8,8 +8,6 @@ #define MICROPY_HW_APA102_MOSI (&pin_PB03) #define MICROPY_HW_APA102_SCK (&pin_PB02) -#define CIRCUITPY_BITBANG_APA102 - // These are pins not to reset. // QSPI Data pins #define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) diff --git a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk index f1fb499011..ec37186c3a 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk @@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ CIRCUITPY_PS2IO = 1 # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 + +CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 644b9a87b4..7a1426bedc 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -122,7 +122,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, } Sercom* potential_sercom = sercom_insts[sercom_index]; if ( - #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !defined(CIRCUITPY_BITBANG_APA102) + #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102 (potential_sercom->SPI.CTRLA.bit.ENABLE != 0 && potential_sercom != status_apa102.spi_desc.dev.prvt && !apa102_sck_in_use)) { @@ -181,7 +181,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // Set up SPI clocks on SERCOM. samd_peripherals_sercom_clock_init(sercom, sercom_index); - #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !defined(CIRCUITPY_BITBANG_APA102) + #if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102 // if we're re-using the dotstar sercom, make sure it is disabled or the init will fail out hri_sercomspi_clear_CTRLA_ENABLE_bit(sercom); #endif diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index e7b9175128..3f593416e5 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -117,6 +117,10 @@ endif ifeq ($(CIRCUITPY_BITBANGIO),1) SRC_PATTERNS += bitbangio/% endif +# Some builds need bitbang SPI for the dotstar but don't make bitbangio available so include it separately. +ifeq ($(CIRCUITPY_BITBANG_APA102),1) +SRC_PATTERNS += bitbangio/SPI% +endif ifeq ($(CIRCUITPY_BLEIO),1) SRC_PATTERNS += bleio/% endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 949cd1d182..356a8f95d1 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -278,3 +278,9 @@ ifndef CIRCUITPY_USTACK CIRCUITPY_USTACK = 0 endif CFLAGS += -DCIRCUITPY_USTACK=$(CIRCUITPY_USTACK) + + +ifndef CIRCUITPY_BITBANG_APA102 +CIRCUITPY_BITBANG_APA102 = 0 +endif +CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102) diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 0e69cd2e0e..9f233defa1 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -40,7 +40,7 @@ static digitalio_digitalinout_obj_t status_neopixel; #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) uint8_t rgb_status_brightness = 255; static uint8_t status_apa102_color[12] = {0, 0, 0, 0, 0xff, 0, 0, 0}; -#ifdef CIRCUITPY_BITBANG_APA102 +#if CIRCUITPY_BITBANG_APA102 #include "shared-bindings/bitbangio/SPI.h" #include "shared-module/bitbangio/types.h" static bitbangio_spi_obj_t status_apa102; @@ -81,7 +81,7 @@ void rgb_led_status_init() { common_hal_digitalio_digitalinout_switch_to_output(&status_neopixel, false, DRIVE_MODE_PUSH_PULL); #endif #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - #ifdef CIRCUITPY_BITBANG_APA102 + #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_construct(&status_apa102, MICROPY_HW_APA102_SCK, MICROPY_HW_APA102_MOSI, @@ -102,7 +102,7 @@ void rgb_led_status_init() { // mark them as used. apa102_mosi_in_use = false; apa102_sck_in_use = false; - #ifdef CIRCUITPY_BITBANG_APA102 + #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_try_lock(&status_apa102); shared_module_bitbangio_spi_configure(&status_apa102, 100000, 0, 1, 8); #else @@ -185,7 +185,7 @@ void new_status_color(uint32_t rgb) { status_apa102_color[6] = (rgb_adjusted >> 8) & 0xff; status_apa102_color[7] = (rgb_adjusted >> 16) & 0xff; - #ifdef CIRCUITPY_BITBANG_APA102 + #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8); #else common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8); @@ -230,7 +230,7 @@ void temp_status_color(uint32_t rgb) { return; } uint8_t colors[12] = {0, 0, 0, 0, 0xff, rgb_adjusted & 0xff, (rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, 0x0, 0x0, 0x0, 0x0}; - #ifdef CIRCUITPY_BITBANG_APA102 + #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_write(&status_apa102, colors, 12); #else common_hal_busio_spi_write(&status_apa102, colors, 12); @@ -264,7 +264,7 @@ void clear_temp_status() { common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3); #endif #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - #ifdef CIRCUITPY_BITBANG_APA102 + #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8); #else common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8); diff --git a/supervisor/shared/rgb_led_status.h b/supervisor/shared/rgb_led_status.h index 83f4822d72..e4e1981a21 100644 --- a/supervisor/shared/rgb_led_status.h +++ b/supervisor/shared/rgb_led_status.h @@ -44,7 +44,7 @@ // To work with a NeoPixel, one must have MICROPY_HW_NEOPIXEL defined and // neopixel_write implemented. -#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) && !defined(CIRCUITPY_BITBANG_APA102) +#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) && !CIRCUITPY_BITBANG_APA102 #include "common-hal/busio/SPI.h" extern busio_spi_obj_t status_apa102; #endif From 6106909c1094b39980dd6f94ca17782681f3be9a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 15 Aug 2019 00:07:29 -0700 Subject: [PATCH 25/41] Swap the CI to GitHub Actions from Travis --- .github/workflows/build.yml | 197 ++++++++++++++++++++++++ .github/workflows/create_website_pr.yml | 38 +++++ .travis.yml | 161 ------------------- tools/build_board_info.py | 13 +- tools/build_release_files.py | 32 +--- tools/ci_new_boards_check.py | 50 ++++++ tools/travis_new_boards_check.py | 51 ------ tools/upload_release_files.py | 32 ++++ 8 files changed, 329 insertions(+), 245 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/create_website_pr.yml delete mode 100755 .travis.yml create mode 100644 tools/ci_new_boards_check.py delete mode 100644 tools/travis_new_boards_check.py create mode 100755 tools/upload_release_files.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..90e5f96bea --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,197 @@ +name: Build CI + +on: + push: + branches: + - master + pull_request: + release: + +jobs: + test: + runs-on: ubuntu-16.04 + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Fail if not a release publish # workaround has `on` doesn't have this filter + run: exit 1 + if: github.event_name == 'release' && (github.event.action != 'published' && github.event.action != 'rerequested') + - name: Set up Python 3.5 + uses: actions/setup-python@v1 + with: + python-version: 3.5 + - name: Install deps + run: | + sudo apt-get install -y gettext librsvg2-bin + pip install requests sh click setuptools cpp-coveralls Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter polib pyyaml + - name: Versions + run: | + gcc --version + python3 --version + - uses: actions/checkout@v1 + with: + submodules: true + - name: CircuitPython version + run: git describe --dirty --always --tags + - name: Build mpy-cross + run: make -C mpy-cross -j2 + - name: Build unix port + run: | + make -C ports/unix deplibs -j2 + make -C ports/unix -j2 + make -C ports/unix coverage -j2 + - name: Test all + run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 + working-directory: tests + - name: Print failure info + run: | + for exp in *.exp; + do testbase=$(basename $exp .exp); + echo -e "\nFAILURE $testbase"; + diff -u $testbase.exp $testbase.out; + done + working-directory: tests + if: failure() + - name: Test threads + run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread + working-directory: tests + - name: Native Tests + run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native + working-directory: tests + - name: mpy Tests + run: MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float + working-directory: tests + - name: Docs + run: sphinx-build -E -W -b html . _build/html + - name: Translations + run: make check-translate + - name: New boards check + run: python3 -u ci_new_boards_check.py + working-directory: tools + + build-arm: + runs-on: ubuntu-16.04 + needs: test + strategy: + fail-fast: false + matrix: + board: + - "arduino_mkr1300" + - "arduino_mkrzero" + - "arduino_zero" + - "bast_pro_mini_m0" + - "capablerobot_usbhub" + - "catwan_usbstick" + - "circuitplayground_bluefruit" + - "circuitplayground_express" + - "circuitplayground_express_crickit" + - "cp32-m4" + - "datalore_ip_m4" + - "datum_distance" + - "datum_imu" + - "datum_light" + - "datum_weather" + - "electronut_labs_blip" + - "electronut_labs_papyr" + - "escornabot_makech" + - "feather_m0_adalogger" + - "feather_m0_basic" + - "feather_m0_express" + - "feather_m0_express_crickit" + - "feather_m0_rfm69" + - "feather_m0_rfm9x" + - "feather_m0_supersized" + - "feather_m4_express" + - "feather_nrf52840_express" + - "feather_radiofruit_zigbee" + - "gemma_m0" + - "grandcentral_m4_express" + - "hallowing_m0_express" + - "itsybitsy_m0_express" + - "itsybitsy_m4_express" + - "kicksat-sprite" + - "makerdiary_nrf52840_mdk" + - "makerdiary_nrf52840_mdk_usb_dongle" + - "meowmeow" + - "metro_m0_express" + - "metro_m4_airlift_lite" + - "metro_m4_express" + - "metro_nrf52840_express" + - "mini_sam_m4" + - "monster_m4sk" + - "particle_argon" + - "particle_boron" + - "particle_xenon" + - "pca10056" + - "pca10059" + - "pewpew10" + - "pirkey_m0" + - "pybadge" + - "pybadge_airlift" + - "pygamer" + - "pygamer_advance" + - "pyportal" + - "pyportal_titano" + - "pyruler" + - "robohatmm1_m0" + - "robohatmm1_m4" + - "sam32" + - "snekboard" + - "sparkfun_lumidrive" + - "sparkfun_nrf52840_mini" + - "sparkfun_redboard_turbo" + - "sparkfun_samd21_dev" + - "sparkfun_samd21_mini" + - "trellis_m4_express" + - "trinket_m0" + - "trinket_m0_haxpress" + - "uchip" + - "ugame10" + + steps: + - name: Set up Python 3.5 + uses: actions/setup-python@v1 + with: + python-version: 3.5 + - name: Install deps + run: | + sudo apt-get install -y gettext + pip install requests sh click setuptools awscli + wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb + - name: Versions + run: | + gcc --version + arm-none-eabi-gcc --version + python3 --version + - uses: actions/checkout@v1 + with: + submodules: true + - name: mpy-cross + run: make -C mpy-cross -j2 + - name: build + run: python3 -u build_release_files.py + working-directory: tools + env: + BOARDS: ${{ matrix.board }} + - uses: actions/upload-artifact@v1.0.0 + with: + name: ${{ matrix.board }} + path: bin/${{ matrix.board }} + - name: Upload to S3 + run: aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + - name: Install upload deps + run: | + pip install uritemplate + - name: Upload to Release + run: python3 -u upload_release_files.py + working-directory: tools + env: + UPLOAD_URL: ${{ github.event.release.upload_url }} + ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml new file mode 100644 index 0000000000..9ba1110eb8 --- /dev/null +++ b/.github/workflows/create_website_pr.yml @@ -0,0 +1,38 @@ +name: Update CircuitPython.org + +on: release + +jobs: + website: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Fail if not a release publish # workaround has `on` doesn't have this filter + run: exit 1 + if: github.event.action != 'published' + - name: Set up Python 3.5 + uses: actions/setup-python@v1 + with: + python-version: 3.5 + - name: Install deps + run: | + pip install requests sh click + - name: Versions + run: | + gcc --version + python3 --version + - uses: actions/checkout@v1 + with: + submodules: true + - name: CircuitPython version + run: git describe --dirty --always --tags + - name: Website + run: python3 build_board_info.py + working-directory: tools + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }} + if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 47e7dea781..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,161 +0,0 @@ -sudo: required -dist: xenial -language: c -compiler: - - gcc -git: - depth: 6 - -# Each item under 'env' is a separate Travis job to execute. -# They run in separate environments, so each one must take the time -# to clone the repository and submodules; to download and install SDKs, -# pip packages, and so forth. By gathering activities together in optimal -# ways, the "run time" and "total time" of the travis jobs can be minimized. -# -# Builds are organized so some will complete quickly, and others are of -# approximately equal size. Try not to freeze out other Travis users. -# -# Board names are in alphabetical order for easy finding, but grouped by -# Adafruit/modified-Adafruit and Other. Ideally they'd be separated into -# separate jobs, but there are too many. -# -# When adding new boards, take a look on the travis CI page -# https://travis-ci.org/adafruit/circuitpython to which build that installs -# that SDK is shortest and add it there. In the case of major re-organizations, -# just try to make the builds "about equal in run time" -env: - # Non-board tasks - - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="" - # Adafruit and Nordic nRF boards - - TRAVIS_BOARDS="circuitplayground_bluefruit feather_nrf52840_express metro_nrf52840_express pca10056 pca10059" TRAVIS_SDK=arm - # Other nRF boards - - TRAVIS_BOARDS="electronut_labs_blip electronut_labs_papyr makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_argon particle_boron particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm - # Adafruit and modified Adafruit SAMD21 (M0) + Other SAMD21 (M0) - - TRAVIS_BOARDS="circuitplayground_express circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m0_supersized feather_radiofruit_zigbee gemma_m0 hallowing_m0_express " TRAVIS_SDK=arm - - TRAVIS_BOARDS="itsybitsy_m0_express metro_m0_express pirkey_m0 pyruler trinket_m0 trinket_m0_haxpress arduino_mkr1300 arduino_mkrzero arduino_zero bast_pro_mini_m0 catwan_usbstick datum_distance datum_imu datum_weather" TRAVIS_SDK=arm - - TRAVIS_BOARDS="escornabot_makech meowmeow pewpew10 robohatmm1_m0 snekboard sparkfun_lumidrive sparkfun_redboard_turbo sparkfun_samd21_dev sparkfun_samd21_mini uchip ugame10" TRAVIS_SDK=arm - # Adafruit SAMD51 (M4) + Other SAMD51 - - TRAVIS_BOARDS="feather_m4_express grandcentral_m4_express itsybitsy_m4_express metro_m4_airlift_lite metro_m4_express pybadge pybadge_airlift" TRAVIS_SDK=arm - - TRAVIS_BOARDS="pyportal pyportal_titano trellis_m4_express capablerobot_usbhub cp32-m4 datalore_ip_m4 datum_light" TRAVIS_SDK=arm - - TRAVIS_BOARDS="pygamer pygamer_advance monster_m4sk kicksat-sprite mini_sam_m4 robohatmm1_m4 sam32" TRAVIS_SDK=arm - - -addons: - artifacts: - paths: - - $(ls -d1 bin/*/*/* | tr "\n" ":") - target_paths: / - -# Some deploy jobs take over 10 minutes so use this keep alive hack to make sure Travis doesn't kill us. -before_deploy: | - function keep_alive() { - while true; do - echo -en "\a" - sleep 5 - done - } - keep_alive & - -deploy: - provider: releases - api_key: - secure: "jdqVFw6itRY4qwQF4ReXo0uaymT+Mob6RhYX0lw8KWFNqBgHnLVuKmKKcGMEuRvBVMPkvxF7bMuOQzSBOunqwlHFse3oMzdWvQODv1zwV7pSRXGwTdIvTPbBjKWxnBG9uSNRf2R5AMflJFUxy2CbtBpgvNzr+4VLREZDrrjEu8C1iTtXGpSm5AQ5iIp2fkMAWD85FP7CQPpkqRoxhSIFZmTdurfYRmenq1OZ/4SeD5TESKcyvqJNzVT9z210B3cg3eAkP6ukvelW4qE2zgIANqUkGqvDEnAvEII9M89kuwhCMAekdfwnUSPrry+g77i1dUZHoRN1+MFj+waYtPaqxdYo2G1sysa6enxlu4jHMR5MfMk9eKHgaNgL3PiyANusYSS44amh8QIiVaX5nw82myZDCpQOZW7YqJKE6WX70Lbs4mS+wIs+ig4KIXO1B0p9kMb0OeVjHRl+KcXsWGRu/ECG/ExpqlVIssSPU407LohMXT2cJ37CY/R/EeK2XSDsQ2M3L3EAGUjCJdBGuwsOJ+2lG+HQpAVu9vAB4kq5jy9Ye+MG+8Xlkly3XZZ5+FkXyYxKnXb26/QVv0e5sIG5OmdJCPYFaH2J1QdKo7CdhEcBtrf6DMPWaimGMldShFqzLjOz3b3qLysRxFF0aGb7ipKPa57vawNzYHoPAViOcXQ=" - file_glob: true - file: "$TRAVIS_BUILD_DIR/bin/*/*/*" - skip_cleanup: true - on: - tags: true - -notifications: - webhooks: - urls: - - https://rosie-ci.ngrok.io/travis - on_success: always - on_failure: always - on_start: always - on_cancel: always - on_error: always - -before_script: - # Expand the git tree back to 4.0.0-alpha.1 and then fetch the latest tag. - - LAST_TAG=`git ls-remote --quiet --tags --sort=version:refname | egrep -o "refs/tags/[0-9]+.*\$" | tail -n 1` - - git fetch --depth 1 origin $LAST_TAG:$LAST_TAG - - git describe --dirty --always --tags - - function var_search () { case "$1" in *$2*) true;; *) false;; esac; } - - sudo dpkg --add-architecture i386 - - - (! var_search "${TRAVIS_SDK-}" arm || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb)) - - # For huzzah builds - - (! var_search "${TRAVIS_SDK-}" esp8266 || (wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar -C .. -xaf xtensa-lx106-elf-standalone.tar.gz)) - - if var_search "${TRAVIS_SDK-}" esp8266 ; then PATH=$(readlink -f ../xtensa-lx106-elf/bin):$PATH; fi - - # For coverage testing (upgrade is used to get latest urllib3 version) - - sudo apt-get install -y python3-pip - - pip3 install --user sh click setuptools - - ([[ -z "$TRAVIS_TESTS" ]] || sudo pip install --upgrade cpp-coveralls) - - (! var_search "${TRAVIS_TESTS-}" docs || sudo apt-get install -y librsvg2-bin) - - (! var_search "${TRAVIS_TESTS-}" docs || pip3 install --user Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter) - - (! var_search "${TRAVIS_TESTS-}" translations || pip3 install --user polib) - - # Check if there's any board missing in TRAVIS_BOARDS - - cd tools && python3 -u travis_new_boards_check.py - - cd .. - - # report some good version numbers to the build - - gcc --version - - (! var_search "${TRAVIS_SDK-}" arm || arm-none-eabi-gcc --version) - - (! var_search "${TRAVIS_SDK-}" esp8266 || xtensa-lx106-elf-gcc --version) - - python3 --version - -script: - # Build mpy-cross first because other builds depend on it. - - echo 'Building mpy-cross' && echo 'travis_fold:start:mpy-cross' - - make -C mpy-cross -j2 ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:mpy-cross' && tools/print_status.py status - - # Use unbuffered output because building all the releases can take a long time. - # Travis will cancel the job if it sees no output for >10 minutes. - - cd tools && python3 -u build_release_files.py - - cd .. - - - echo 'Building unix' && echo 'travis_fold:start:unix' - - (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:unix' && tools/print_status.py status - - # run tests without coverage info - #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1) - #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests -j1 --emit native) - - # run tests with coverage info - - echo 'Test all' && echo 'travis_fold:start:test_all' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:test_all' && tools/print_status.py status - - - echo 'Test threads' && echo 'travis_fold:start:test_threads' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:test_threads' && tools/print_status.py status - - - echo 'Testing with native' && echo 'travis_fold:start:test_native' - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:test_native' && tools/print_status.py status - - - (echo 'Testing with mpy' && echo 'travis_fold:start:test_mpy') - - (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:test_mpy' && tools/print_status.py status - - - (echo 'Building docs' && echo 'travis_fold:start:build_docs') - - (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:build_docs' && tools/print_status.py status - - - (echo 'Building translations' && echo 'travis_fold:start:build_translations') - - (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; S=$? ; echo $S > status ; (exit $S) - - echo 'travis_fold:end:build_translations' && tools/print_status.py status - - # run coveralls coverage analysis (try to, even if some builds/tests failed) - #- (cd ports/unix && coveralls --root ../.. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod) - - - (! var_search "${TRAVIS_TESTS-}" website || (cd tools && python3 build_board_info.py && cd ..)) - -after_failure: - - (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 8731a6feb0..f2b3364949 100644 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -88,10 +88,8 @@ def get_version_info(): # No exact match pass - if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true": - sha = os.environ["TRAVIS_COMMIT"] - if os.environ["TRAVIS_PULL_REQUEST"] != "false": - sha = os.environ["TRAVIS_PULL_REQUEST_SHA"] + if "GITHUB_SHA" in os.environ: + sha = os.environ["GITHUB_SHA"] if not version: version="{}-{}".format(date.today().strftime("%Y%m%d"), sha[:7]) @@ -132,7 +130,7 @@ def create_pr(changes, updated, git_info): updated_list.append(info) updated = json.dumps(updated_list, sort_keys=True, indent=4).encode("utf-8") + b"\n" - print(updated.decode("utf-8")) + #print(updated.decode("utf-8")) pr_title = "Automated website update for release {}".format(changes["new_release"]) boards = "" if changes["new_boards"]: @@ -208,7 +206,7 @@ def generate_download_info(): boards = {} errors = [] - new_tag = os.environ["TRAVIS_TAG"] + new_tag = os.environ["RELEASE_TAG"] changes = { "new_release": new_tag, @@ -240,7 +238,6 @@ def generate_download_info(): board_mapping = get_board_mapping() - print(previous_releases) for release in previous_releases: update_downloads(board_mapping, release) @@ -280,7 +277,7 @@ def generate_download_info(): print("No new release to update") if __name__ == "__main__": - if "TRAVIS_TAG" in os.environ and os.environ["TRAVIS_TAG"]: + if "RELEASE_TAG" in os.environ and os.environ["RELEASE_TAG"]: generate_download_info() else: print("skipping website update because this isn't a tag") diff --git a/tools/build_release_files.py b/tools/build_release_files.py index e29b098c79..09133e51fa 100755 --- a/tools/build_release_files.py +++ b/tools/build_release_files.py @@ -10,21 +10,14 @@ import time for port in build_info.SUPPORTED_PORTS: result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True) -ROSIE_SETUPS = ["rosie-ci"] -rosie_ok = {} -for rosie in ROSIE_SETUPS: - rosie_ok[rosie] = True - PARALLEL = "-j 5" -travis = False -if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true": +if "GITHUB_ACTION" in os.environ: PARALLEL="-j 2" - travis = True all_boards = build_info.get_board_mapping() build_boards = list(all_boards.keys()) -if "TRAVIS_BOARDS" in os.environ: - build_boards = os.environ["TRAVIS_BOARDS"].split() +if "BOARDS" in os.environ: + build_boards = os.environ["BOARDS"].split() sha, version = build_info.get_version_info() @@ -83,25 +76,14 @@ for board in build_boards: if exit_status == 0: exit_status = 1 - if travis: - print('travis_fold:start:adafruit-bins-{}-{}\\r'.format(language, board)) print("Build {board} for {language}{clean_build} took {build_duration:.2f}s and {success}".format( board=board, language=language, clean_build=(" (clean_build)" if clean_build else ""), build_duration=build_duration, success=success)) - if make_result.returncode != 0: - print(make_result.stdout.decode("utf-8")) - print(other_output) - # Only upload to Rosie if its a pull request. - if travis: - for rosie in ROSIE_SETUPS: - if not rosie_ok[rosie]: - break - print("Uploading to https://{rosie}.ngrok.io/upload/{sha}".format(rosie=rosie, sha=sha)) - #curl -F "file=@$final_filename" https://$rosie.ngrok.io/upload/$sha - if travis: - print('travis_fold:end:adafruit-bins-{}-{}\\r'.format(language, board)) - # Flush so travis will see something before 10 minutes has passed. + print(make_result.stdout.decode("utf-8")) + print(other_output) + + # Flush so we will see something before 10 minutes has passed. print(flush=True) sys.exit(exit_status) diff --git a/tools/ci_new_boards_check.py b/tools/ci_new_boards_check.py new file mode 100644 index 0000000000..7ad8af8424 --- /dev/null +++ b/tools/ci_new_boards_check.py @@ -0,0 +1,50 @@ +#! /usr/bin/env python3 + +import sys +import os +import json +import yaml + +import build_board_info + +workflow_file = '.github/workflows/build.yml' + +# Get boards in json format +boards_info_json = build_board_info.get_board_mapping() + +# Get all the boards out of the json format +info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)] + +# We need to know the path of the workflow file +base_path = os.path.dirname(__file__) +yml_path = os.path.abspath(os.path.join(base_path, '..', workflow_file)) + +# Loading board list based on build jobs in the workflow file. +ci_boards = [] +with open(yml_path, "r") as f: + workflow = yaml.safe_load(f) + +ok = True +for job in workflow["jobs"]: + if not job.startswith("build"): + continue + job_boards = workflow["jobs"][job]["strategy"]["matrix"]["board"] + if job_boards != sorted(job_boards): + print("Boards for job \"{}\" not sorted. Must be:".format(job)) + print(" - \"" + "\"\n - \"".join(sorted(job_boards)) + "\"") + ok = False + ci_boards.extend(job_boards) + +# All the travis_boards elements must be on info_boards +info_boards.sort() +ci_boards.sort() + +missing_boards = set(info_boards) - set(ci_boards) + +if missing_boards: + print('Boards missing in {}:'.format(workflow_file)) + for board in missing_boards: + print(board) + +if not ok: + sys.exit(1) diff --git a/tools/travis_new_boards_check.py b/tools/travis_new_boards_check.py deleted file mode 100644 index 5ae05aec45..0000000000 --- a/tools/travis_new_boards_check.py +++ /dev/null @@ -1,51 +0,0 @@ -#! /usr/bin/env python3 - -import sys -import os -import json - -import build_board_info - -# Get boards in json format -boards_info_json = build_board_info.get_board_mapping() - -# Get all the boards out of the json format -info_boards = [board for board in boards_info_json.keys() if not boards_info_json[board].get("alias", False)] - -# We need to know the path of the .travis.yml file -base_path = os.path.dirname(__file__) -travis_path = os.path.abspath(os.path.join(base_path, '..', '.travis.yml')) - -# Loading board list based on TRAVIS_BOARDS env variable on .travis.yml -travis_boards = [] -with open(travis_path, 'r') as travis: - - # Get all lines that contain the substring 'TRAVIS_BOARDS' - for line in travis: - - # Get the lines with TRAVIS_BOARDS= in it - if line.find('TRAVIS_BOARDS=') is not -1: - # Store all the boards names into travis_boards - begin_of_names = line.find('TRAVIS_BOARDS=') + len('TRAVIS_BOARDS=') + 1 - end_of_names = line.rfind('"') - boards = line[begin_of_names:end_of_names] - boards = boards.split(' ') - travis_boards.extend(boards) - - # We've reached the end of the env: section - elif 'addons' in line: - break - else: - pass - -# All the travis_boards elements must be on info_boards -info_boards.sort() -travis_boards.sort() - -missing_boards = set(info_boards) - set(travis_boards) - -if missing_boards: - print('Boards missing in TRAVIS_BOARDS:') - for board in missing_boards: - print(board) - sys.exit(1) diff --git a/tools/upload_release_files.py b/tools/upload_release_files.py new file mode 100755 index 0000000000..6c842dc684 --- /dev/null +++ b/tools/upload_release_files.py @@ -0,0 +1,32 @@ +#! /usr/bin/env python3 + +import os +import os.path +import sys +import uritemplate + +sys.path.append("adabot") +import adabot.github_requests as github + +exit_status = 0 + +for dirpath, dirnames, filenames in os.walk("../bin"): + if not filenames: + continue + for filename in filenames: + full_filename = os.path.join(dirpath, filename) + label = filename.replace("adafruit-circuitpython-", "") + url_vars = {} + url_vars["name"] = filename + url_vars["label"] = label + url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars) + headers = {"content-type": "application/octet-stream"} + print(url) + with open(full_filename, "rb") as f: + response = github.post(url, data=f, headers=headers) + if not response.ok: + print("Upload of {} failed with {}.".format(filename, response.status_code)) + print(response.text) + sys.exit(response.status_code) + +sys.exit(exit_status) From 19c59b41edcfdbb2ef67c73729fb8c866dd360ad Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Aug 2019 16:15:09 -0400 Subject: [PATCH 26/41] bleio: API change to create and connect related objects simulatenously: no orphan bleio objects --- locale/ID.po | 41 +---- locale/circuitpython.pot | 41 +---- locale/de_DE.po | 47 ++--- locale/en_US.po | 41 +---- locale/en_x_pirate.po | 41 +---- locale/es.po | 54 +++--- locale/fil.po | 41 +---- locale/fr.po | 51 ++---- locale/it_IT.po | 47 ++--- locale/pl.po | 51 ++---- locale/pt_BR.po | 41 +---- locale/zh_Latn_pinyin.po | 50 ++---- ports/nrf/common-hal/bleio/Adapter.c | 9 +- ports/nrf/common-hal/bleio/Central.c | 10 +- ports/nrf/common-hal/bleio/Central.h | 2 +- ports/nrf/common-hal/bleio/Characteristic.c | 67 +++++-- ports/nrf/common-hal/bleio/Descriptor.c | 22 +-- ports/nrf/common-hal/bleio/Descriptor.h | 2 +- ports/nrf/common-hal/bleio/Peripheral.c | 55 +++--- ports/nrf/common-hal/bleio/Peripheral.h | 4 +- ports/nrf/common-hal/bleio/Service.c | 149 ++++++--------- ports/nrf/common-hal/bleio/__init__.c | 16 +- py/obj.h | 1 + py/objstr.c | 8 + shared-bindings/bleio/Characteristic.c | 189 ++++++++++---------- shared-bindings/bleio/Characteristic.h | 4 +- shared-bindings/bleio/Descriptor.c | 63 +------ shared-bindings/bleio/Descriptor.h | 3 +- shared-bindings/bleio/Peripheral.c | 98 ++++++---- shared-bindings/bleio/Peripheral.h | 4 +- shared-bindings/bleio/Service.c | 162 ++++++++++------- shared-bindings/bleio/Service.h | 4 +- shared-bindings/bleio/__init__.h | 2 +- 33 files changed, 598 insertions(+), 822 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 95b1c26dce..2451899d9f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -437,18 +437,6 @@ msgstr "tidak dapat mendapatkan ukuran scalar secara tidak ambigu" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -524,10 +512,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -565,7 +549,7 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -588,6 +572,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -864,7 +849,7 @@ msgstr "Pin-pin tidak valid" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1705,10 +1690,6 @@ msgstr "tidak dapat melakukan relative import" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1769,10 +1750,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "'except' standar harus terakhir" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2112,7 +2089,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2131,6 +2107,11 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "modul tidak ditemukan" @@ -2218,10 +2199,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d478baef44..c117663a68 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -427,18 +427,6 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -513,10 +501,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -554,7 +538,7 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -577,6 +561,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -849,7 +834,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1671,10 +1656,6 @@ msgstr "" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1735,10 +1716,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2078,7 +2055,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2097,6 +2073,11 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "" @@ -2183,10 +2164,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index e39d157f45..c8f3715a55 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -431,18 +431,6 @@ msgstr "sizeof scalar kann nicht eindeutig bestimmt werden" msgid "Cannot write without MOSI pin." msgstr "Kann nicht ohne MOSI-Pin schreiben." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "Characteristic UUID stimmt nicht mit der Service-UUID überein" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "Characteristic wird bereits von einem anderen Dienst verwendet." - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Schreiben von CharacteristicBuffer ist nicht vorgesehen" @@ -517,10 +505,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "Zu vielen Daten für das advertisement packet" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "Die Zielkapazität ist kleiner als destination_length." @@ -558,7 +542,7 @@ msgstr "Erwartet ein(e) %q" msgid "Expected a Characteristic" msgstr "Characteristic wird erwartet" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Eine UUID wird erwartet" @@ -581,6 +565,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -855,7 +840,7 @@ msgstr "Ungültige Pins" msgid "Invalid polarity" msgstr "Ungültige Polarität" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1711,10 +1696,6 @@ msgstr "kann keinen relativen Import durchführen" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1775,10 +1756,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "Die Standart-Ausnahmebehandlung muss als letztes sein" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2125,7 +2102,6 @@ msgstr "map buffer zu klein" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2144,6 +2120,11 @@ msgstr "Speicherzuordnung fehlgeschlagen, Zuweisung von %u Bytes" msgid "memory allocation failed, heap is locked" msgstr "Speicherzuweisung fehlgeschlagen, der Heap ist gesperrt" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "Modul nicht gefunden" @@ -2230,10 +2211,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2790,6 +2767,12 @@ msgstr "" #~ msgid "Cannot update i/f status" #~ msgstr "Kann i/f Status nicht updaten" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "Characteristic UUID stimmt nicht mit der Service-UUID überein" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "Characteristic wird bereits von einem anderen Dienst verwendet." + #~ msgid "Data too large for the advertisement packet" #~ msgstr "Daten sind zu groß für das advertisement packet" diff --git a/locale/en_US.po b/locale/en_US.po index 186ac9a4fb..086a5065d6 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -427,18 +427,6 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -513,10 +501,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -554,7 +538,7 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -577,6 +561,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -849,7 +834,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1671,10 +1656,6 @@ msgstr "" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1735,10 +1716,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2078,7 +2055,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2097,6 +2073,11 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "" @@ -2183,10 +2164,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 21c49745cd..86cd819ed4 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -431,18 +431,6 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -517,10 +505,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -558,7 +542,7 @@ msgstr "" msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -581,6 +565,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -853,7 +838,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1675,10 +1660,6 @@ msgstr "" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1739,10 +1720,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2082,7 +2059,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2101,6 +2077,11 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "" @@ -2187,10 +2168,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/es.po b/locale/es.po index 89052a6ba6..8fb536ea71 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -435,18 +435,6 @@ msgstr "No se puede obtener inequívocamente sizeof escalar" msgid "Cannot write without MOSI pin." msgstr "No se puede escribir sin pin MOSI." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "Características UUID no concide con el Service UUID" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "Características ya esta en uso por otro Serivice" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharateristicBuffer escritura no proporcionada" @@ -521,10 +509,6 @@ msgstr "Trozo de datos debe seguir fmt chunk" msgid "Data too large for advertisement packet" msgstr "Data es muy grande para el paquete de advertisement." -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "Capacidad de destino es mas pequeña que destination_length." @@ -562,7 +546,7 @@ msgstr "Se espera un %q" msgid "Expected a Characteristic" msgstr "Se esperaba una Característica." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Se esperaba un UUID" @@ -585,6 +569,7 @@ msgstr "Fallo enviando comando" msgid "Failed to acquire mutex, err 0x%04x" msgstr "No se puede adquirir el mutex, status: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -860,7 +845,7 @@ msgstr "pines inválidos" msgid "Invalid polarity" msgstr "Polaridad inválida" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1723,10 +1708,6 @@ msgstr "no se puedo realizar importación relativa" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "characteristics incluye un objeto que no es una Characteristica" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "chars buffer es demasiado pequeño" @@ -1787,10 +1768,6 @@ msgstr "números decimales no soportados" msgid "default 'except' must be last" msgstr "'except' por defecto deberia estar de último" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2135,7 +2112,6 @@ msgstr "map buffer muy pequeño" msgid "math domain error" msgstr "error de dominio matemático" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2154,6 +2130,11 @@ msgstr "la asignación de memoria falló, asignando %u bytes" msgid "memory allocation failed, heap is locked" msgstr "la asignación de memoria falló, el heap está bloqueado" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "módulo no encontrado" @@ -2240,10 +2221,6 @@ msgstr "" msgid "no such attribute" msgstr "no hay tal atributo" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2798,6 +2775,12 @@ msgstr "paso cero" #~ msgid "Cannot update i/f status" #~ msgstr "No se puede actualizar i/f status" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "Características UUID no concide con el Service UUID" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "Características ya esta en uso por otro Serivice" + #, fuzzy #~ msgid "Data too large for the advertisement packet" #~ msgstr "Los datos no caben en el paquete de anuncio." @@ -2905,8 +2888,8 @@ msgstr "paso cero" #~ "Only monochrome, indexed 8bpp, and 16bpp or greater BMPs supported: %d " #~ "bpp given" #~ msgstr "" -#~ "Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:" -#~ "% d bppdado" +#~ "Solo se admiten BMP monocromos, indexados de 8bpp y 16bpp o superiores:% " +#~ "d bppdado" #~ msgid "Only true color (24 bpp or higher) BMP supported %x" #~ msgstr "Solo color verdadero (24 bpp o superior) BMP admitido %x" @@ -2975,6 +2958,9 @@ msgstr "paso cero" #~ msgid "can't set STA config" #~ msgstr "no se puede establecer STA config" +#~ msgid "characteristics includes an object that is not a Characteristic" +#~ msgstr "characteristics incluye un objeto que no es una Characteristica" + #~ msgid "either pos or kw args are allowed" #~ msgstr "ya sea pos o kw args son permitidos" diff --git a/locale/fil.po b/locale/fil.po index b034afba01..9b9a585672 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -435,18 +435,6 @@ msgstr "Hindi puedeng hindi sigurado ang get sizeof scalar" msgid "Cannot write without MOSI pin." msgstr "Hindi maaring isulat kapag walang MOSI pin." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -524,10 +512,6 @@ msgstr "Dapat sunurin ng Data chunk ang fmt chunk" msgid "Data too large for advertisement packet" msgstr "Hindi makasya ang data sa loob ng advertisement packet" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -567,7 +551,7 @@ msgstr "Umasa ng %q" msgid "Expected a Characteristic" msgstr "Hindi mabasa and Characteristic." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -591,6 +575,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -869,7 +854,7 @@ msgstr "Mali ang pins" msgid "Invalid polarity" msgstr "Mali ang polarity" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1731,10 +1716,6 @@ msgstr "hindi maaring isagawa ang relative import" msgid "casting" msgstr "casting" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "masyadong maliit ang buffer" @@ -1795,10 +1776,6 @@ msgstr "decimal numbers hindi sinusuportahan" msgid "default 'except' must be last" msgstr "default 'except' ay dapat sa huli" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2148,7 +2125,6 @@ msgstr "masyadong maliit ang buffer map" msgid "math domain error" msgstr "may pagkakamali sa math domain" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2167,6 +2143,11 @@ msgstr "nabigo ang paglalaan ng memorya, paglalaan ng %u bytes" msgid "memory allocation failed, heap is locked" msgstr "abigo ang paglalaan ng memorya, ang heap ay naka-lock" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "module hindi nakita" @@ -2254,10 +2235,6 @@ msgstr "" msgid "no such attribute" msgstr "walang ganoon na attribute" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index d386723ebb..b6183ca289 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -441,18 +441,6 @@ msgstr "Impossible d'obtenir la taille du scalaire sans ambigüité" msgid "Cannot write without MOSI pin." msgstr "Impossible d'écrire sans broche MOSI." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "L'UUID de 'Characteristic' ne correspond pas à l'UUID du Service" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "'Characteristic' déjà en utilisation par un autre service" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Ecriture sur 'CharacteristicBuffer' non fournie" @@ -529,10 +517,6 @@ msgstr "Un bloc de données doit suivre un bloc de format" msgid "Data too large for advertisement packet" msgstr "Données trop volumineuses pour un paquet de diffusion" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "La capacité de destination est plus petite que 'destination_length'." @@ -571,7 +555,7 @@ msgstr "Attendu un %q" msgid "Expected a Characteristic" msgstr "Une 'Characteristic' est attendue" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -595,6 +579,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Echec de l'obtention de mutex, err 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -877,7 +862,7 @@ msgstr "Broches invalides" msgid "Invalid polarity" msgstr "Polarité invalide" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1761,10 +1746,6 @@ msgstr "ne peut pas réaliser un import relatif" msgid "casting" msgstr "typage" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "'characteristics' inclut un objet qui n'est pas une 'Characteristic'" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "tampon de caractères trop petit" @@ -1830,10 +1811,6 @@ msgstr "nombres décimaux non supportés" msgid "default 'except' must be last" msgstr "l''except' par défaut doit être en dernier" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2180,7 +2157,6 @@ msgstr "tampon trop petit" msgid "math domain error" msgstr "erreur de domaine math" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2199,6 +2175,11 @@ msgstr "l'allocation de mémoire a échoué en allouant %u octets" msgid "memory allocation failed, heap is locked" msgstr "l'allocation de mémoire a échoué, le tas est vérrouillé" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "module introuvable" @@ -2287,10 +2268,6 @@ msgstr "" msgid "no such attribute" msgstr "pas de tel attribut" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2854,6 +2831,12 @@ msgstr "'step' nul" #~ msgid "Cannot update i/f status" #~ msgstr "le status i/f ne peut être mis à jour" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "L'UUID de 'Characteristic' ne correspond pas à l'UUID du Service" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "'Characteristic' déjà en utilisation par un autre service" + #~ msgid "Data too large for the advertisement packet" #~ msgstr "Données trop volumineuses pour le paquet de diffusion" @@ -3027,6 +3010,10 @@ msgstr "'step' nul" #~ msgid "can't set STA config" #~ msgstr "impossible de régler la config de 'STA'" +#~ msgid "characteristics includes an object that is not a Characteristic" +#~ msgstr "" +#~ "'characteristics' inclut un objet qui n'est pas une 'Characteristic'" + #~ msgid "either pos or kw args are allowed" #~ msgstr "soit 'pos', soit 'kw' est permis en argument" diff --git a/locale/it_IT.po b/locale/it_IT.po index 293ae97a0e..01729d00bc 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -436,18 +436,6 @@ msgstr "Impossibile ricavare la grandezza scalare di sizeof inequivocabilmente" msgid "Cannot write without MOSI pin." msgstr "Impossibile scrivere senza pin MOSI." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "caratteristico UUID non assomiglia servizio UUID" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "caratteristico già usato da un altro servizio" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharacteristicBuffer scritura non dato" @@ -525,10 +513,6 @@ msgstr "" msgid "Data too large for advertisement packet" msgstr "Impossibile inserire dati nel pacchetto di advertisement." -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "La capacità di destinazione è più piccola di destination_length." @@ -567,7 +551,7 @@ msgstr "Atteso un %q" msgid "Expected a Characteristic" msgstr "Non è possibile aggiungere Characteristic." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -591,6 +575,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -870,7 +855,7 @@ msgstr "Pin non validi" msgid "Invalid polarity" msgstr "Polarità non valida" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1722,10 +1707,6 @@ msgstr "impossibile effettuare l'importazione relativa" msgid "casting" msgstr "casting" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "buffer dei caratteri troppo piccolo" @@ -1788,10 +1769,6 @@ msgstr "numeri decimali non supportati" msgid "default 'except' must be last" msgstr "'except' predefinito deve essere ultimo" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2141,7 +2118,6 @@ msgstr "map buffer troppo piccolo" msgid "math domain error" msgstr "errore di dominio matematico" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2160,6 +2136,11 @@ msgstr "allocazione di memoria fallita, allocando %u byte" msgid "memory allocation failed, heap is locked" msgstr "allocazione di memoria fallita, l'heap è bloccato" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "modulo non trovato" @@ -2248,10 +2229,6 @@ msgstr "" msgid "no such attribute" msgstr "attributo inesistente" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2809,6 +2786,12 @@ msgstr "zero step" #~ msgid "Cannot update i/f status" #~ msgstr "Impossibile aggiornare status di i/f" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "caratteristico UUID non assomiglia servizio UUID" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "caratteristico già usato da un altro servizio" + #, fuzzy #~ msgid "Data too large for the advertisement packet" #~ msgstr "Impossibile inserire dati nel pacchetto di advertisement." diff --git a/locale/pl.po b/locale/pl.po index c275bd4d05..33a9f76ae2 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -430,18 +430,6 @@ msgstr "Wielkość skalara jest niejednoznaczna" msgid "Cannot write without MOSI pin." msgstr "Nie można pisać bez nóżki MOSI." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "UUID charakterystyki inny niż UUID serwisu" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "Charakterystyka w użyciu w innym serwisie" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Pisanie do CharacteristicBuffer niewspierane" @@ -516,10 +504,6 @@ msgstr "Fragment danych musi następować po fragmencie fmt" msgid "Data too large for advertisement packet" msgstr "Zbyt dużo danych pakietu rozgłoszeniowego" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "Pojemność celu mniejsza od destination_length." @@ -557,7 +541,7 @@ msgstr "Oczekiwano %q" msgid "Expected a Characteristic" msgstr "Oczekiwano charakterystyki" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Oczekiwano UUID" @@ -580,6 +564,7 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nie udało się uzyskać blokady, błąd 0x$04x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -854,7 +839,7 @@ msgstr "Złe nóżki" msgid "Invalid polarity" msgstr "Zła polaryzacja" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1695,10 +1680,6 @@ msgstr "nie można wykonać relatywnego importu" msgid "casting" msgstr "rzutowanie" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "charakterystyki zawierają obiekt, który nie jest typu Characteristic" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "bufor chars zbyt mały" @@ -1759,10 +1740,6 @@ msgstr "liczby dziesiętne nieobsługiwane" msgid "default 'except' must be last" msgstr "domyślny 'except' musi być ostatni" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2103,7 +2080,6 @@ msgstr "bufor mapy zbyt mały" msgid "math domain error" msgstr "błąd domeny" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2122,6 +2098,11 @@ msgstr "alokacja pamięci nie powiodła się, alokowano %u bajtów" msgid "memory allocation failed, heap is locked" msgstr "alokacja pamięci nie powiodła się, sterta zablokowana" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "brak modułu" @@ -2208,10 +2189,6 @@ msgstr "" msgid "no such attribute" msgstr "nie ma takiego atrybutu" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2743,6 +2720,12 @@ msgstr "zerowy krok" #~ msgid "Can't connect in Peripheral mode" #~ msgstr "Nie można się łączyć w trybie Peripheral" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "UUID charakterystyki inny niż UUID serwisu" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "Charakterystyka w użyciu w innym serwisie" + #~ msgid "Data too large for the advertisement packet" #~ msgstr "Zbyt dużo danych pakietu rozgłoszeniowego" @@ -2799,6 +2782,10 @@ msgstr "zerowy krok" #~ msgid "bad GATT role" #~ msgstr "zła rola GATT" +#~ msgid "characteristics includes an object that is not a Characteristic" +#~ msgstr "" +#~ "charakterystyki zawierają obiekt, który nie jest typu Characteristic" + #~ msgid "interval not in range 0.0020 to 10.24" #~ msgstr "przedział poza zakresem 0.0020 do 10.24" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 2ae16f9922..cc7a6ef3be 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -432,18 +432,6 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "Não é possível ler sem um pino MOSI" -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "" - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -520,10 +508,6 @@ msgstr "Pedaço de dados deve seguir o pedaço de cortes" msgid "Data too large for advertisement packet" msgstr "Não é possível ajustar dados no pacote de anúncios." -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "" @@ -562,7 +546,7 @@ msgstr "Esperado um" msgid "Expected a Characteristic" msgstr "Não é possível adicionar Característica." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -586,6 +570,7 @@ msgstr "Falha ao enviar comando." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Não é possível ler o valor do atributo. status: 0x%02x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -863,7 +848,7 @@ msgstr "Pinos inválidos" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1695,10 +1680,6 @@ msgstr "" msgid "casting" msgstr "" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -1759,10 +1740,6 @@ msgstr "" msgid "default 'except' must be last" msgstr "" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2103,7 +2080,6 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2122,6 +2098,11 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "" @@ -2209,10 +2190,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 886bba62a3..f0fbebb997 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-22 14:29-0700\n" +"POT-Creation-Date: 2019-08-28 16:09-0400\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -431,18 +431,6 @@ msgstr "Wúfǎ míngquè de huòdé biāoliàng de dàxiǎo" msgid "Cannot write without MOSI pin." msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." -#: shared-bindings/bleio/Service.c -msgid "Characteristic UUID doesn't match Service UUID" -msgstr "Zìfú UUID bù fúhé fúwù UUID" - -#: ports/nrf/common-hal/bleio/Service.c -msgid "Characteristic already in use by another Service." -msgstr "Qítā fúwù bùmén yǐ shǐyòng de gōngnéng." - -#: shared-bindings/bleio/Service.c -msgid "Characteristic is already attached to a Service" -msgstr "" - #: shared-bindings/bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Wèi tígōng zìfú huǎncún xiě rù" @@ -517,10 +505,6 @@ msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài" msgid "Data too large for advertisement packet" msgstr "Guǎnggào bāo de shùjù tài dà" -#: shared-bindings/bleio/Characteristic.c -msgid "Descriptor is already attached to a Characteristic" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." msgstr "Mùbiāo róngliàng xiǎoyú mùdì de_chángdù." @@ -558,7 +542,7 @@ msgstr "Yùqí %q" msgid "Expected a Characteristic" msgstr "Yùqí de tèdiǎn" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Yùqí UUID" @@ -581,6 +565,7 @@ msgstr "Fāsòng mìnglìng shībài." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Wúfǎ huòdé mutex, err 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" @@ -855,7 +840,7 @@ msgstr "Wúxiào de yǐn jiǎo" msgid "Invalid polarity" msgstr "Wúxiào liǎng jí zhí" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/bleio/Service.c msgid "Invalid properties" msgstr "" @@ -1704,10 +1689,6 @@ msgstr "wúfǎ zhíxíng xiāngguān dǎorù" msgid "casting" msgstr "tóuyǐng" -#: shared-bindings/bleio/Service.c -msgid "characteristics includes an object that is not a Characteristic" -msgstr "tèxìng bāokuò bùshì zìfú de wùtǐ" - #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "zìfú huǎnchōng qū tài xiǎo" @@ -1770,10 +1751,6 @@ msgstr "bù zhīchí xiǎoshù shù" msgid "default 'except' must be last" msgstr "mòrèn 'except' bìxū shì zuìhòu yīgè" -#: shared-bindings/bleio/Characteristic.c -msgid "descriptors includes an object that is not a Descriptors" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2115,7 +2092,6 @@ msgstr "dìtú huǎnchōng qū tài xiǎo" msgid "math domain error" msgstr "shùxué yù cuòwù" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2134,6 +2110,11 @@ msgstr "nèicún fēnpèi shībài, fēnpèi %u zì jié" msgid "memory allocation failed, heap is locked" msgstr "jìyì tǐ fēnpèi shībài, duī bèi suǒdìng" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "mnax_length must be 0-%d when fixed_length is %s" +msgstr "" + #: py/builtinimport.c msgid "module not found" msgstr "zhǎo bù dào mókuài" @@ -2221,10 +2202,6 @@ msgstr "" msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" -#: shared-bindings/bleio/Peripheral.c -msgid "non-Service found in services" -msgstr "" - #: ports/nrf/common-hal/bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2759,6 +2736,12 @@ msgstr "líng bù" #~ msgid "Can't set CCCD for local Characteristic" #~ msgstr "Wúfǎ wéi běndì tèzhēng shèzhì CCCD" +#~ msgid "Characteristic UUID doesn't match Service UUID" +#~ msgstr "Zìfú UUID bù fúhé fúwù UUID" + +#~ msgid "Characteristic already in use by another Service." +#~ msgstr "Qítā fúwù bùmén yǐ shǐyòng de gōngnéng." + #~ msgid "Data too large for the advertisement packet" #~ msgstr "Guǎnggào bāo de shùjù tài dà" @@ -2828,6 +2811,9 @@ msgstr "líng bù" #~ msgid "bad GATT role" #~ msgstr "zǒng xiédìng de bùliáng juésè" +#~ msgid "characteristics includes an object that is not a Characteristic" +#~ msgstr "tèxìng bāokuò bùshì zìfú de wùtǐ" + #~ msgid "expected a DigitalInOut" #~ msgstr "qídài de DigitalInOut" diff --git a/ports/nrf/common-hal/bleio/Adapter.c b/ports/nrf/common-hal/bleio/Adapter.c index 74650e2127..74bee9e56e 100644 --- a/ports/nrf/common-hal/bleio/Adapter.c +++ b/ports/nrf/common-hal/bleio/Adapter.c @@ -66,12 +66,14 @@ STATIC uint32_t ble_stack_enable(void) { }; uint32_t err_code = sd_softdevice_enable(&clock_config, softdevice_assert_handler); - if (err_code != NRF_SUCCESS) + if (err_code != NRF_SUCCESS) { return err_code; + } err_code = sd_nvic_EnableIRQ(SD_EVT_IRQn); - if (err_code != NRF_SUCCESS) + if (err_code != NRF_SUCCESS) { return err_code; + } // Start with no event handlers, etc. ble_drv_reset(); @@ -112,8 +114,9 @@ STATIC uint32_t ble_stack_enable(void) { .conn_sup_timeout = BLE_CONN_SUP_TIMEOUT, }; err_code = sd_ble_gap_ppcp_set(&gap_conn_params); - if (err_code != NRF_SUCCESS) + if (err_code != NRF_SUCCESS) { return err_code; + } err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_UNKNOWN); return err_code; diff --git a/ports/nrf/common-hal/bleio/Central.c b/ports/nrf/common-hal/bleio/Central.c index 3c5d977841..0f8432b73a 100644 --- a/ports/nrf/common-hal/bleio/Central.c +++ b/ports/nrf/common-hal/bleio/Central.c @@ -76,7 +76,7 @@ STATIC void central_on_ble_evt(ble_evt_t *ble_evt, void *central_in) { void common_hal_bleio_central_construct(bleio_central_obj_t *self) { common_hal_bleio_adapter_set_enabled(true); - self->remote_services_list = mp_obj_new_list(0, NULL); + self->remote_service_list = mp_obj_new_list(0, NULL); self->conn_handle = BLE_CONN_HANDLE_INVALID; } @@ -134,12 +134,12 @@ bool common_hal_bleio_central_get_connected(bleio_central_obj_t *self) { mp_obj_tuple_t *common_hal_bleio_central_discover_remote_services(bleio_central_obj_t *self, mp_obj_t service_uuids_whitelist) { common_hal_bleio_device_discover_remote_services(MP_OBJ_FROM_PTR(self), service_uuids_whitelist); // Convert to a tuple and then clear the list so the callee will take ownership. - mp_obj_tuple_t *services_tuple = mp_obj_new_tuple(self->remote_services_list->len, - self->remote_services_list->items); - mp_obj_list_clear(self->remote_services_list); + mp_obj_tuple_t *services_tuple = mp_obj_new_tuple(self->remote_service_list->len, + self->remote_service_list->items); + mp_obj_list_clear(self->remote_service_list); return services_tuple; } mp_obj_list_t *common_hal_bleio_central_get_remote_services(bleio_central_obj_t *self) { - return self->remote_services_list; + return self->remote_service_list; } diff --git a/ports/nrf/common-hal/bleio/Central.h b/ports/nrf/common-hal/bleio/Central.h index b7a9050b86..2e00aa35e2 100644 --- a/ports/nrf/common-hal/bleio/Central.h +++ b/ports/nrf/common-hal/bleio/Central.h @@ -38,7 +38,7 @@ typedef struct { volatile bool waiting_to_connect; volatile uint16_t conn_handle; // Services discovered after connecting to a remote peripheral. - mp_obj_list_t *remote_services_list; + mp_obj_list_t *remote_service_list; } bleio_central_obj_t; #endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CENTRAL_H diff --git a/ports/nrf/common-hal/bleio/Characteristic.c b/ports/nrf/common-hal/bleio/Characteristic.c index 604d24d738..012029b6c3 100644 --- a/ports/nrf/common-hal/bleio/Characteristic.c +++ b/ports/nrf/common-hal/bleio/Characteristic.c @@ -124,29 +124,24 @@ STATIC void characteristic_gattc_read(bleio_characteristic_obj_t *characteristic ble_drv_remove_event_handler(characteristic_on_gattc_read_rsp_evt, characteristic); } -void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_obj_list_t *descriptor_list) { +void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { self->service = MP_OBJ_NULL; self->uuid = uuid; - self->value = mp_const_empty_bytes; self->handle = BLE_GATT_HANDLE_INVALID; self->props = props; self->read_perm = read_perm; self->write_perm = write_perm; - self->descriptor_list = descriptor_list; + self->descriptor_list = mp_obj_new_list(0, NULL); const mp_int_t max_length_max = fixed_length ? BLE_GATTS_FIX_ATTR_LEN_MAX : BLE_GATTS_VAR_ATTR_LEN_MAX; if (max_length < 0 || max_length > max_length_max) { - mp_raise_ValueError_varg(translate("max_length must be 0-%d when fixed_length is %s"), + mp_raise_ValueError_varg(translate("mnax_length must be 0-%d when fixed_length is %s"), max_length_max, fixed_length ? "True" : "False"); } self->max_length = max_length; self->fixed_length = fixed_length; - for (size_t descriptor_idx = 0; descriptor_idx < descriptor_list->len; ++descriptor_idx) { - bleio_descriptor_obj_t *descriptor = - MP_OBJ_TO_PTR(descriptor_list->items[descriptor_idx]); - descriptor->characteristic = self; - } + common_hal_bleio_characteristic_set_value(self, initial_value_bufinfo); } mp_obj_list_t *common_hal_bleio_characteristic_get_descriptor_list(bleio_characteristic_obj_t *self) { @@ -173,6 +168,15 @@ mp_obj_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *s } void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo) { + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + + self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len); + // Do GATT operations only if this characteristic has been added to a registered service. if (self->handle != BLE_GATT_HANDLE_INVALID) { uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(self->service->device); @@ -182,12 +186,6 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, (self->props & CHAR_PROP_WRITE_NO_RESPONSE)); } else { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } bool sent = false; uint16_t cccd = 0; @@ -213,8 +211,6 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, } } } - - self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len); } bleio_uuid_obj_t *common_hal_bleio_characteristic_get_uuid(bleio_characteristic_obj_t *self) { @@ -225,6 +221,43 @@ bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties return self->props; } +void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *self, bleio_descriptor_obj_t *descriptor) { + // Connect descriptor to parent characteristic. + descriptor->characteristic = self; + + ble_uuid_t desc_uuid; + bleio_uuid_convert_to_nrf_ble_uuid(descriptor->uuid, &desc_uuid); + + ble_gatts_attr_md_t desc_attr_md = { + // Data passed is not in a permanent location and should be copied. + .vloc = BLE_GATTS_VLOC_STACK, + .vlen = !descriptor->fixed_length, + }; + + bleio_attribute_gatts_set_security_mode(&desc_attr_md.read_perm, descriptor->read_perm); + bleio_attribute_gatts_set_security_mode(&desc_attr_md.write_perm, descriptor->write_perm); + + mp_buffer_info_t desc_value_bufinfo; + mp_get_buffer_raise(descriptor->value, &desc_value_bufinfo, MP_BUFFER_READ); + + ble_gatts_attr_t desc_attr = { + .p_uuid = &desc_uuid, + .p_attr_md = &desc_attr_md, + .init_len = desc_value_bufinfo.len, + .p_value = desc_value_bufinfo.buf, + .init_offs = 0, + .max_len = descriptor->max_length, + }; + + uint32_t err_code = sd_ble_gatts_descriptor_add(self->handle, &desc_attr, &descriptor->handle); + + if (err_code != NRF_SUCCESS) { + mp_raise_OSError_msg_varg(translate("Failed to add characteristic, err 0x%04x"), err_code); + } + + mp_obj_list_append(self->descriptor_list, MP_OBJ_FROM_PTR(descriptor)); +} + void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate) { if (self->cccd_handle == BLE_GATT_HANDLE_INVALID) { mp_raise_ValueError(translate("No CCCD for this Characteristic")); diff --git a/ports/nrf/common-hal/bleio/Descriptor.c b/ports/nrf/common-hal/bleio/Descriptor.c index 2a2019277d..ee8d840f2f 100644 --- a/ports/nrf/common-hal/bleio/Descriptor.c +++ b/ports/nrf/common-hal/bleio/Descriptor.c @@ -35,10 +35,9 @@ static volatile bleio_descriptor_obj_t *m_read_descriptor; -void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length) { +void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { self->characteristic = MP_OBJ_NULL; self->uuid = uuid; - self->value = mp_const_empty_bytes; self->handle = BLE_GATT_HANDLE_INVALID; self->read_perm = read_perm; self->write_perm = write_perm; @@ -50,6 +49,8 @@ void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_u } self->max_length = max_length; self->fixed_length = fixed_length; + + common_hal_bleio_descriptor_set_value(self, initial_value_bufinfo); } bleio_uuid_obj_t *common_hal_bleio_descriptor_get_uuid(bleio_descriptor_obj_t *self) { @@ -119,6 +120,15 @@ mp_obj_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self) { } void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buffer_info_t *bufinfo) { + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + + self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len); + // Do GATT operations only if this descriptor has been registered. if (self->handle != BLE_GATT_HANDLE_INVALID) { uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(self->characteristic->service->device); @@ -126,16 +136,8 @@ void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buff // false means WRITE_REQ, not write-no-response common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, false); } else { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } - common_hal_bleio_gatts_write(self->handle, conn_handle, bufinfo); } } - self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len); } diff --git a/ports/nrf/common-hal/bleio/Descriptor.h b/ports/nrf/common-hal/bleio/Descriptor.h index 6db4d7be37..db11751465 100644 --- a/ports/nrf/common-hal/bleio/Descriptor.h +++ b/ports/nrf/common-hal/bleio/Descriptor.h @@ -31,7 +31,7 @@ #include "py/obj.h" -#include "shared-bindings/bleio/Characteristic.h" +#include "common-hal/bleio/Characteristic.h" #include "common-hal/bleio/UUID.h" typedef struct { diff --git a/ports/nrf/common-hal/bleio/Peripheral.c b/ports/nrf/common-hal/bleio/Peripheral.c index 08a6d5066f..6f8a1a2fcd 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.c +++ b/ports/nrf/common-hal/bleio/Peripheral.c @@ -71,7 +71,7 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { bleio_peripheral_obj_t *self = (bleio_peripheral_obj_t*)self_in; // For debugging. - mp_printf(&mp_plat_print, "Peripheral event: 0x%04x\n", ble_evt->header.evt_id); + // mp_printf(&mp_plat_print, "Peripheral event: 0x%04x\n", ble_evt->header.evt_id); switch (ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: { @@ -156,10 +156,8 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { ble_gap_evt_auth_status_t* status = &ble_evt->evt.gap_evt.params.auth_status; if (BLE_GAP_SEC_STATUS_SUCCESS == status->auth_status) { // TODO _ediv = bonding_keys->own_enc.master_id.ediv; - mp_printf(&mp_plat_print, "Pairing succeeded, status: 0x%04x\n", status->auth_status); self->pair_status = PAIR_PAIRED; } else { - mp_printf(&mp_plat_print, "Pairing failed, status: 0x%04x\n", status->auth_status); self->pair_status = PAIR_NOT_PAIRED; } break; @@ -204,17 +202,17 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) { default: // For debugging. - mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id); + // mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id); break; } } -void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_list_t *services_list, mp_obj_t name) { +void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_t name) { common_hal_bleio_adapter_set_enabled(true); - self->services_list = services_list; + self->service_list = mp_obj_new_list(0, NULL); // Used only for discovery when acting as a client. - self->remote_services_list = mp_obj_new_list(0, NULL); + self->remote_service_list = mp_obj_new_list(0, NULL); self->name = name; self->conn_handle = BLE_CONN_HANDLE_INVALID; @@ -222,35 +220,30 @@ void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_ self->pair_status = PAIR_NOT_PAIRED; memset(&self->bonding_keys, 0, sizeof(self->bonding_keys)); +} - // Add all the services. +void common_hal_bleio_peripheral_add_service(bleio_peripheral_obj_t *self, bleio_service_obj_t *service) { + service->device = MP_OBJ_FROM_PTR(self); - for (size_t service_idx = 0; service_idx < services_list->len; ++service_idx) { - bleio_service_obj_t *service = MP_OBJ_TO_PTR(services_list->items[service_idx]); + ble_uuid_t uuid; + bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid); - service->device = MP_OBJ_FROM_PTR(self); - - ble_uuid_t uuid; - bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid); - - uint8_t service_type = BLE_GATTS_SRVC_TYPE_PRIMARY; - if (common_hal_bleio_service_get_is_secondary(service)) { - service_type = BLE_GATTS_SRVC_TYPE_SECONDARY; - } - - const uint32_t err_code = sd_ble_gatts_service_add(service_type, &uuid, &service->handle); - if (err_code != NRF_SUCCESS) { - mp_raise_OSError_msg_varg(translate("Failed to add service, err 0x%04x"), err_code); - } - - // Once the service has been registered, its characteristics can be added. - common_hal_bleio_service_add_all_characteristics(service); + uint8_t service_type = BLE_GATTS_SRVC_TYPE_PRIMARY; + if (common_hal_bleio_service_get_is_secondary(service)) { + service_type = BLE_GATTS_SRVC_TYPE_SECONDARY; } + + const uint32_t err_code = sd_ble_gatts_service_add(service_type, &uuid, &service->handle); + if (err_code != NRF_SUCCESS) { + mp_raise_OSError_msg_varg(translate("Failed to add service, err 0x%04x"), err_code); + } + + mp_obj_list_append(self->service_list, MP_OBJ_FROM_PTR(service)); } mp_obj_list_t *common_hal_bleio_peripheral_get_services(bleio_peripheral_obj_t *self) { - return self->services_list; + return self->service_list; } bool common_hal_bleio_peripheral_get_connected(bleio_peripheral_obj_t *self) { @@ -344,9 +337,9 @@ void common_hal_bleio_peripheral_disconnect(bleio_peripheral_obj_t *self) { mp_obj_tuple_t *common_hal_bleio_peripheral_discover_remote_services(bleio_peripheral_obj_t *self, mp_obj_t service_uuids_whitelist) { common_hal_bleio_device_discover_remote_services(MP_OBJ_FROM_PTR(self), service_uuids_whitelist); // Convert to a tuple and then clear the list so the callee will take ownership. - mp_obj_tuple_t *services_tuple = mp_obj_new_tuple(self->remote_services_list->len, - self->remote_services_list->items); - mp_obj_list_clear(self->remote_services_list); + mp_obj_tuple_t *services_tuple = mp_obj_new_tuple(self->remote_service_list->len, + self->remote_service_list->items); + mp_obj_list_clear(self->remote_service_list); return services_tuple; } diff --git a/ports/nrf/common-hal/bleio/Peripheral.h b/ports/nrf/common-hal/bleio/Peripheral.h index b663c96012..1620874ca2 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.h +++ b/ports/nrf/common-hal/bleio/Peripheral.h @@ -49,9 +49,9 @@ typedef struct { mp_obj_t name; volatile uint16_t conn_handle; // Services provided by this peripheral. - mp_obj_list_t *services_list; + mp_obj_list_t *service_list; // Remote services discovered when this peripheral is acting as a client. - mp_obj_list_t *remote_services_list; + mp_obj_list_t *remote_service_list; // The advertising data and scan response buffers are held by us, not by the SD, so we must // maintain them and not change it. If we need to change the contents during advertising, // there are tricks to get the SD to notice (see DevZone - TBS). diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/bleio/Service.c index 28e713cc8d..e5201cc46c 100644 --- a/ports/nrf/common-hal/bleio/Service.c +++ b/ports/nrf/common-hal/bleio/Service.c @@ -34,19 +34,13 @@ #include "shared-bindings/bleio/Service.h" #include "shared-bindings/bleio/Adapter.h" -void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, mp_obj_list_t *characteristic_list, bool is_secondary) { - self->device = mp_const_none; +void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary) { self->handle = 0xFFFF; self->uuid = uuid; - self->characteristic_list = characteristic_list; + self->characteristic_list = mp_obj_new_list(0, NULL); self->is_remote = false; self->is_secondary = is_secondary; - - for (size_t characteristic_idx = 0; characteristic_idx < characteristic_list->len; ++characteristic_idx) { - bleio_characteristic_obj_t *characteristic = - MP_OBJ_TO_PTR(characteristic_list->items[characteristic_idx]); - characteristic->service = self; - } + self->device = mp_const_none; } bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self) { @@ -65,106 +59,67 @@ bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) { return self->is_secondary; } -// Call this after the Service has been added to the Peripheral. -void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self) { - // Add all the characteristics. - for (size_t characteristic_idx = 0; characteristic_idx < self->characteristic_list->len; ++characteristic_idx) { - bleio_characteristic_obj_t *characteristic = - MP_OBJ_TO_PTR(self->characteristic_list->items[characteristic_idx]); - if (characteristic->handle != BLE_GATT_HANDLE_INVALID) { - mp_raise_ValueError(translate("Characteristic already in use by another Service.")); - } +void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, bleio_characteristic_obj_t *characteristic) { + // Connect characteristic to parent service. + characteristic->service = self; - ble_gatts_char_md_t char_md = { - .char_props.broadcast = (characteristic->props & CHAR_PROP_BROADCAST) ? 1 : 0, - .char_props.read = (characteristic->props & CHAR_PROP_READ) ? 1 : 0, - .char_props.write_wo_resp = (characteristic->props & CHAR_PROP_WRITE_NO_RESPONSE) ? 1 : 0, - .char_props.write = (characteristic->props & CHAR_PROP_WRITE) ? 1 : 0, - .char_props.notify = (characteristic->props & CHAR_PROP_NOTIFY) ? 1 : 0, - .char_props.indicate = (characteristic->props & CHAR_PROP_INDICATE) ? 1 : 0, - }; + ble_gatts_char_md_t char_md = { + .char_props.broadcast = (characteristic->props & CHAR_PROP_BROADCAST) ? 1 : 0, + .char_props.read = (characteristic->props & CHAR_PROP_READ) ? 1 : 0, + .char_props.write_wo_resp = (characteristic->props & CHAR_PROP_WRITE_NO_RESPONSE) ? 1 : 0, + .char_props.write = (characteristic->props & CHAR_PROP_WRITE) ? 1 : 0, + .char_props.notify = (characteristic->props & CHAR_PROP_NOTIFY) ? 1 : 0, + .char_props.indicate = (characteristic->props & CHAR_PROP_INDICATE) ? 1 : 0, + }; - ble_gatts_attr_md_t cccd_md = { - .vloc = BLE_GATTS_VLOC_STACK, - }; + ble_gatts_attr_md_t cccd_md = { + .vloc = BLE_GATTS_VLOC_STACK, + }; - ble_uuid_t char_uuid; - bleio_uuid_convert_to_nrf_ble_uuid(characteristic->uuid, &char_uuid); + ble_uuid_t char_uuid; + bleio_uuid_convert_to_nrf_ble_uuid(characteristic->uuid, &char_uuid); - ble_gatts_attr_md_t char_attr_md = { - .vloc = BLE_GATTS_VLOC_STACK, - .vlen = !characteristic->fixed_length, - }; + ble_gatts_attr_md_t char_attr_md = { + .vloc = BLE_GATTS_VLOC_STACK, + .vlen = !characteristic->fixed_length, + }; - if (char_md.char_props.notify || char_md.char_props.indicate) { - BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); - // Make CCCD write permission match characteristic read permission. - bleio_attribute_gatts_set_security_mode(&cccd_md.write_perm, characteristic->read_perm); + if (char_md.char_props.notify || char_md.char_props.indicate) { + BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); + // Make CCCD write permission match characteristic read permission. + bleio_attribute_gatts_set_security_mode(&cccd_md.write_perm, characteristic->read_perm); - char_md.p_cccd_md = &cccd_md; - } + char_md.p_cccd_md = &cccd_md; + } - bleio_attribute_gatts_set_security_mode(&char_attr_md.read_perm, characteristic->read_perm); - bleio_attribute_gatts_set_security_mode(&char_attr_md.write_perm, characteristic->write_perm); + bleio_attribute_gatts_set_security_mode(&char_attr_md.read_perm, characteristic->read_perm); + bleio_attribute_gatts_set_security_mode(&char_attr_md.write_perm, characteristic->write_perm); - mp_buffer_info_t char_value_bufinfo; - mp_get_buffer_raise(characteristic->value, &char_value_bufinfo, MP_BUFFER_READ); + mp_buffer_info_t char_value_bufinfo; + mp_get_buffer_raise(characteristic->value, &char_value_bufinfo, MP_BUFFER_READ); - ble_gatts_attr_t char_attr = { - .p_uuid = &char_uuid, - .p_attr_md = &char_attr_md, - .init_len = char_value_bufinfo.len, - .p_value = char_value_bufinfo.buf, - .init_offs = 0, - .max_len = characteristic->max_length, - }; + ble_gatts_attr_t char_attr = { + .p_uuid = &char_uuid, + .p_attr_md = &char_attr_md, + .init_len = char_value_bufinfo.len, + .p_value = char_value_bufinfo.buf, + .init_offs = 0, + .max_len = characteristic->max_length, + }; - ble_gatts_char_handles_t char_handles; + ble_gatts_char_handles_t char_handles; - uint32_t err_code; - err_code = sd_ble_gatts_characteristic_add(self->handle, &char_md, &char_attr, &char_handles); - if (err_code != NRF_SUCCESS) { - mp_raise_OSError_msg_varg(translate("Failed to add characteristic, err 0x%04x"), err_code); - } + uint32_t err_code; + err_code = sd_ble_gatts_characteristic_add(self->handle, &char_md, &char_attr, &char_handles); + if (err_code != NRF_SUCCESS) { + mp_raise_OSError_msg_varg(translate("Failed to add characteristic, err 0x%04x"), err_code); + } - characteristic->user_desc_handle = char_handles.user_desc_handle; - characteristic->cccd_handle = char_handles.cccd_handle; - characteristic->sccd_handle = char_handles.sccd_handle; - characteristic->handle = char_handles.value_handle; + characteristic->user_desc_handle = char_handles.user_desc_handle; + characteristic->cccd_handle = char_handles.cccd_handle; + characteristic->sccd_handle = char_handles.sccd_handle; + characteristic->handle = char_handles.value_handle; - // Add the descriptors for this characteristic. - for (size_t descriptor_idx = 0; descriptor_idx < characteristic->descriptor_list->len; ++descriptor_idx) { - bleio_descriptor_obj_t *descriptor = - MP_OBJ_TO_PTR(characteristic->descriptor_list->items[descriptor_idx]); - - ble_uuid_t desc_uuid; - bleio_uuid_convert_to_nrf_ble_uuid(descriptor->uuid, &desc_uuid); - - ble_gatts_attr_md_t desc_attr_md = { - // Data passed is not in a permanent location and should be copied. - .vloc = BLE_GATTS_VLOC_STACK, - .vlen = !descriptor->fixed_length, - }; - - bleio_attribute_gatts_set_security_mode(&desc_attr_md.read_perm, descriptor->read_perm); - bleio_attribute_gatts_set_security_mode(&desc_attr_md.write_perm, descriptor->write_perm); - - mp_buffer_info_t desc_value_bufinfo; - mp_get_buffer_raise(descriptor->value, &desc_value_bufinfo, MP_BUFFER_READ); - - ble_gatts_attr_t desc_attr = { - .p_uuid = &desc_uuid, - .p_attr_md = &desc_attr_md, - .init_len = desc_value_bufinfo.len, - .p_value = desc_value_bufinfo.buf, - .init_offs = 0, - .max_len = descriptor->max_length, - }; - - err_code = sd_ble_gatts_descriptor_add(characteristic->handle, &desc_attr, &descriptor->handle); - - } // loop over descriptors - - } // loop over characteristics + mp_obj_list_append(self->characteristic_list, MP_OBJ_FROM_PTR(characteristic)); } diff --git a/ports/nrf/common-hal/bleio/__init__.c b/ports/nrf/common-hal/bleio/__init__.c index 2e26ac07d0..868e0a8e98 100644 --- a/ports/nrf/common-hal/bleio/__init__.c +++ b/ports/nrf/common-hal/bleio/__init__.c @@ -75,11 +75,11 @@ uint16_t common_hal_bleio_device_get_conn_handle(mp_obj_t device) { } } -mp_obj_list_t *common_hal_bleio_device_get_remote_services_list(mp_obj_t device) { +mp_obj_list_t *common_hal_bleio_device_get_remote_service_list(mp_obj_t device) { if (MP_OBJ_IS_TYPE(device, &bleio_peripheral_type)) { - return ((bleio_peripheral_obj_t*) MP_OBJ_TO_PTR(device))->remote_services_list; + return ((bleio_peripheral_obj_t*) MP_OBJ_TO_PTR(device))->remote_service_list; } else if (MP_OBJ_IS_TYPE(device, &bleio_central_type)) { - return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->remote_services_list; + return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->remote_service_list; } else { return NULL; } @@ -158,7 +158,7 @@ STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *res service->base.type = &bleio_service_type; // Initialize several fields at once. - common_hal_bleio_service_construct(service, NULL, mp_obj_new_list(0, NULL), false); + common_hal_bleio_service_construct(service, NULL, false); service->device = device; service->is_remote = true; @@ -179,7 +179,7 @@ STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *res service->uuid = NULL; } - mp_obj_list_append(common_hal_bleio_device_get_remote_services_list(device), service); + mp_obj_list_append(common_hal_bleio_device_get_remote_service_list(device), service); } if (response->count > 0) { @@ -275,7 +275,7 @@ STATIC void on_desc_discovery_rsp(ble_gattc_evt_desc_disc_rsp_t *response, mp_ob } common_hal_bleio_descriptor_construct(descriptor, uuid, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, - GATT_MAX_DATA_LENGTH, false); + GATT_MAX_DATA_LENGTH, false, mp_const_empty_bytes); descriptor->handle = gattc_desc->handle; descriptor->characteristic = m_desc_discovery_characteristic; @@ -316,12 +316,12 @@ STATIC void discovery_on_ble_evt(ble_evt_t *ble_evt, mp_obj_t device) { void common_hal_bleio_device_discover_remote_services(mp_obj_t device, mp_obj_t service_uuids_whitelist) { - mp_obj_list_t *remote_services_list = common_hal_bleio_device_get_remote_services_list(device); + mp_obj_list_t *remote_services_list = common_hal_bleio_device_get_remote_service_list(device); ble_drv_add_event_handler(discovery_on_ble_evt, device); // Start over with an empty list. - mp_obj_list_clear(MP_OBJ_FROM_PTR(common_hal_bleio_device_get_remote_services_list(device))); + mp_obj_list_clear(MP_OBJ_FROM_PTR(common_hal_bleio_device_get_remote_service_list(device))); if (service_uuids_whitelist == mp_const_none) { // List of service UUID's not given, so discover all available services. diff --git a/py/obj.h b/py/obj.h index c719c2945a..cf4216d02f 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 afe11f00f8..6ef9a15b5e 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; diff --git a/shared-bindings/bleio/Characteristic.c b/shared-bindings/bleio/Characteristic.c index 4894ad114a..d9d920b768 100644 --- a/shared-bindings/bleio/Characteristic.c +++ b/shared-bindings/bleio/Characteristic.c @@ -41,101 +41,18 @@ //| Stores information about a BLE service characteristic and allows reading //| and writing of the characteristic's value. //| +//| A Characteristic cannot be created directly. A new local Characteristic can be created +//| and attached to a Service by calling `Service.add_characteristic()`. +//| Remote Characteristic objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()` as part of remote Services. //| -//| .. class:: Characteristic(uuid, *, properties=0, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, descriptors=None) -//| -//| Create a new Characteristic object identified by the specified UUID. -//| -//| :param bleio.UUID uuid: The uuid of the characteristic -//| :param int properties: bitmask of these values bitwise-or'd together: `BROADCAST`, `INDICATE`, -//| `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE` -//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the characteristic value is of fixed length. -//| :param iterable descriptors: BLE descriptors for this characteristic. -//| -STATIC mp_obj_t bleio_characteristic_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_uuid, ARG_properties, ARG_read_perm, ARG_write_perm, - ARG_max_length, ARG_fixed_length, ARG_descriptors }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, - { MP_QSTR_properties, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, - { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_descriptors, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_none} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); - - const bleio_characteristic_properties_t properties = args[ARG_properties].u_int; - if (properties & ~CHAR_PROP_ALL) { - mp_raise_ValueError(translate("Invalid properties")); - } - - const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(read_perm); - - const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(write_perm); - - mp_obj_t descriptors = args[ARG_descriptors].u_obj; - if (descriptors == mp_const_none) { - descriptors = mp_const_empty_tuple; - } - - bleio_characteristic_obj_t *self = m_new_obj(bleio_characteristic_obj_t); - self->base.type = &bleio_characteristic_type; - - // Copy the descriptors list and validate its items. - mp_obj_t desc_list_obj = mp_obj_new_list(0, NULL); - mp_obj_list_t *desc_list = MP_OBJ_TO_PTR(desc_list_obj); - - // If descriptors is not an iterable, an exception will be thrown. - mp_obj_iter_buf_t iter_buf; - mp_obj_t descriptors_iter = mp_getiter(descriptors, &iter_buf); - - mp_obj_t descriptor_obj; - while ((descriptor_obj = mp_iternext(descriptors_iter)) != MP_OBJ_STOP_ITERATION) { - if (!MP_OBJ_IS_TYPE(descriptor_obj, &bleio_descriptor_type)) { - mp_raise_ValueError(translate("descriptors includes an object that is not a Descriptors")); - } - bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(descriptor_obj); - if (common_hal_bleio_descriptor_get_characteristic(descriptor) != MP_OBJ_NULL) { - mp_raise_ValueError(translate("Descriptor is already attached to a Characteristic")); - } - mp_obj_list_append(desc_list_obj, descriptor_obj); - } - - // Range checking on max_length arg is done by the common_hal layer, because - // it may vary depending on underlying BLE implementation. - common_hal_bleio_characteristic_construct(self, uuid, properties, - read_perm, write_perm, - args[ARG_max_length].u_int, args[ARG_fixed_length].u_bool, - desc_list); - - return MP_OBJ_FROM_PTR(self); -} //| .. attribute:: properties //| -//| An int bitmask representing which properties are set. +//| An int bitmask representing which properties are set, specified as bitwise or'ing of +//| of these possible values. +//| `~Characteristic.BROADCAST`, `~Characteristic.INDICATE`, `~Characteristic.NOTIFY`, +//| `~Characteristic.READ`, `~Characteristic.WRITE`, `~Characteristic.WRITE_NO_RESPONSE`. //| STATIC mp_obj_t bleio_characteristic_get_properties(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -222,7 +139,7 @@ const mp_obj_property_t bleio_characteristic_descriptors_obj = { //| .. attribute:: service (read-only) //| -//| The Service this Characteristic is a part of. None if not yet assigned to a Service. +//| The Service this Characteristic is a part of. //| STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -238,6 +155,84 @@ const mp_obj_property_t bleio_characteristic_service_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| .. method:: add_descriptor(uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') +//| +//| Create a new `Descriptor` object, and add it to this Service. +//| +//| :param bleio.UUID uuid: The uuid of the descriptor +//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the descriptor value is of fixed length. +//| :param buf initial_value: The initial value for this descriptor. +//| +//| :return: the new `Descriptor`. +//| +STATIC mp_obj_t bleio_characteristic_add_descriptor(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + enum { ARG_uuid, ARG_read_perm, ARG_write_perm, + ARG_max_length, ARG_fixed_length, ARG_initial_value }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, + { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); + + const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(read_perm); + + const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(write_perm); + + const mp_int_t max_length = args[ARG_max_length].u_int; + const bool fixed_length = args[ARG_fixed_length].u_bool; + mp_obj_t initial_value = args[ARG_initial_value].u_obj; + + // Length will be validated in common_hal. + mp_buffer_info_t initial_value_bufinfo; + if (initial_value == mp_const_none) { + if (fixed_length && max_length > 0) { + initial_value = mp_obj_new_bytes_of_zeros(max_length); + } else { + initial_value = mp_const_empty_bytes; + } + } + mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); + + bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); + descriptor->base.type = &bleio_descriptor_type; + + // Range checking on max_length arg is done by the common_hal layer, because + // it may vary depending on underlying BLE implementation. + common_hal_bleio_descriptor_construct( + descriptor, uuid, read_perm, write_perm, max_length, fixed_length, &initial_value_bufinfo); + + common_hal_bleio_characteristic_add_descriptor(self, descriptor); + + return MP_OBJ_FROM_PTR(descriptor); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_add_descriptor_obj, 2, bleio_characteristic_add_descriptor); + //| .. method:: set_cccd(*, notify=False, indicate=False) //| //| Set the remote characteristic's CCCD to enable or disable notification and indication. @@ -265,10 +260,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_set_cccd_obj, 1, bleio_ch STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_properties), MP_ROM_PTR(&bleio_characteristic_get_properties) }, - { MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) }, - { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_characteristic_uuid_obj) }, - { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&bleio_characteristic_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_properties), MP_ROM_PTR(&bleio_characteristic_get_properties) }, + { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_characteristic_uuid_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&bleio_characteristic_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_add_descriptor), MP_ROM_PTR(&bleio_characteristic_add_descriptor_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) }, // Bitmask constants to represent properties //| .. data:: BROADCAST @@ -319,7 +315,6 @@ STATIC void bleio_characteristic_print(const mp_print_t *print, mp_obj_t self_in const mp_obj_type_t bleio_characteristic_type = { { &mp_type_type }, .name = MP_QSTR_Characteristic, - .make_new = bleio_characteristic_make_new, .print = bleio_characteristic_print, .locals_dict = (mp_obj_dict_t*)&bleio_characteristic_locals_dict, }; diff --git a/shared-bindings/bleio/Characteristic.h b/shared-bindings/bleio/Characteristic.h index 87942c8e90..d9d980b330 100644 --- a/shared-bindings/bleio/Characteristic.h +++ b/shared-bindings/bleio/Characteristic.h @@ -29,18 +29,20 @@ #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" extern const mp_obj_type_t bleio_characteristic_type; -extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_obj_list_t *descriptor_list); +extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); extern mp_obj_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self); extern void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo); extern bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties(bleio_characteristic_obj_t *self); extern bleio_uuid_obj_t *common_hal_bleio_characteristic_get_uuid(bleio_characteristic_obj_t *self); extern mp_obj_list_t *common_hal_bleio_characteristic_get_descriptor_list(bleio_characteristic_obj_t *self); extern bleio_service_obj_t *common_hal_bleio_characteristic_get_service(bleio_characteristic_obj_t *self); +extern void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *self, bleio_descriptor_obj_t *descriptor); extern void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H diff --git a/shared-bindings/bleio/Descriptor.c b/shared-bindings/bleio/Descriptor.c index d7c2a85c74..db8d393d1a 100644 --- a/shared-bindings/bleio/Descriptor.c +++ b/shared-bindings/bleio/Descriptor.c @@ -38,62 +38,14 @@ //| ========================================================= //| //| Stores information about a BLE descriptor. -//| Descriptors are encapsulated by BLE characteristics and provide contextual +//| Descriptors are attached to BLE characteristics and provide contextual //| information about the characteristic. //| - -//| .. class:: Descriptor(uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`) -//| -//| Create a new descriptor object with the UUID uuid -//| -//| :param bleio.UUID uuid: The uuid of the descriptor -//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the characteristic value is of fixed length. -//| -STATIC mp_obj_t bleio_descriptor_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_uuid, ARG_read_perm, ARG_write_perm, ARG_max_length, ARG_fixed_length }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN } }, - { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN } }, - { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, - { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_arg = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_arg, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - - const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(read_perm); - - const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(write_perm); - - bleio_descriptor_obj_t *self = m_new_obj(bleio_descriptor_obj_t); - self->base.type = type; - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_arg); - - // Range checking on max_length arg is done by the common_hal layer, because - // it may vary depending on underlying BLE implementation. - common_hal_bleio_descriptor_construct(self, uuid, read_perm, write_perm, - args[ARG_max_length].u_int, args[ARG_fixed_length].u_bool); - - return MP_OBJ_FROM_PTR(self); -} +//| A Descriptors cannot be created directly. A new local Descriptors can be created +//| and attached to a Descriptors by calling `Service.add_characteristic()`. +//| Remote Descriptor objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()` as part of remote Characteristics +//| in the remote Services that are discovered. //| .. attribute:: uuid //| @@ -116,7 +68,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = { //| .. attribute:: characteristic (read-only) //| -//| The Characteristic this Descriptor is a part of. None if not yet assigned to a Characteristic. +//| The Characteristic this Descriptor is a part of. //| STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) { bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -185,7 +137,6 @@ STATIC void bleio_descriptor_print(const mp_print_t *print, mp_obj_t self_in, mp const mp_obj_type_t bleio_descriptor_type = { { &mp_type_type }, .name = MP_QSTR_Descriptor, - .make_new = bleio_descriptor_make_new, .print = bleio_descriptor_print, .locals_dict = (mp_obj_dict_t*)&bleio_descriptor_locals_dict }; diff --git a/shared-bindings/bleio/Descriptor.h b/shared-bindings/bleio/Descriptor.h index 430c0d0b62..c6d49c06d6 100644 --- a/shared-bindings/bleio/Descriptor.h +++ b/shared-bindings/bleio/Descriptor.h @@ -29,12 +29,13 @@ #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" extern const mp_obj_type_t bleio_descriptor_type; -extern void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length); +extern void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); extern bleio_uuid_obj_t *common_hal_bleio_descriptor_get_uuid(bleio_descriptor_obj_t *self); extern bleio_characteristic_obj_t *common_hal_bleio_descriptor_get_characteristic(bleio_descriptor_obj_t *self); extern mp_obj_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self); diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c index b98e7f74bf..3a78802ac7 100644 --- a/shared-bindings/bleio/Peripheral.c +++ b/shared-bindings/bleio/Peripheral.c @@ -64,71 +64,98 @@ //| import bleio //| from adafruit_ble.advertising import ServerAdvertisement //| -//| # Create a Characteristic. -//| chara = bleio.Characteristic(bleio.UUID(0x2919), read=True, notify=True) -//| -//| # Create a Service providing that one Characteristic. -//| serv = bleio.Service(bleio.UUID(0x180f), [chara]) -//| //| # Create a peripheral and start it up. -//| periph = bleio.Peripheral([serv]) -//| adv = ServerAdvertisement(periph) -//| periph.start_advertising(adv.advertising_data_bytes, adv.scan_response_bytes) +//| peripheral = bleio.Peripheral() //| -//| while not periph.connected: +//| # Create a Service and add it to this Peripheral. +//| service = peripheral.addService(bleio.UUID(0x180f)) +//| +//| # Create a Characteristic and add it to the Service. +//| characteristic = service.addCharacteristic( +//| bleio.UUID(0x2919), properties=Characteristic.READ | Characteristic.NOTIFY) +//| +//| adv = ServerAdvertisement(peripheral) +//| peripheral.start_advertising(adv.advertising_data_bytes, adv.scan_response_bytes) +//| +//| while not peripheral.connected: //| # Wait for connection. //| pass //| -//| .. class:: Peripheral(services=(), \*, name=None) +//| .. class:: Peripheral(name=None) //| //| Create a new Peripheral object. //| -//| :param iterable services: the Service objects representing services available from this peripheral, if any. -//| A non-connectable peripheral will have no services. //| :param str name: The name used when advertising this peripheral. If name is None, //| 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_services, ARG_name }; + enum { ARG_name }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_services, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple} }, - { MP_QSTR_name, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_name, MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - // If services is not an iterable, an exception will be thrown. - mp_obj_iter_buf_t iter_buf; - mp_obj_t iterable = mp_getiter(args[ARG_services].u_obj, &iter_buf); - bleio_peripheral_obj_t *self = m_new_obj(bleio_peripheral_obj_t); self->base.type = &bleio_peripheral_type; - // Copy the services list and validate its items. - mp_obj_t services_list_obj = mp_obj_new_list(0, NULL); - mp_obj_list_t *services_list = MP_OBJ_FROM_PTR(services_list_obj); - - mp_obj_t service; - while ((service = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - if (!MP_OBJ_IS_TYPE(service, &bleio_service_type)) { - mp_raise_ValueError(translate("non-Service found in services")); - } - mp_obj_list_append(services_list, service); - } - mp_obj_t name = args[ARG_name].u_obj; - if (name == MP_OBJ_NULL || name == mp_const_none) { + if (name == mp_const_none) { name = common_hal_bleio_adapter_get_default_name(); } else if (!MP_OBJ_IS_STR(name)) { mp_raise_ValueError(translate("name must be a string")); } - common_hal_bleio_peripheral_construct(self, services_list, name); + common_hal_bleio_peripheral_construct(self, name); return MP_OBJ_FROM_PTR(self); } +//| .. method:: add_service(uuid, *, secondary=False) +//| +//| Create a new `Service` object, identitied by the specified UUID, and add it to this ``Peripheral``. +//| +//| To mark the service as secondary, pass `True` as :py:data:`secondary`. +//| +//| :param bleio.UUID uuid: The uuid of the service +//| :param bool secondary: If the service is a secondary one +// +//| :return: the new `Service` +//| +STATIC mp_obj_t bleio_peripheral_add_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + enum { ARG_uuid, ARG_secondary }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_secondary, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + + const bool is_secondary = args[ARG_secondary].u_bool; + bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); + + bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); + service->base.type = &bleio_service_type; + + common_hal_bleio_service_construct(service, uuid, is_secondary); + + common_hal_bleio_peripheral_add_service(self, service); + + return MP_OBJ_FROM_PTR(service); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_peripheral_add_service_obj, 2, bleio_peripheral_add_service); + + //| .. attribute:: connected (read-only) //| //| True if connected to a BLE Central device. @@ -320,11 +347,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_pair_obj, bleio_peripheral_pai STATIC const mp_rom_map_elem_t bleio_peripheral_locals_dict_table[] = { // Methods + { MP_ROM_QSTR(MP_QSTR_add_service), MP_ROM_PTR(&bleio_peripheral_add_service_obj) }, { MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_peripheral_start_advertising_obj) }, { MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_peripheral_stop_advertising_obj) }, { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_peripheral_disconnect_obj) }, { MP_ROM_QSTR(MP_QSTR_discover_remote_services), MP_ROM_PTR(&bleio_peripheral_discover_remote_services_obj) }, - { MP_ROM_QSTR(MP_QSTR_pair) , MP_ROM_PTR(&bleio_peripheral_pair_obj) }, + { MP_ROM_QSTR(MP_QSTR_pair), MP_ROM_PTR(&bleio_peripheral_pair_obj) }, // Properties { MP_ROM_QSTR(MP_QSTR_connected), MP_ROM_PTR(&bleio_peripheral_connected_obj) }, diff --git a/shared-bindings/bleio/Peripheral.h b/shared-bindings/bleio/Peripheral.h index 597b65ce29..a4bc9542b6 100644 --- a/shared-bindings/bleio/Peripheral.h +++ b/shared-bindings/bleio/Peripheral.h @@ -30,10 +30,12 @@ #include "py/objtuple.h" #include "common-hal/bleio/Peripheral.h" +#include "common-hal/bleio/Service.h" extern const mp_obj_type_t bleio_peripheral_type; -extern void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_list_t *service_list, mp_obj_t name); +extern void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_t name); +extern void common_hal_bleio_peripheral_add_service(bleio_peripheral_obj_t *self, bleio_service_obj_t *service); extern mp_obj_list_t *common_hal_bleio_peripheral_get_services(bleio_peripheral_obj_t *self); extern bool common_hal_bleio_peripheral_get_connected(bleio_peripheral_obj_t *self); extern mp_obj_t common_hal_bleio_peripheral_get_name(bleio_peripheral_obj_t *self); diff --git a/shared-bindings/bleio/Service.c b/shared-bindings/bleio/Service.c index 6961b0b522..2497e9d475 100644 --- a/shared-bindings/bleio/Service.c +++ b/shared-bindings/bleio/Service.c @@ -39,73 +39,11 @@ //| //| Stores information about a BLE service and its characteristics. //| - -//| .. class:: Service(uuid, characteristics, *, secondary=False) +//| A Service cannot be created directly. A new local Service can be created +//| and attached to a Peripheral by calling `Peripheral.add_service()`. +//| Remote Service objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()`. //| -//| Create a new Service object identified by the specified UUID. -//| -//| To mark the service as secondary, pass `True` as :py:data:`secondary`. -//| -//| :param bleio.UUID uuid: The uuid of the service -//| :param iterable characteristics: the Characteristic objects for this service -//| :param bool secondary: If the service is a secondary one -//| -//| A Service may be remote (:py:data:`remote` is ``True``), but a remote Service -//| cannot be constructed directly. It is created by `Central.discover_remote_services()` -//| or `Peripheral.discover_remote_services()`. - -STATIC mp_obj_t bleio_service_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_uuid, ARG_characteristics, ARG_secondary }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, - { MP_QSTR_characteristics, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, - { MP_QSTR_secondary, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - - bleio_service_obj_t *self = m_new_obj(bleio_service_obj_t); - self->base.type = &bleio_service_type; - - const bool is_secondary = args[ARG_secondary].u_bool; - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); - - // If characteristics is not an iterable, an exception will be thrown. - mp_obj_iter_buf_t iter_buf; - mp_obj_t iterable = mp_getiter(args[ARG_characteristics].u_obj, &iter_buf); - mp_obj_t characteristic_obj; - - // Copy the characteristics list and validate its items. - mp_obj_t char_list_obj = mp_obj_new_list(0, NULL); - mp_obj_list_t *char_list = MP_OBJ_TO_PTR(char_list_obj); - - while ((characteristic_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - if (!MP_OBJ_IS_TYPE(characteristic_obj, &bleio_characteristic_type)) { - mp_raise_ValueError(translate("characteristics includes an object that is not a Characteristic")); - } - bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(characteristic_obj); - if (common_hal_bleio_uuid_get_uuid128_reference(uuid) != - common_hal_bleio_uuid_get_uuid128_reference(characteristic->uuid)) { - // The descriptor base UUID doesn't match the characteristic base UUID. - mp_raise_ValueError(translate("Characteristic UUID doesn't match Service UUID")); - } - if (common_hal_bleio_characteristic_get_service(characteristic) != MP_OBJ_NULL) { - mp_raise_ValueError(translate("Characteristic is already attached to a Service")); - } - mp_obj_list_append(char_list_obj, characteristic_obj); - } - - common_hal_bleio_service_construct(self, uuid, char_list, is_secondary); - - return MP_OBJ_FROM_PTR(self); -} //| .. attribute:: characteristics //| @@ -182,10 +120,101 @@ const mp_obj_property_t bleio_service_uuid_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| .. method:: add_characteristic(uuid, *, properties=0, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=None) +//| +//| Create a new `Characteristic` object, and add it to this Service. +//| +//| :param bleio.UUID uuid: The uuid of the characteristic +//| :param int properties: The properties of the characteristic, +//| specified as a bitmask of these values bitwise-or'd together: +//| `Characteristic.BROADCAST`, `Characteristic.INDICATE`, `Characteristic.NOTIFY`, +//| `Characteristic.READ`, `Characteristic.WRITE`, `Characteristic.WRITE_NO_RESPONSE`. +//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the characteristic value is of fixed length. +//| :param buf initial_value: The initial value for this characteristic. If not given, will be +//| filled with zeros. +//| +//| :return: the new `Characteristic`. +//| +STATIC mp_obj_t bleio_service_add_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + bleio_service_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + enum { ARG_uuid, ARG_properties, ARG_read_perm, ARG_write_perm, + ARG_max_length, ARG_fixed_length, ARG_initial_value }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_properties, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, + { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); + + const bleio_characteristic_properties_t properties = args[ARG_properties].u_int; + if (properties & ~CHAR_PROP_ALL) { + mp_raise_ValueError(translate("Invalid properties")); + } + + const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(read_perm); + + const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(write_perm); + + const mp_int_t max_length = args[ARG_max_length].u_int; + const bool fixed_length = args[ARG_fixed_length].u_bool; + mp_obj_t initial_value = args[ARG_initial_value].u_obj; + + // Length will be validated in common_hal. + mp_buffer_info_t initial_value_bufinfo; + if (initial_value == mp_const_none) { + if (fixed_length && max_length > 0) { + initial_value = mp_obj_new_bytes_of_zeros(max_length); + } else { + initial_value = mp_const_empty_bytes; + } + } + mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); + + bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); + characteristic->base.type = &bleio_characteristic_type; + + // Range checking on max_length arg is done by the common_hal layer, because + // it may vary depending on underlying BLE implementation. + common_hal_bleio_characteristic_construct( + characteristic, uuid, properties, read_perm, write_perm, + max_length, fixed_length, &initial_value_bufinfo); + + common_hal_bleio_service_add_characteristic(self, characteristic); + + return MP_OBJ_FROM_PTR(characteristic); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_service_add_characteristic_obj, 2, bleio_service_add_characteristic); + STATIC const mp_rom_map_elem_t bleio_service_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_characteristics), MP_ROM_PTR(&bleio_service_characteristics_obj) }, { MP_ROM_QSTR(MP_QSTR_secondary), MP_ROM_PTR(&bleio_service_secondary_obj) }, { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_service_uuid_obj) }, + { MP_ROM_QSTR(MP_QSTR_add_characteristic), MP_ROM_PTR(&bleio_service_add_characteristic_obj) }, }; STATIC MP_DEFINE_CONST_DICT(bleio_service_locals_dict, bleio_service_locals_dict_table); @@ -203,7 +232,6 @@ STATIC void bleio_service_print(const mp_print_t *print, mp_obj_t self_in, mp_pr const mp_obj_type_t bleio_service_type = { { &mp_type_type }, .name = MP_QSTR_Service, - .make_new = bleio_service_make_new, .print = bleio_service_print, .locals_dict = (mp_obj_dict_t*)&bleio_service_locals_dict }; diff --git a/shared-bindings/bleio/Service.h b/shared-bindings/bleio/Service.h index 716c2e8a96..91c08fbb89 100644 --- a/shared-bindings/bleio/Service.h +++ b/shared-bindings/bleio/Service.h @@ -32,11 +32,11 @@ const mp_obj_type_t bleio_service_type; -extern void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, mp_obj_list_t *characteristic_list, bool is_secondary); +extern void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary); extern bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self); extern mp_obj_list_t *common_hal_bleio_service_get_characteristic_list(bleio_service_obj_t *self); extern bool common_hal_bleio_service_get_is_remote(bleio_service_obj_t *self); extern bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self); -extern void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self); +extern void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, bleio_characteristic_obj_t *characteristic); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H diff --git a/shared-bindings/bleio/__init__.h b/shared-bindings/bleio/__init__.h index 89be710939..c84895068c 100644 --- a/shared-bindings/bleio/__init__.h +++ b/shared-bindings/bleio/__init__.h @@ -41,7 +41,7 @@ extern const super_adapter_obj_t common_hal_bleio_adapter_obj; extern void common_hal_bleio_check_connected(uint16_t conn_handle); extern uint16_t common_hal_bleio_device_get_conn_handle(mp_obj_t device); -extern mp_obj_list_t *common_hal_bleio_device_get_remote_services_list(mp_obj_t device); +extern mp_obj_list_t *common_hal_bleio_device_get_remote_service_list(mp_obj_t device); extern void common_hal_bleio_device_discover_remote_services(mp_obj_t device, mp_obj_t service_uuids_whitelist); extern mp_obj_t common_hal_bleio_gatts_read(uint16_t handle, uint16_t conn_handle); From f17059b10bde0bdce3aca959ea9ee207ed98ede7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Aug 2019 23:15:22 -0400 Subject: [PATCH 27/41] another API rework: less abstraction leakage --- ports/nrf/common-hal/bleio/Characteristic.c | 7 +- ports/nrf/common-hal/bleio/Descriptor.c | 4 +- ports/nrf/common-hal/bleio/Peripheral.c | 3 - ports/nrf/common-hal/bleio/Service.c | 9 +- ports/nrf/common-hal/bleio/__init__.c | 13 +- shared-bindings/bleio/Characteristic.c | 187 +++++++++++--------- shared-bindings/bleio/Characteristic.h | 3 +- shared-bindings/bleio/Descriptor.c | 93 +++++++++- shared-bindings/bleio/Descriptor.h | 2 +- shared-bindings/bleio/Peripheral.c | 45 ----- shared-bindings/bleio/Service.c | 153 ++++++---------- shared-bindings/bleio/Service.h | 3 +- 12 files changed, 270 insertions(+), 252 deletions(-) diff --git a/ports/nrf/common-hal/bleio/Characteristic.c b/ports/nrf/common-hal/bleio/Characteristic.c index 012029b6c3..06a312f583 100644 --- a/ports/nrf/common-hal/bleio/Characteristic.c +++ b/ports/nrf/common-hal/bleio/Characteristic.c @@ -124,8 +124,8 @@ STATIC void characteristic_gattc_read(bleio_characteristic_obj_t *characteristic ble_drv_remove_event_handler(characteristic_on_gattc_read_rsp_evt, characteristic); } -void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { - self->service = MP_OBJ_NULL; +void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_service_obj_t *service, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { + self->service = service; self->uuid = uuid; self->handle = BLE_GATT_HANDLE_INVALID; self->props = props; @@ -222,9 +222,6 @@ bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties } void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *self, bleio_descriptor_obj_t *descriptor) { - // Connect descriptor to parent characteristic. - descriptor->characteristic = self; - ble_uuid_t desc_uuid; bleio_uuid_convert_to_nrf_ble_uuid(descriptor->uuid, &desc_uuid); diff --git a/ports/nrf/common-hal/bleio/Descriptor.c b/ports/nrf/common-hal/bleio/Descriptor.c index ee8d840f2f..4a5974a064 100644 --- a/ports/nrf/common-hal/bleio/Descriptor.c +++ b/ports/nrf/common-hal/bleio/Descriptor.c @@ -35,8 +35,8 @@ static volatile bleio_descriptor_obj_t *m_read_descriptor; -void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { - self->characteristic = MP_OBJ_NULL; +void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_characteristic_obj_t *characteristic, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo) { + self->characteristic = characteristic; self->uuid = uuid; self->handle = BLE_GATT_HANDLE_INVALID; self->read_perm = read_perm; diff --git a/ports/nrf/common-hal/bleio/Peripheral.c b/ports/nrf/common-hal/bleio/Peripheral.c index 6f8a1a2fcd..92dfc2da1d 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.c +++ b/ports/nrf/common-hal/bleio/Peripheral.c @@ -223,8 +223,6 @@ void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_ } void common_hal_bleio_peripheral_add_service(bleio_peripheral_obj_t *self, bleio_service_obj_t *service) { - service->device = MP_OBJ_FROM_PTR(self); - ble_uuid_t uuid; bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid); @@ -241,7 +239,6 @@ void common_hal_bleio_peripheral_add_service(bleio_peripheral_obj_t *self, bleio mp_obj_list_append(self->service_list, MP_OBJ_FROM_PTR(service)); } - mp_obj_list_t *common_hal_bleio_peripheral_get_services(bleio_peripheral_obj_t *self) { return self->service_list; } diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/bleio/Service.c index e5201cc46c..f69bbd89da 100644 --- a/ports/nrf/common-hal/bleio/Service.c +++ b/ports/nrf/common-hal/bleio/Service.c @@ -31,16 +31,17 @@ #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_uuid_obj_t *uuid, bool is_secondary) { +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); self->handle = 0xFFFF; self->uuid = uuid; self->characteristic_list = mp_obj_new_list(0, NULL); self->is_remote = false; self->is_secondary = is_secondary; - self->device = mp_const_none; } bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self) { @@ -59,11 +60,7 @@ bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) { return self->is_secondary; } - void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, bleio_characteristic_obj_t *characteristic) { - // Connect characteristic to parent service. - characteristic->service = self; - ble_gatts_char_md_t char_md = { .char_props.broadcast = (characteristic->props & CHAR_PROP_BROADCAST) ? 1 : 0, .char_props.read = (characteristic->props & CHAR_PROP_READ) ? 1 : 0, diff --git a/ports/nrf/common-hal/bleio/__init__.c b/ports/nrf/common-hal/bleio/__init__.c index 868e0a8e98..4a7597e37b 100644 --- a/ports/nrf/common-hal/bleio/__init__.c +++ b/ports/nrf/common-hal/bleio/__init__.c @@ -158,9 +158,8 @@ STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *res service->base.type = &bleio_service_type; // Initialize several fields at once. - common_hal_bleio_service_construct(service, NULL, false); + common_hal_bleio_service_construct(service, device, NULL, false); - service->device = device; service->is_remote = true; service->start_handle = gattc_service->handle_range.start_handle; service->end_handle = gattc_service->handle_range.end_handle; @@ -218,11 +217,10 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, mp_ob // Call common_hal_bleio_characteristic_construct() to initalize some fields and set up evt handler. common_hal_bleio_characteristic_construct( - characteristic, uuid, props, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, + characteristic, m_char_discovery_service, uuid, props, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values may not matter for gattc mp_obj_new_list(0, NULL)); characteristic->handle = gattc_char->handle_value; - characteristic->service = m_char_discovery_service; mp_obj_list_append(m_char_discovery_service->characteristic_list, MP_OBJ_FROM_PTR(characteristic)); } @@ -274,10 +272,11 @@ STATIC void on_desc_discovery_rsp(ble_gattc_evt_desc_disc_rsp_t *response, mp_ob // For now, just leave the UUID as NULL. } - common_hal_bleio_descriptor_construct(descriptor, uuid, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, - GATT_MAX_DATA_LENGTH, false, mp_const_empty_bytes); + common_hal_bleio_descriptor_construct( + descriptor, m_desc_discovery_characteristic, uuid, + SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, + GATT_MAX_DATA_LENGTH, false, mp_const_empty_bytes); descriptor->handle = gattc_desc->handle; - descriptor->characteristic = m_desc_discovery_characteristic; mp_obj_list_append(m_desc_discovery_characteristic->descriptor_list, MP_OBJ_FROM_PTR(descriptor)); } diff --git a/shared-bindings/bleio/Characteristic.c b/shared-bindings/bleio/Characteristic.c index d9d920b768..90cd77d177 100644 --- a/shared-bindings/bleio/Characteristic.c +++ b/shared-bindings/bleio/Characteristic.c @@ -30,7 +30,7 @@ #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/Service.h" #include "shared-bindings/bleio/UUID.h" //| .. currentmodule:: bleio @@ -41,12 +41,111 @@ //| Stores information about a BLE service characteristic and allows reading //| and writing of the characteristic's value. //| -//| A Characteristic cannot be created directly. A new local Characteristic can be created -//| and attached to a Service by calling `Service.add_characteristic()`. +//| There is no regular constructor for a Characteristic. A new local Characteristic can be created +//| and attached to a Service by calling `Characteristic.add_to_service()`. //| Remote Characteristic objects are created by `Central.discover_remote_services()` //| or `Peripheral.discover_remote_services()` as part of remote Services. //| +//| .. method:: add_to_service(service, uuid, *, properties=0, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=None) +//| +//| Create a new `Characteristic` object, and add it to this Service. +//| +//| :param bleio.Service service: The service that will provide this characteristic +//| :param bleio.UUID uuid: The uuid of the characteristic +//| :param int properties: The properties of the characteristic, +//| specified as a bitmask of these values bitwise-or'd together: +//| `Characteristic.BROADCAST`, `Characteristic.INDICATE`, `Characteristic.NOTIFY`, +//| `Characteristic.READ`, `Characteristic.WRITE`, `Characteristic.WRITE_NO_RESPONSE`. +//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the characteristic value is of fixed length. +//| :param buf initial_value: The initial value for this characteristic. If not given, will be +//| filled with zeros. +//| +//| :return: the new `Characteristic`. +//| +STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + // class is arg[0], which we can ignore. + + enum { ARG_service, ARG_uuid, ARG_properties, ARG_read_perm, ARG_write_perm, + ARG_max_length, ARG_fixed_length, ARG_initial_value }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_service, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_properties, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, + { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t service_obj = args[ARG_service].u_obj; + if (!MP_OBJ_IS_TYPE(service_obj, &bleio_service_type)) { + mp_raise_ValueError(translate("Expected a Service")); + } + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + + const bleio_characteristic_properties_t properties = args[ARG_properties].u_int; + if (properties & ~CHAR_PROP_ALL) { + mp_raise_ValueError(translate("Invalid properties")); + } + + const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(read_perm); + + const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(write_perm); + + const mp_int_t max_length = args[ARG_max_length].u_int; + const bool fixed_length = args[ARG_fixed_length].u_bool; + mp_obj_t initial_value = args[ARG_initial_value].u_obj; + + // Length will be validated in common_hal. + mp_buffer_info_t initial_value_bufinfo; + if (initial_value == mp_const_none) { + if (fixed_length && max_length > 0) { + initial_value = mp_obj_new_bytes_of_zeros(max_length); + } else { + initial_value = mp_const_empty_bytes; + } + } + mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); + + bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); + characteristic->base.type = &bleio_characteristic_type; + + // Range checking on max_length arg is done by the common_hal layer, because + // it may vary depending on underlying BLE implementation. + common_hal_bleio_characteristic_construct( + characteristic, MP_OBJ_TO_PTR(service_obj), MP_OBJ_TO_PTR(uuid_obj), + properties, read_perm, write_perm, + max_length, fixed_length, &initial_value_bufinfo); + + common_hal_bleio_service_add_characteristic(service_obj, characteristic); + + return MP_OBJ_FROM_PTR(characteristic); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_add_to_service_fun_obj, 3, bleio_characteristic_add_to_service); +STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj, MP_ROM_PTR(&bleio_characteristic_add_to_service_fun_obj)); + + + //| .. attribute:: properties //| //| An int bitmask representing which properties are set, specified as bitwise or'ing of @@ -155,84 +254,6 @@ const mp_obj_property_t bleio_characteristic_service_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| .. method:: add_descriptor(uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') -//| -//| Create a new `Descriptor` object, and add it to this Service. -//| -//| :param bleio.UUID uuid: The uuid of the descriptor -//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the descriptor value is of fixed length. -//| :param buf initial_value: The initial value for this descriptor. -//| -//| :return: the new `Descriptor`. -//| -STATIC mp_obj_t bleio_characteristic_add_descriptor(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - - enum { ARG_uuid, ARG_read_perm, ARG_write_perm, - ARG_max_length, ARG_fixed_length, ARG_initial_value }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, - { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); - - const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(read_perm); - - const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(write_perm); - - const mp_int_t max_length = args[ARG_max_length].u_int; - const bool fixed_length = args[ARG_fixed_length].u_bool; - mp_obj_t initial_value = args[ARG_initial_value].u_obj; - - // Length will be validated in common_hal. - mp_buffer_info_t initial_value_bufinfo; - if (initial_value == mp_const_none) { - if (fixed_length && max_length > 0) { - initial_value = mp_obj_new_bytes_of_zeros(max_length); - } else { - initial_value = mp_const_empty_bytes; - } - } - mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); - - bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); - descriptor->base.type = &bleio_descriptor_type; - - // Range checking on max_length arg is done by the common_hal layer, because - // it may vary depending on underlying BLE implementation. - common_hal_bleio_descriptor_construct( - descriptor, uuid, read_perm, write_perm, max_length, fixed_length, &initial_value_bufinfo); - - common_hal_bleio_characteristic_add_descriptor(self, descriptor); - - return MP_OBJ_FROM_PTR(descriptor); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_add_descriptor_obj, 2, bleio_characteristic_add_descriptor); - //| .. method:: set_cccd(*, notify=False, indicate=False) //| //| Set the remote characteristic's CCCD to enable or disable notification and indication. @@ -260,10 +281,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_set_cccd_obj, 1, bleio_ch STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_properties), MP_ROM_PTR(&bleio_characteristic_get_properties) }, + { MP_ROM_QSTR(MP_QSTR_add_to_service), MP_ROM_PTR(&bleio_characteristic_add_to_service_obj) }, + { MP_ROM_QSTR(MP_QSTR_properties), MP_ROM_PTR(&bleio_characteristic_get_properties_obj) }, { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_characteristic_uuid_obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&bleio_characteristic_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_add_descriptor), MP_ROM_PTR(&bleio_characteristic_add_descriptor_obj) }, { MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) }, // Bitmask constants to represent properties diff --git a/shared-bindings/bleio/Characteristic.h b/shared-bindings/bleio/Characteristic.h index d9d980b330..52df87b36e 100644 --- a/shared-bindings/bleio/Characteristic.h +++ b/shared-bindings/bleio/Characteristic.h @@ -32,10 +32,11 @@ #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; -extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); +extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_service_obj_t *service, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); extern mp_obj_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self); extern void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo); extern bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties(bleio_characteristic_obj_t *self); diff --git a/shared-bindings/bleio/Descriptor.c b/shared-bindings/bleio/Descriptor.c index db8d393d1a..39fd21d888 100644 --- a/shared-bindings/bleio/Descriptor.c +++ b/shared-bindings/bleio/Descriptor.c @@ -29,6 +29,7 @@ #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" @@ -41,12 +42,98 @@ //| Descriptors are attached to BLE characteristics and provide contextual //| information about the characteristic. //| -//| A Descriptors cannot be created directly. A new local Descriptors can be created -//| and attached to a Descriptors by calling `Service.add_characteristic()`. +//| There is no regular constructor for a Descriptor. A new local Descriptor can be created +//| and attached to a Characteristic by calling `Descriptor.add_to_characteristic()`. //| Remote Descriptor objects are created by `Central.discover_remote_services()` //| or `Peripheral.discover_remote_services()` as part of remote Characteristics //| in the remote Services that are discovered. +//| .. method:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') +//| +//| Create a new `Descriptor` object, and add it to this Service. +//| +//| :param bleio.Characteristic characteristic: The characteristic that will hold this descriptor +//| :param bleio.UUID uuid: The uuid of the descriptor +//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the descriptor value is of fixed length. +//| :param buf initial_value: The initial value for this descriptor. +//| +//| :return: the new `Descriptor`. +//| +STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + // class is arg[0], which we can ignore. + + enum { ARG_characteristic, ARG_uuid, ARG_read_perm, ARG_write_perm, + ARG_max_length, ARG_fixed_length, ARG_initial_value }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_characteristic, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, + { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, + { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t characteristic_obj = args[ARG_characteristic].u_obj; + if (!MP_OBJ_IS_TYPE(characteristic_obj, &bleio_characteristic_type)) { + mp_raise_ValueError(translate("Expected a Characteristic")); + } + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + + const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(read_perm); + + const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; + common_hal_bleio_attribute_security_mode_check_valid(write_perm); + + const mp_int_t max_length = args[ARG_max_length].u_int; + const bool fixed_length = args[ARG_fixed_length].u_bool; + mp_obj_t initial_value = args[ARG_initial_value].u_obj; + + // Length will be validated in common_hal. + mp_buffer_info_t initial_value_bufinfo; + if (initial_value == mp_const_none) { + if (fixed_length && max_length > 0) { + initial_value = mp_obj_new_bytes_of_zeros(max_length); + } else { + initial_value = mp_const_empty_bytes; + } + } + mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); + + bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); + descriptor->base.type = &bleio_descriptor_type; + + // Range checking on max_length arg is done by the common_hal layer, because + // it may vary depending on underlying BLE implementation. + common_hal_bleio_descriptor_construct( + descriptor, MP_OBJ_TO_PTR(characteristic_obj), MP_OBJ_TO_PTR(uuid_obj), + read_perm, write_perm, + max_length, fixed_length, &initial_value_bufinfo); + + common_hal_bleio_characteristic_add_descriptor(characteristic_obj, descriptor); + + return MP_OBJ_FROM_PTR(descriptor); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_descriptor_add_to_characteristic_fun_obj, 3, bleio_descriptor_add_to_characteristic); +STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_obj, MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_fun_obj)); + //| .. attribute:: uuid //| //| The descriptor uuid. (read-only) @@ -115,7 +202,7 @@ const mp_obj_property_t bleio_descriptor_value_obj = { }; STATIC const mp_rom_map_elem_t bleio_descriptor_locals_dict_table[] = { - // Properties + { MP_ROM_QSTR(MP_QSTR_add_to_characteristic), MP_ROM_PTR(&bleio_descriptor_add_to_characteristic_obj) }, { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_descriptor_uuid_obj) }, { MP_ROM_QSTR(MP_QSTR_characteristic), MP_ROM_PTR(&bleio_descriptor_characteristic_obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&bleio_descriptor_value_obj) }, diff --git a/shared-bindings/bleio/Descriptor.h b/shared-bindings/bleio/Descriptor.h index c6d49c06d6..d12ebaab99 100644 --- a/shared-bindings/bleio/Descriptor.h +++ b/shared-bindings/bleio/Descriptor.h @@ -35,7 +35,7 @@ extern const mp_obj_type_t bleio_descriptor_type; -extern void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); +extern void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_characteristic_obj_t *characteristic, bleio_uuid_obj_t *uuid, bleio_attribute_security_mode_t read_perm, bleio_attribute_security_mode_t write_perm, mp_int_t max_length, bool fixed_length, mp_buffer_info_t *initial_value_bufinfo); extern bleio_uuid_obj_t *common_hal_bleio_descriptor_get_uuid(bleio_descriptor_obj_t *self); extern bleio_characteristic_obj_t *common_hal_bleio_descriptor_get_characteristic(bleio_descriptor_obj_t *self); extern mp_obj_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self); diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c index 3a78802ac7..6ebc406d60 100644 --- a/shared-bindings/bleio/Peripheral.c +++ b/shared-bindings/bleio/Peripheral.c @@ -112,50 +112,6 @@ STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_ar return MP_OBJ_FROM_PTR(self); } -//| .. method:: add_service(uuid, *, secondary=False) -//| -//| Create a new `Service` object, identitied by the specified UUID, and add it to this ``Peripheral``. -//| -//| To mark the service as secondary, pass `True` as :py:data:`secondary`. -//| -//| :param bleio.UUID uuid: The uuid of the service -//| :param bool secondary: If the service is a secondary one -// -//| :return: the new `Service` -//| -STATIC mp_obj_t bleio_peripheral_add_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - - enum { ARG_uuid, ARG_secondary }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, - { MP_QSTR_secondary, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - - const bool is_secondary = args[ARG_secondary].u_bool; - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); - - bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); - service->base.type = &bleio_service_type; - - common_hal_bleio_service_construct(service, uuid, is_secondary); - - common_hal_bleio_peripheral_add_service(self, service); - - return MP_OBJ_FROM_PTR(service); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_peripheral_add_service_obj, 2, bleio_peripheral_add_service); - - //| .. attribute:: connected (read-only) //| //| True if connected to a BLE Central device. @@ -347,7 +303,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_pair_obj, bleio_peripheral_pai STATIC const mp_rom_map_elem_t bleio_peripheral_locals_dict_table[] = { // Methods - { MP_ROM_QSTR(MP_QSTR_add_service), MP_ROM_PTR(&bleio_peripheral_add_service_obj) }, { MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_peripheral_start_advertising_obj) }, { MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_peripheral_stop_advertising_obj) }, { MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_peripheral_disconnect_obj) }, diff --git a/shared-bindings/bleio/Service.c b/shared-bindings/bleio/Service.c index 2497e9d475..134106915e 100644 --- a/shared-bindings/bleio/Service.c +++ b/shared-bindings/bleio/Service.c @@ -29,6 +29,7 @@ #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" @@ -39,12 +40,63 @@ //| //| Stores information about a BLE service and its characteristics. //| -//| A Service cannot be created directly. A new local Service can be created -//| and attached to a Peripheral by calling `Peripheral.add_service()`. +//| There is no regular constructor for a Service. A new local Service can be created +//| and attached to a Peripheral by calling `Service.add_to_peripheral()`. //| Remote Service objects are created by `Central.discover_remote_services()` //| or `Peripheral.discover_remote_services()`. //| +//| .. classmethod:: add_to_peripheral(peripheral, uuid, *, secondary=False) +//| +//| Create a new `Service` object, identitied by the specified UUID, and add it +//| to the given Peripheral. +//| +//| To mark the service as secondary, pass `True` as :py:data:`secondary`. +//| +//| :param bleio.Peripheral peripheral: The peripheral that will provide this service +//| :param bleio.UUID uuid: The uuid of the service +//| :param bool secondary: If the service is a secondary one +// +//| :return: the new `Service` +//| +STATIC mp_obj_t bleio_service_add_to_peripheral(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + // class is arg[0], which we can ignore. + + enum { ARG_peripheral, ARG_uuid, ARG_secondary }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_peripheral, MP_ARG_REQUIRED | MP_ARG_OBJ,}, + { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_secondary, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mp_obj_t peripheral_obj = args[ARG_peripheral].u_obj; + if (!MP_OBJ_IS_TYPE(peripheral_obj, &bleio_peripheral_type)) { + mp_raise_ValueError(translate("Expected a Peripheral")); + } + + const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; + if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { + mp_raise_ValueError(translate("Expected a UUID")); + } + + const bool is_secondary = args[ARG_secondary].u_bool; + + bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); + service->base.type = &bleio_service_type; + + common_hal_bleio_service_construct( + service, MP_OBJ_TO_PTR(peripheral_obj), MP_OBJ_TO_PTR(uuid_obj), is_secondary); + + common_hal_bleio_peripheral_add_service(peripheral_obj, service); + + return MP_OBJ_FROM_PTR(service); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_service_add_to_peripheral_fun_obj, 3, bleio_service_add_to_peripheral); +STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_service_add_to_peripheral_obj, MP_ROM_PTR(&bleio_service_add_to_peripheral_fun_obj)); + //| .. attribute:: characteristics //| //| A tuple of `bleio.Characteristic` that are offered by this service. (read-only) @@ -120,101 +172,12 @@ const mp_obj_property_t bleio_service_uuid_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| .. method:: add_characteristic(uuid, *, properties=0, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=None) -//| -//| Create a new `Characteristic` object, and add it to this Service. -//| -//| :param bleio.UUID uuid: The uuid of the characteristic -//| :param int properties: The properties of the characteristic, -//| specified as a bitmask of these values bitwise-or'd together: -//| `Characteristic.BROADCAST`, `Characteristic.INDICATE`, `Characteristic.NOTIFY`, -//| `Characteristic.READ`, `Characteristic.WRITE`, `Characteristic.WRITE_NO_RESPONSE`. -//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the characteristic value is of fixed length. -//| :param buf initial_value: The initial value for this characteristic. If not given, will be -//| filled with zeros. -//| -//| :return: the new `Characteristic`. -//| -STATIC mp_obj_t bleio_service_add_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - bleio_service_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - - enum { ARG_uuid, ARG_properties, ARG_read_perm, ARG_write_perm, - ARG_max_length, ARG_fixed_length, ARG_initial_value }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_uuid, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_properties, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_read_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_write_perm, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = SECURITY_MODE_OPEN} }, - { MP_QSTR_max_length, MP_ARG_KW_ONLY| MP_ARG_INT, {.u_int = 20} }, - { MP_QSTR_fixed_length, MP_ARG_KW_ONLY| MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_initial_value, MP_ARG_KW_ONLY| MP_ARG_OBJ, {.u_obj = mp_const_none} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mp_obj_t uuid_obj = args[ARG_uuid].u_obj; - - if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) { - mp_raise_ValueError(translate("Expected a UUID")); - } - bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj); - - const bleio_characteristic_properties_t properties = args[ARG_properties].u_int; - if (properties & ~CHAR_PROP_ALL) { - mp_raise_ValueError(translate("Invalid properties")); - } - - const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(read_perm); - - const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; - common_hal_bleio_attribute_security_mode_check_valid(write_perm); - - const mp_int_t max_length = args[ARG_max_length].u_int; - const bool fixed_length = args[ARG_fixed_length].u_bool; - mp_obj_t initial_value = args[ARG_initial_value].u_obj; - - // Length will be validated in common_hal. - mp_buffer_info_t initial_value_bufinfo; - if (initial_value == mp_const_none) { - if (fixed_length && max_length > 0) { - initial_value = mp_obj_new_bytes_of_zeros(max_length); - } else { - initial_value = mp_const_empty_bytes; - } - } - mp_get_buffer_raise(initial_value, &initial_value_bufinfo, MP_BUFFER_READ); - - bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); - characteristic->base.type = &bleio_characteristic_type; - - // Range checking on max_length arg is done by the common_hal layer, because - // it may vary depending on underlying BLE implementation. - common_hal_bleio_characteristic_construct( - characteristic, uuid, properties, read_perm, write_perm, - max_length, fixed_length, &initial_value_bufinfo); - - common_hal_bleio_service_add_characteristic(self, characteristic); - - return MP_OBJ_FROM_PTR(characteristic); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_service_add_characteristic_obj, 2, bleio_service_add_characteristic); STATIC const mp_rom_map_elem_t bleio_service_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_characteristics), MP_ROM_PTR(&bleio_service_characteristics_obj) }, - { MP_ROM_QSTR(MP_QSTR_secondary), MP_ROM_PTR(&bleio_service_secondary_obj) }, - { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_service_uuid_obj) }, - { MP_ROM_QSTR(MP_QSTR_add_characteristic), MP_ROM_PTR(&bleio_service_add_characteristic_obj) }, + { MP_ROM_QSTR(MP_QSTR_add_to_peripheral), MP_ROM_PTR(&bleio_service_add_to_peripheral_obj) }, + { MP_ROM_QSTR(MP_QSTR_characteristics), MP_ROM_PTR(&bleio_service_characteristics_obj) }, + { MP_ROM_QSTR(MP_QSTR_secondary), MP_ROM_PTR(&bleio_service_secondary_obj) }, + { MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_service_uuid_obj) }, }; STATIC MP_DEFINE_CONST_DICT(bleio_service_locals_dict, bleio_service_locals_dict_table); diff --git a/shared-bindings/bleio/Service.h b/shared-bindings/bleio/Service.h index 91c08fbb89..ce4e514176 100644 --- a/shared-bindings/bleio/Service.h +++ b/shared-bindings/bleio/Service.h @@ -28,11 +28,12 @@ #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" const mp_obj_type_t bleio_service_type; -extern void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary); +extern void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_peripheral_obj_t *peripheral, bleio_uuid_obj_t *uuid, bool is_secondary); extern bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self); extern mp_obj_list_t *common_hal_bleio_service_get_characteristic_list(bleio_service_obj_t *self); extern bool common_hal_bleio_service_get_is_remote(bleio_service_obj_t *self); From 2c17d235b280630baa053200ca488a107344b296 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 28 Aug 2019 21:02:03 -0700 Subject: [PATCH 28/41] Build on all branch pushes --- .github/workflows/build.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90e5f96bea..2a1f9b3e0a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,6 @@ name: Build CI -on: - push: - branches: - - master - pull_request: - release: +on: [push, pull_request, release] jobs: test: From 84839de56fe3bc38f33997f756a0cd6205fd306d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 23 Jul 2019 18:38:23 -0700 Subject: [PATCH 29/41] Hallowing M4 --- .travis.yml | 2 +- .../boards/hallowing_m4_express/board.c | 92 +++++++++++++++++++ .../hallowing_m4_express/mpconfigboard.h | 39 ++++++++ .../hallowing_m4_express/mpconfigboard.mk | 19 ++++ .../boards/hallowing_m4_express/pins.c | 50 ++++++++++ 5 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 ports/atmel-samd/boards/hallowing_m4_express/board.c create mode 100644 ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/hallowing_m4_express/pins.c diff --git a/.travis.yml b/.travis.yml index d75b4e7d4a..6af21b6f50 100755 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ env: - TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pygamer pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr electronut_labs_blip" TRAVIS_SDK=arm:nrf - TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0 datum_distance pyruler" TRAVIS_SDK=arm - TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip escornabot_makech pygamer_advance datum_imu" TRAVIS_SDK=arm - - TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1 datum_light" TRAVIS_SDK=arm + - TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1 datum_light hallowing_m4_express" TRAVIS_SDK=arm - TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev pybadge pybadge_airlift datum_weather" TRAVIS_SDK=arm addons: diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c new file mode 100644 index 0000000000..f74422d94d --- /dev/null +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -0,0 +1,92 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + + #include "boards/board.h" + #include "mpconfigboard.h" + #include "hal/include/hal_gpio.h" + #include "shared-bindings/busio/SPI.h" + #include "shared-bindings/displayio/FourWire.h" + #include "shared-module/displayio/__init__.h" + #include "shared-module/displayio/mipi_constants.h" + #include "tick.h" + + displayio_fourwire_obj_t board_display_obj; + + #define DELAY 0x80 + + uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. + 0x3a, 1, 0x55, // COLMOD - 16bit color + 0x21, 0 | DELAY, 10, // _INVON + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 255, // _DISPON + }; + + void board_init(void) { + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_PB31, // TFT_DC Command or data + &pin_PA27, // TFT_CS Chip select + &pin_PB30, // TFT_RST Reset + 60000000); + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 240, // Height (after rotation) + 0, // column start + 0, // row start + 180, // rotation + 16, // Color depth + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_PB14, // backlight pin + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false); // data_as_commands + } + + bool board_requests_safe_mode(void) { + return false; + } + + void reset_board(void) { + } diff --git a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h new file mode 100644 index 0000000000..654632db5d --- /dev/null +++ b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.h @@ -0,0 +1,39 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Hallowing M4 Express" +#define MICROPY_HW_MCU_NAME "samd51j19" + +#define CIRCUITPY_MCU_FAMILY samd51 + +// Rev C + +#define MICROPY_HW_LED_STATUS (&pin_PA23) +#define MICROPY_HW_NEOPIXEL (&pin_PB16) + +// These are pins not to reset. +// QSPI Data pins +#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11) +// NeoPixel pin, QSPI CS, and QSPI SCK +#define MICROPY_PORT_B (PORT_PB16 | PORT_PB10 | PORT_PB11) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +#define AUTORESET_DELAY_MS 500 + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 8192 + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +#define DEFAULT_I2C_BUS_SCL (&pin_PA13) +#define DEFAULT_I2C_BUS_SDA (&pin_PA12) + +#define DEFAULT_SPI_BUS_SCK (&pin_PA22) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB23) +#define DEFAULT_SPI_BUS_MISO (&pin_PB22) + +#define DEFAULT_UART_BUS_RX (&pin_PB12) +#define DEFAULT_UART_BUS_TX (&pin_PB13) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 diff --git a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk new file mode 100644 index 0000000000..6ecc1c8a16 --- /dev/null +++ b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk @@ -0,0 +1,19 @@ +LD_FILE = boards/samd51x19-bootloader-external-flash.ld +USB_VID = 0x239A +USB_PID = 0x804A +USB_PRODUCT = "Hallowing M4 Express" +USB_MANUFACTURER = "Adafruit Industries LLC" + +CHIP_VARIANT = SAMD51J19A +CHIP_FAMILY = samd51 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 1 +EXTERNAL_FLASH_DEVICES = GD25Q64C +LONGINT_IMPL = MPZ + +CIRCUITPY_NETWORK = 1 +MICROPY_PY_WIZNET5K = 5500 +CIRCUITPY_PS2IO = 1 +# No touch on SAMD51 yet +CIRCUITPY_TOUCHIO = 0 diff --git a/ports/atmel-samd/boards/hallowing_m4_express/pins.c b/ports/atmel-samd/boards/hallowing_m4_express/pins.c new file mode 100644 index 0000000000..9a1b5a6f9d --- /dev/null +++ b/ports/atmel-samd/boards/hallowing_m4_express/pins.c @@ -0,0 +1,50 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PB04) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PB04) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB23) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB22) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB12) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB13) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB16) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB16) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) }, + + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXEL), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_SENSE), MP_ROM_PTR(&pin_PB03) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PB05) }, + { MP_ROM_QSTR(MP_QSTR_CAP_PIN), MP_ROM_PTR(&pin_PA15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From 0aa5507c4cf7ae53f39fd0bdd987b47260b36fa4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 29 Aug 2019 13:41:28 -0700 Subject: [PATCH 30/41] add additional pin aliases --- ports/atmel-samd/boards/hallowing_m4_express/pins.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/atmel-samd/boards/hallowing_m4_express/pins.c b/ports/atmel-samd/boards/hallowing_m4_express/pins.c index 9a1b5a6f9d..915802d1d6 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/pins.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/pins.c @@ -33,10 +33,15 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB16) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB16) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) }, { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB02) }, { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXEL), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PB03) }, { MP_ROM_QSTR(MP_QSTR_SENSE), MP_ROM_PTR(&pin_PB03) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PB03) }, { MP_ROM_QSTR(MP_QSTR_SPEAKER_ENABLE), MP_ROM_PTR(&pin_PB05) }, { MP_ROM_QSTR(MP_QSTR_CAP_PIN), MP_ROM_PTR(&pin_PA15) }, From b11b7916fd9ed23aa80e8307f7a808b2bbff4f23 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 29 Aug 2019 17:58:21 -0400 Subject: [PATCH 31/41] address minor issues: typos, make translate, and sphinx --- locale/ID.po | 27 ++++++++---- locale/circuitpython.pot | 27 ++++++++---- locale/de_DE.po | 27 ++++++++---- locale/en_US.po | 27 ++++++++---- locale/en_x_pirate.po | 27 ++++++++---- locale/es.po | 27 ++++++++---- locale/fil.po | 27 ++++++++---- locale/fr.po | 27 ++++++++---- locale/it_IT.po | 27 ++++++++---- locale/pl.po | 27 ++++++++---- locale/pt_BR.po | 27 ++++++++---- locale/zh_Latn_pinyin.po | 27 ++++++++---- ports/nrf/common-hal/bleio/Characteristic.c | 4 +- shared-bindings/bleio/Characteristic.c | 48 ++++++++++----------- shared-bindings/bleio/Descriptor.c | 46 ++++++++++---------- shared-bindings/bleio/Peripheral.c | 10 ++--- shared-bindings/bleio/Service.c | 27 ++++++------ 17 files changed, 285 insertions(+), 174 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 2451899d9f..8597714ef6 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -546,10 +546,19 @@ msgid "Expected a %q" msgstr "" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -572,12 +581,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Gagal untuk menambahkan karakteristik, status: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" @@ -849,7 +862,7 @@ msgstr "Pin-pin tidak valid" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2089,6 +2102,7 @@ msgstr "" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2107,11 +2121,6 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "modul tidak ditemukan" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c117663a68..ce2370af9f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -535,10 +535,19 @@ msgid "Expected a %q" msgstr "" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -561,12 +570,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -834,7 +847,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2055,6 +2068,7 @@ msgstr "" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2073,11 +2087,6 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index c8f3715a55..25f9a97d06 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -539,10 +539,19 @@ msgid "Expected a %q" msgstr "Erwartet ein(e) %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Characteristic wird erwartet" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Eine UUID wird erwartet" @@ -565,12 +574,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Hinzufügen des Characteristic ist gescheitert. Status: 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -840,7 +853,7 @@ msgstr "Ungültige Pins" msgid "Invalid polarity" msgstr "Ungültige Polarität" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2102,6 +2115,7 @@ msgstr "map buffer zu klein" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2120,11 +2134,6 @@ msgstr "Speicherzuordnung fehlgeschlagen, Zuweisung von %u Bytes" msgid "memory allocation failed, heap is locked" msgstr "Speicherzuweisung fehlgeschlagen, der Heap ist gesperrt" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "Modul nicht gefunden" diff --git a/locale/en_US.po b/locale/en_US.po index 086a5065d6..47de646bd2 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -535,10 +535,19 @@ msgid "Expected a %q" msgstr "" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -561,12 +570,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -834,7 +847,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2055,6 +2068,7 @@ msgstr "" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2073,11 +2087,6 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 86cd819ed4..6d5a136933 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -539,10 +539,19 @@ msgid "Expected a %q" msgstr "" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "" @@ -565,12 +574,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -838,7 +851,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2059,6 +2072,7 @@ msgstr "" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2077,11 +2091,6 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "" diff --git a/locale/es.po b/locale/es.po index 8fb536ea71..9569c478c2 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -543,10 +543,19 @@ msgid "Expected a %q" msgstr "Se espera un %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Se esperaba una Característica." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Se esperaba un UUID" @@ -569,12 +578,16 @@ msgstr "Fallo enviando comando" msgid "Failed to acquire mutex, err 0x%04x" msgstr "No se puede adquirir el mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Fallo al añadir caracteristica, err: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -845,7 +858,7 @@ msgstr "pines inválidos" msgid "Invalid polarity" msgstr "Polaridad inválida" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2112,6 +2125,7 @@ msgstr "map buffer muy pequeño" msgid "math domain error" msgstr "error de dominio matemático" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2130,11 +2144,6 @@ msgstr "la asignación de memoria falló, asignando %u bytes" msgid "memory allocation failed, heap is locked" msgstr "la asignación de memoria falló, el heap está bloqueado" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "módulo no encontrado" diff --git a/locale/fil.po b/locale/fil.po index 9b9a585672..3f01e0b6cd 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -547,11 +547,20 @@ msgid "Expected a %q" msgstr "Umasa ng %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Hindi mabasa and Characteristic." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -575,12 +584,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Nabigo sa paglagay ng characteristic, status: 0x%08lX" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" @@ -854,7 +867,7 @@ msgstr "Mali ang pins" msgid "Invalid polarity" msgstr "Mali ang polarity" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2125,6 +2138,7 @@ msgstr "masyadong maliit ang buffer map" msgid "math domain error" msgstr "may pagkakamali sa math domain" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2143,11 +2157,6 @@ msgstr "nabigo ang paglalaan ng memorya, paglalaan ng %u bytes" msgid "memory allocation failed, heap is locked" msgstr "abigo ang paglalaan ng memorya, ang heap ay naka-lock" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "module hindi nakita" diff --git a/locale/fr.po b/locale/fr.po index b6183ca289..5c7d16d43e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -551,11 +551,20 @@ msgid "Expected a %q" msgstr "Attendu un %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Une 'Characteristic' est attendue" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -579,12 +588,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Echec de l'obtention de mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Echec de l'ajout de caractéristique, err 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" @@ -862,7 +875,7 @@ msgstr "Broches invalides" msgid "Invalid polarity" msgstr "Polarité invalide" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2157,6 +2170,7 @@ msgstr "tampon trop petit" msgid "math domain error" msgstr "erreur de domaine math" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2175,11 +2189,6 @@ msgstr "l'allocation de mémoire a échoué en allouant %u octets" msgid "memory allocation failed, heap is locked" msgstr "l'allocation de mémoire a échoué, le tas est vérrouillé" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "module introuvable" diff --git a/locale/it_IT.po b/locale/it_IT.po index 01729d00bc..e7b14ef6b1 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -547,11 +547,20 @@ msgid "Expected a %q" msgstr "Atteso un %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Non è possibile aggiungere Characteristic." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -575,12 +584,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" @@ -855,7 +868,7 @@ msgstr "Pin non validi" msgid "Invalid polarity" msgstr "Polarità non valida" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2118,6 +2131,7 @@ msgstr "map buffer troppo piccolo" msgid "math domain error" msgstr "errore di dominio matematico" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2136,11 +2150,6 @@ msgstr "allocazione di memoria fallita, allocando %u byte" msgid "memory allocation failed, heap is locked" msgstr "allocazione di memoria fallita, l'heap è bloccato" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "modulo non trovato" diff --git a/locale/pl.po b/locale/pl.po index 33a9f76ae2..00170cb3fc 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -538,10 +538,19 @@ msgid "Expected a %q" msgstr "Oczekiwano %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Oczekiwano charakterystyki" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Oczekiwano UUID" @@ -564,12 +573,16 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nie udało się uzyskać blokady, błąd 0x$04x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Nie udało się dodać charakterystyki, błąd 0x$04x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -839,7 +852,7 @@ msgstr "Złe nóżki" msgid "Invalid polarity" msgstr "Zła polaryzacja" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2080,6 +2093,7 @@ msgstr "bufor mapy zbyt mały" msgid "math domain error" msgstr "błąd domeny" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2098,11 +2112,6 @@ msgstr "alokacja pamięci nie powiodła się, alokowano %u bajtów" msgid "memory allocation failed, heap is locked" msgstr "alokacja pamięci nie powiodła się, sterta zablokowana" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "brak modułu" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index cc7a6ef3be..bf55570dbd 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -542,11 +542,20 @@ msgid "Expected a %q" msgstr "Esperado um" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Não é possível adicionar Característica." -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c #, fuzzy msgid "Expected a UUID" @@ -570,12 +579,16 @@ msgstr "Falha ao enviar comando." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Não é possível ler o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" @@ -848,7 +861,7 @@ msgstr "Pinos inválidos" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2080,6 +2093,7 @@ msgstr "" msgid "math domain error" msgstr "" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2098,11 +2112,6 @@ msgstr "" msgid "memory allocation failed, heap is locked" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index f0fbebb997..16f4ecf2ce 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-28 16:09-0400\n" +"POT-Creation-Date: 2019-08-29 14:16-0400\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -539,10 +539,19 @@ msgid "Expected a %q" msgstr "Yùqí %q" #: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Yùqí de tèdiǎn" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Peripheral.c +#: shared-bindings/bleio/Service.c +msgid "Expected a Peripheral" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c +msgid "Expected a Service" +msgstr "" + +#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c #: shared-bindings/bleio/Service.c msgid "Expected a UUID" msgstr "Yùqí UUID" @@ -565,12 +574,16 @@ msgstr "Fāsòng mìnglìng shībài." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Wúfǎ huòdé mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Tiānjiā tèxìng shībài, err 0x%04x" +#: ports/nrf/common-hal/bleio/Characteristic.c +#, c-format +msgid "Failed to add descriptor, err 0x%04x" +msgstr "" + #: ports/nrf/common-hal/bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" @@ -840,7 +853,7 @@ msgstr "Wúxiào de yǐn jiǎo" msgid "Invalid polarity" msgstr "Wúxiào liǎng jí zhí" -#: shared-bindings/bleio/Service.c +#: shared-bindings/bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -2092,6 +2105,7 @@ msgstr "dìtú huǎnchōng qū tài xiǎo" msgid "math domain error" msgstr "shùxué yù cuòwù" +#: ports/nrf/common-hal/bleio/Characteristic.c #: ports/nrf/common-hal/bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" @@ -2110,11 +2124,6 @@ msgstr "nèicún fēnpèi shībài, fēnpèi %u zì jié" msgid "memory allocation failed, heap is locked" msgstr "jìyì tǐ fēnpèi shībài, duī bèi suǒdìng" -#: ports/nrf/common-hal/bleio/Characteristic.c -#, c-format -msgid "mnax_length must be 0-%d when fixed_length is %s" -msgstr "" - #: py/builtinimport.c msgid "module not found" msgstr "zhǎo bù dào mókuài" diff --git a/ports/nrf/common-hal/bleio/Characteristic.c b/ports/nrf/common-hal/bleio/Characteristic.c index 06a312f583..2596f17d8b 100644 --- a/ports/nrf/common-hal/bleio/Characteristic.c +++ b/ports/nrf/common-hal/bleio/Characteristic.c @@ -135,7 +135,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, const mp_int_t max_length_max = fixed_length ? BLE_GATTS_FIX_ATTR_LEN_MAX : BLE_GATTS_VAR_ATTR_LEN_MAX; if (max_length < 0 || max_length > max_length_max) { - mp_raise_ValueError_varg(translate("mnax_length must be 0-%d when fixed_length is %s"), + mp_raise_ValueError_varg(translate("max_length must be 0-%d when fixed_length is %s"), max_length_max, fixed_length ? "True" : "False"); } self->max_length = max_length; @@ -249,7 +249,7 @@ void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t * uint32_t err_code = sd_ble_gatts_descriptor_add(self->handle, &desc_attr, &descriptor->handle); if (err_code != NRF_SUCCESS) { - mp_raise_OSError_msg_varg(translate("Failed to add characteristic, err 0x%04x"), err_code); + mp_raise_OSError_msg_varg(translate("Failed to add descriptor, err 0x%04x"), err_code); } mp_obj_list_append(self->descriptor_list, MP_OBJ_FROM_PTR(descriptor)); diff --git a/shared-bindings/bleio/Characteristic.c b/shared-bindings/bleio/Characteristic.c index 90cd77d177..41d81087c3 100644 --- a/shared-bindings/bleio/Characteristic.c +++ b/shared-bindings/bleio/Characteristic.c @@ -41,36 +41,37 @@ //| Stores information about a BLE service characteristic and allows reading //| and writing of the characteristic's value. //| -//| There is no regular constructor for a Characteristic. A new local Characteristic can be created -//| and attached to a Service by calling `Characteristic.add_to_service()`. -//| Remote Characteristic objects are created by `Central.discover_remote_services()` -//| or `Peripheral.discover_remote_services()` as part of remote Services. +//| .. class:: Characteristic +//| +//| There is no regular constructor for a Characteristic. A new local Characteristic can be created +//| and attached to a Service by calling `add_to_service()`. +//| Remote Characteristic objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()` as part of remote Services. //| //| .. method:: add_to_service(service, uuid, *, properties=0, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=None) //| -//| Create a new `Characteristic` object, and add it to this Service. +//| Create a new Characteristic object, and add it to this Service. //| -//| :param bleio.Service service: The service that will provide this characteristic -//| :param bleio.UUID uuid: The uuid of the characteristic -//| :param int properties: The properties of the characteristic, -//| specified as a bitmask of these values bitwise-or'd together: -//| `Characteristic.BROADCAST`, `Characteristic.INDICATE`, `Characteristic.NOTIFY`, -//| `Characteristic.READ`, `Characteristic.WRITE`, `Characteristic.WRITE_NO_RESPONSE`. -//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is +//| :param Service service: The service that will provide this characteristic +//| :param UUID uuid: The uuid of the characteristic +//| :param int properties: The properties of the characteristic, +//| specified as a bitmask of these values bitwise-or'd together: +//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`. +//| :param int read_perm: Specifies whether the characteristic can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the characteristic can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed is //| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum //| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the characteristic value is of fixed length. -//| :param buf initial_value: The initial value for this characteristic. If not given, will be +//| :param bool fixed_length: True if the characteristic value is of fixed length. +//| :param buf initial_value: The initial value for this characteristic. If not given, will be //| filled with zeros. //| -//| :return: the new `Characteristic`. +//| :return: the new Characteristic. //| STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // class is arg[0], which we can ignore. @@ -150,8 +151,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj, //| //| An int bitmask representing which properties are set, specified as bitwise or'ing of //| of these possible values. -//| `~Characteristic.BROADCAST`, `~Characteristic.INDICATE`, `~Characteristic.NOTIFY`, -//| `~Characteristic.READ`, `~Characteristic.WRITE`, `~Characteristic.WRITE_NO_RESPONSE`. +//| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`. //| STATIC mp_obj_t bleio_characteristic_get_properties(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -219,7 +219,7 @@ const mp_obj_property_t bleio_characteristic_value_obj = { //| .. attribute:: descriptors //| -//| A tuple of `bleio.Descriptor` that describe this characteristic. (read-only) +//| A tuple of :py:class:`Descriptor` that describe this characteristic. (read-only) //| STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/bleio/Descriptor.c b/shared-bindings/bleio/Descriptor.c index 39fd21d888..eba2ea1a88 100644 --- a/shared-bindings/bleio/Descriptor.c +++ b/shared-bindings/bleio/Descriptor.c @@ -42,31 +42,33 @@ //| Descriptors are attached to BLE characteristics and provide contextual //| information about the characteristic. //| -//| There is no regular constructor for a Descriptor. A new local Descriptor can be created -//| and attached to a Characteristic by calling `Descriptor.add_to_characteristic()`. -//| Remote Descriptor objects are created by `Central.discover_remote_services()` -//| or `Peripheral.discover_remote_services()` as part of remote Characteristics -//| in the remote Services that are discovered. - -//| .. method:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') +//| .. class:: Descriptor //| -//| Create a new `Descriptor` object, and add it to this Service. +//| There is no regular constructor for a Descriptor. A new local Descriptor can be created +//| and attached to a Characteristic by calling `add_to_characteristic()`. +//| Remote Descriptor objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()` as part of remote Characteristics +//| in the remote Services that are discovered. //| -//| :param bleio.Characteristic characteristic: The characteristic that will hold this descriptor -//| :param bleio.UUID uuid: The uuid of the descriptor -//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which -//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, -//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, -//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. -//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which -//| security mode is required. Values allowed are the same as ``read_perm``. -//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is -//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum -//| number of data bytes that fit in a single BLE 4.x ATT packet. -//| :param bool fixed_length: True if the descriptor value is of fixed length. -//| :param buf initial_value: The initial value for this descriptor. +//| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'') //| -//| :return: the new `Descriptor`. +//| Create a new Descriptor object, and add it to this Service. +//| +//| :param Characteristic characteristic: The characteristic that will hold this descriptor +//| :param UUID uuid: The uuid of the descriptor +//| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which +//| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`, +//| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`, +//| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`. +//| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which +//| security mode is required. Values allowed are the same as ``read_perm``. +//| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is +//| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum +//| number of data bytes that fit in a single BLE 4.x ATT packet. +//| :param bool fixed_length: True if the descriptor value is of fixed length. +//| :param buf initial_value: The initial value for this descriptor. +//| +//| :return: the new Descriptor. //| STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // class is arg[0], which we can ignore. diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/bleio/Peripheral.c index 6ebc406d60..206f1c9a84 100644 --- a/shared-bindings/bleio/Peripheral.c +++ b/shared-bindings/bleio/Peripheral.c @@ -61,21 +61,21 @@ //| //| Usage:: //| -//| import bleio +//| from bleio import Characteristic, Peripheral, Service //| from adafruit_ble.advertising import ServerAdvertisement //| //| # Create a peripheral and start it up. //| peripheral = bleio.Peripheral() //| //| # Create a Service and add it to this Peripheral. -//| service = peripheral.addService(bleio.UUID(0x180f)) +//| service = Service.add_to_peripheral(peripheral, bleio.UUID(0x180f)) //| //| # Create a Characteristic and add it to the Service. -//| characteristic = service.addCharacteristic( +//| characteristic = Characterist.add_to_service(service, //| bleio.UUID(0x2919), properties=Characteristic.READ | Characteristic.NOTIFY) //| //| adv = ServerAdvertisement(peripheral) -//| peripheral.start_advertising(adv.advertising_data_bytes, adv.scan_response_bytes) +//| peripheral.start_advertising(adv.advertising_data_bytes, scan_response=adv.scan_response_bytes) //| //| while not peripheral.connected: //| # Wait for connection. @@ -132,7 +132,7 @@ const mp_obj_property_t bleio_peripheral_connected_obj = { //| .. attribute:: services //| -//| A `tuple` of `bleio.Service` that are offered by this peripheral. (read-only) +//| A tuple of :py:class:`Service` objects offered by this peripheral. (read-only) //| STATIC mp_obj_t bleio_peripheral_get_services(mp_obj_t self_in) { bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/bleio/Service.c b/shared-bindings/bleio/Service.c index 134106915e..f3bfebb7b1 100644 --- a/shared-bindings/bleio/Service.c +++ b/shared-bindings/bleio/Service.c @@ -40,24 +40,25 @@ //| //| Stores information about a BLE service and its characteristics. //| -//| There is no regular constructor for a Service. A new local Service can be created -//| and attached to a Peripheral by calling `Service.add_to_peripheral()`. -//| Remote Service objects are created by `Central.discover_remote_services()` -//| or `Peripheral.discover_remote_services()`. +//| .. class:: Service +//| +//| There is no regular constructor for a Service. A new local Service can be created +//| and attached to a Peripheral by calling `add_to_peripheral()`. +//| Remote Service objects are created by `Central.discover_remote_services()` +//| or `Peripheral.discover_remote_services()`. //| - //| .. classmethod:: add_to_peripheral(peripheral, uuid, *, secondary=False) //| -//| Create a new `Service` object, identitied by the specified UUID, and add it -//| to the given Peripheral. +//| Create a new Service object, identitied by the specified UUID, and add it +//| to the given Peripheral. //| -//| To mark the service as secondary, pass `True` as :py:data:`secondary`. +//| To mark the service as secondary, pass `True` as :py:data:`secondary`. //| -//| :param bleio.Peripheral peripheral: The peripheral that will provide this service -//| :param bleio.UUID uuid: The uuid of the service -//| :param bool secondary: If the service is a secondary one +//| :param Peripheral peripheral: The peripheral that will provide this service +//| :param UUID uuid: The uuid of the service +//| :param bool secondary: If the service is a secondary one // -//| :return: the new `Service` +//| :return: the new Service //| STATIC mp_obj_t bleio_service_add_to_peripheral(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // class is arg[0], which we can ignore. @@ -99,7 +100,7 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_service_add_to_peripheral_obj, MP_R //| .. attribute:: characteristics //| -//| A tuple of `bleio.Characteristic` that are offered by this service. (read-only) +//| A tuple of :py:class:`Characteristic` designating the characteristics that are offered by this service. (read-only) //| STATIC mp_obj_t bleio_service_get_characteristics(mp_obj_t self_in) { bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in); From 7a64af92807f012828636c101f4350272f6e929a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 29 Aug 2019 18:44:27 -0400 Subject: [PATCH 32/41] rename bleio module to _bleio --- ports/nrf/bluetooth/ble_uart.c | 10 ++--- .../common-hal/{bleio => _bleio}/Adapter.c | 4 +- .../common-hal/{bleio => _bleio}/Adapter.h | 0 .../common-hal/{bleio => _bleio}/Attribute.c | 4 +- .../common-hal/{bleio => _bleio}/Attribute.h | 2 +- .../common-hal/{bleio => _bleio}/Central.c | 6 +-- .../common-hal/{bleio => _bleio}/Central.h | 2 +- .../{bleio => _bleio}/Characteristic.c | 8 ++-- .../{bleio => _bleio}/Characteristic.h | 8 ++-- .../{bleio => _bleio}/CharacteristicBuffer.c | 4 +- .../{bleio => _bleio}/CharacteristicBuffer.h | 2 +- .../common-hal/{bleio => _bleio}/Descriptor.c | 8 ++-- .../common-hal/{bleio => _bleio}/Descriptor.h | 4 +- .../common-hal/{bleio => _bleio}/Peripheral.c | 14 +++--- .../common-hal/{bleio => _bleio}/Peripheral.h | 4 +- .../common-hal/{bleio => _bleio}/Scanner.c | 8 ++-- .../common-hal/{bleio => _bleio}/Scanner.h | 0 .../common-hal/{bleio => _bleio}/Service.c | 12 +++--- .../common-hal/{bleio => _bleio}/Service.h | 2 +- ports/nrf/common-hal/{bleio => _bleio}/UUID.c | 4 +- ports/nrf/common-hal/{bleio => _bleio}/UUID.h | 0 .../common-hal/{bleio => _bleio}/__init__.c | 20 ++++----- .../common-hal/{bleio => _bleio}/__init__.h | 0 ports/nrf/supervisor/port.c | 2 +- py/circuitpy_defns.mk | 36 ++++++++-------- py/circuitpy_mpconfig.h | 2 +- py/circuitpy_mpconfig.mk | 2 +- shared-bindings/{bleio => _bleio}/Adapter.c | 16 +++---- shared-bindings/{bleio => _bleio}/Adapter.h | 2 +- shared-bindings/{bleio => _bleio}/Address.c | 14 +++--- shared-bindings/{bleio => _bleio}/Address.h | 2 +- shared-bindings/{bleio => _bleio}/Attribute.c | 10 ++--- shared-bindings/{bleio => _bleio}/Attribute.h | 4 +- shared-bindings/{bleio => _bleio}/Central.c | 20 ++++----- shared-bindings/{bleio => _bleio}/Central.h | 4 +- .../{bleio => _bleio}/Characteristic.c | 10 ++--- .../{bleio => _bleio}/Characteristic.h | 10 ++--- .../{bleio => _bleio}/CharacteristicBuffer.c | 8 ++-- .../{bleio => _bleio}/CharacteristicBuffer.h | 2 +- .../{bleio => _bleio}/Descriptor.c | 10 ++--- .../{bleio => _bleio}/Descriptor.h | 8 ++-- .../{bleio => _bleio}/Peripheral.c | 28 ++++++------ .../{bleio => _bleio}/Peripheral.h | 4 +- shared-bindings/{bleio => _bleio}/ScanEntry.c | 14 +++--- shared-bindings/{bleio => _bleio}/ScanEntry.h | 2 +- shared-bindings/{bleio => _bleio}/Scanner.c | 10 ++--- shared-bindings/{bleio => _bleio}/Scanner.h | 2 +- shared-bindings/{bleio => _bleio}/Service.c | 10 ++--- shared-bindings/{bleio => _bleio}/Service.h | 4 +- shared-bindings/{bleio => _bleio}/UUID.c | 4 +- shared-bindings/{bleio => _bleio}/UUID.h | 2 +- shared-bindings/{bleio => _bleio}/__init__.c | 43 ++++++++++--------- shared-bindings/{bleio => _bleio}/__init__.h | 6 +-- shared-module/{bleio => _bleio}/Address.c | 4 +- shared-module/{bleio => _bleio}/Address.h | 0 shared-module/{bleio => _bleio}/Attribute.c | 2 +- shared-module/{bleio => _bleio}/Attribute.h | 0 .../{bleio => _bleio}/Characteristic.h | 0 shared-module/{bleio => _bleio}/ScanEntry.c | 6 +-- shared-module/{bleio => _bleio}/ScanEntry.h | 2 +- 60 files changed, 217 insertions(+), 214 deletions(-) rename ports/nrf/common-hal/{bleio => _bleio}/Adapter.c (98%) rename ports/nrf/common-hal/{bleio => _bleio}/Adapter.h (100%) rename ports/nrf/common-hal/{bleio => _bleio}/Attribute.c (95%) rename ports/nrf/common-hal/{bleio => _bleio}/Attribute.h (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Central.c (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Central.h (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Characteristic.c (98%) rename ports/nrf/common-hal/{bleio => _bleio}/Characteristic.h (92%) rename ports/nrf/common-hal/{bleio => _bleio}/CharacteristicBuffer.c (98%) rename ports/nrf/common-hal/{bleio => _bleio}/CharacteristicBuffer.h (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Descriptor.c (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Descriptor.h (95%) rename ports/nrf/common-hal/{bleio => _bleio}/Peripheral.c (97%) rename ports/nrf/common-hal/{bleio => _bleio}/Peripheral.h (96%) rename ports/nrf/common-hal/{bleio => _bleio}/Scanner.c (95%) rename ports/nrf/common-hal/{bleio => _bleio}/Scanner.h (100%) rename ports/nrf/common-hal/{bleio => _bleio}/Service.c (94%) rename ports/nrf/common-hal/{bleio => _bleio}/Service.h (98%) rename ports/nrf/common-hal/{bleio => _bleio}/UUID.c (98%) rename ports/nrf/common-hal/{bleio => _bleio}/UUID.h (100%) rename ports/nrf/common-hal/{bleio => _bleio}/__init__.c (97%) rename ports/nrf/common-hal/{bleio => _bleio}/__init__.h (100%) rename shared-bindings/{bleio => _bleio}/Adapter.c (92%) rename shared-bindings/{bleio => _bleio}/Adapter.h (97%) rename shared-bindings/{bleio => _bleio}/Address.c (96%) rename shared-bindings/{bleio => _bleio}/Address.h (98%) rename shared-bindings/{bleio => _bleio}/Attribute.c (93%) rename shared-bindings/{bleio => _bleio}/Attribute.h (94%) rename shared-bindings/{bleio => _bleio}/Central.c (94%) rename shared-bindings/{bleio => _bleio}/Central.h (96%) rename shared-bindings/{bleio => _bleio}/Characteristic.c (98%) rename shared-bindings/{bleio => _bleio}/Characteristic.h (92%) rename shared-bindings/{bleio => _bleio}/CharacteristicBuffer.c (97%) rename shared-bindings/{bleio => _bleio}/CharacteristicBuffer.h (97%) rename shared-bindings/{bleio => _bleio}/Descriptor.c (97%) rename shared-bindings/{bleio => _bleio}/Descriptor.h (93%) rename shared-bindings/{bleio => _bleio}/Peripheral.c (94%) rename shared-bindings/{bleio => _bleio}/Peripheral.h (97%) rename shared-bindings/{bleio => _bleio}/ScanEntry.c (92%) rename shared-bindings/{bleio => _bleio}/ScanEntry.h (97%) rename shared-bindings/{bleio => _bleio}/Scanner.c (96%) rename shared-bindings/{bleio => _bleio}/Scanner.h (97%) rename shared-bindings/{bleio => _bleio}/Service.c (97%) rename shared-bindings/{bleio => _bleio}/Service.h (96%) rename shared-bindings/{bleio => _bleio}/UUID.c (99%) rename shared-bindings/{bleio => _bleio}/UUID.h (98%) rename shared-bindings/{bleio => _bleio}/__init__.c (74%) rename shared-bindings/{bleio => _bleio}/__init__.h (94%) rename shared-module/{bleio => _bleio}/Address.c (95%) rename shared-module/{bleio => _bleio}/Address.h (100%) rename shared-module/{bleio => _bleio}/Attribute.c (97%) rename shared-module/{bleio => _bleio}/Attribute.h (100%) rename shared-module/{bleio => _bleio}/Characteristic.h (100%) rename shared-module/{bleio => _bleio}/ScanEntry.c (92%) rename shared-module/{bleio => _bleio}/ScanEntry.h (97%) diff --git a/ports/nrf/bluetooth/ble_uart.c b/ports/nrf/bluetooth/ble_uart.c index d83cf3980a..787a2a1174 100644 --- a/ports/nrf/bluetooth/ble_uart.c +++ b/ports/nrf/bluetooth/ble_uart.c @@ -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) diff --git a/ports/nrf/common-hal/bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c similarity index 98% rename from ports/nrf/common-hal/bleio/Adapter.c rename to ports/nrf/common-hal/_bleio/Adapter.c index 74bee9e56e..a8e1f19059 100644 --- a/ports/nrf/common-hal/bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -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) diff --git a/ports/nrf/common-hal/bleio/Adapter.h b/ports/nrf/common-hal/_bleio/Adapter.h similarity index 100% rename from ports/nrf/common-hal/bleio/Adapter.h rename to ports/nrf/common-hal/_bleio/Adapter.h diff --git a/ports/nrf/common-hal/bleio/Attribute.c b/ports/nrf/common-hal/_bleio/Attribute.c similarity index 95% rename from ports/nrf/common-hal/bleio/Attribute.c rename to ports/nrf/common-hal/_bleio/Attribute.c index fd1e7538da..c55914b10d 100644 --- a/ports/nrf/common-hal/bleio/Attribute.c +++ b/ports/nrf/common-hal/_bleio/Attribute.c @@ -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: diff --git a/ports/nrf/common-hal/bleio/Attribute.h b/ports/nrf/common-hal/_bleio/Attribute.h similarity index 97% rename from ports/nrf/common-hal/bleio/Attribute.h rename to ports/nrf/common-hal/_bleio/Attribute.h index cf84f01dcf..8cc361046e 100644 --- a/ports/nrf/common-hal/bleio/Attribute.h +++ b/ports/nrf/common-hal/_bleio/Attribute.h @@ -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); diff --git a/ports/nrf/common-hal/bleio/Central.c b/ports/nrf/common-hal/_bleio/Central.c similarity index 97% rename from ports/nrf/common-hal/bleio/Central.c rename to ports/nrf/common-hal/_bleio/Central.c index 0f8432b73a..db67b763c6 100644 --- a/ports/nrf/common-hal/bleio/Central.c +++ b/ports/nrf/common-hal/_bleio/Central.c @@ -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; diff --git a/ports/nrf/common-hal/bleio/Central.h b/ports/nrf/common-hal/_bleio/Central.h similarity index 97% rename from ports/nrf/common-hal/bleio/Central.h rename to ports/nrf/common-hal/_bleio/Central.h index 2e00aa35e2..01f7faca74 100644 --- a/ports/nrf/common-hal/bleio/Central.h +++ b/ports/nrf/common-hal/_bleio/Central.h @@ -31,7 +31,7 @@ #include #include "py/objlist.h" -#include "shared-module/bleio/Address.h" +#include "shared-module/_bleio/Address.h" typedef struct { mp_obj_base_t base; diff --git a/ports/nrf/common-hal/bleio/Characteristic.c b/ports/nrf/common-hal/_bleio/Characteristic.c similarity index 98% rename from ports/nrf/common-hal/bleio/Characteristic.c rename to ports/nrf/common-hal/_bleio/Characteristic.c index 2596f17d8b..e8454d528c 100644 --- a/ports/nrf/common-hal/bleio/Characteristic.c +++ b/ports/nrf/common-hal/_bleio/Characteristic.c @@ -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; diff --git a/ports/nrf/common-hal/bleio/Characteristic.h b/ports/nrf/common-hal/_bleio/Characteristic.h similarity index 92% rename from ports/nrf/common-hal/bleio/Characteristic.h rename to ports/nrf/common-hal/_bleio/Characteristic.h index fb6a4c6cef..3a7691d07f 100644 --- a/ports/nrf/common-hal/bleio/Characteristic.h +++ b/ports/nrf/common-hal/_bleio/Characteristic.h @@ -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; diff --git a/ports/nrf/common-hal/bleio/CharacteristicBuffer.c b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c similarity index 98% rename from ports/nrf/common-hal/bleio/CharacteristicBuffer.c rename to ports/nrf/common-hal/_bleio/CharacteristicBuffer.c index 64ab5e8a7a..95794feec0 100644 --- a/ports/nrf/common-hal/bleio/CharacteristicBuffer.c +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c @@ -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. diff --git a/ports/nrf/common-hal/bleio/CharacteristicBuffer.h b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h similarity index 97% rename from ports/nrf/common-hal/bleio/CharacteristicBuffer.h rename to ports/nrf/common-hal/_bleio/CharacteristicBuffer.h index db8fd2fade..f0949251cd 100644 --- a/ports/nrf/common-hal/bleio/CharacteristicBuffer.h +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h @@ -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; diff --git a/ports/nrf/common-hal/bleio/Descriptor.c b/ports/nrf/common-hal/_bleio/Descriptor.c similarity index 97% rename from ports/nrf/common-hal/bleio/Descriptor.c rename to ports/nrf/common-hal/_bleio/Descriptor.c index 4a5974a064..137f004bab 100644 --- a/ports/nrf/common-hal/bleio/Descriptor.c +++ b/ports/nrf/common-hal/_bleio/Descriptor.c @@ -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; diff --git a/ports/nrf/common-hal/bleio/Descriptor.h b/ports/nrf/common-hal/_bleio/Descriptor.h similarity index 95% rename from ports/nrf/common-hal/bleio/Descriptor.h rename to ports/nrf/common-hal/_bleio/Descriptor.h index db11751465..3adb0df184 100644 --- a/ports/nrf/common-hal/bleio/Descriptor.h +++ b/ports/nrf/common-hal/_bleio/Descriptor.h @@ -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; diff --git a/ports/nrf/common-hal/bleio/Peripheral.c b/ports/nrf/common-hal/_bleio/Peripheral.c similarity index 97% rename from ports/nrf/common-hal/bleio/Peripheral.c rename to ports/nrf/common-hal/_bleio/Peripheral.c index 92dfc2da1d..9b0f96d48f 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.c +++ b/ports/nrf/common-hal/_bleio/Peripheral.c @@ -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 diff --git a/ports/nrf/common-hal/bleio/Peripheral.h b/ports/nrf/common-hal/_bleio/Peripheral.h similarity index 96% rename from ports/nrf/common-hal/bleio/Peripheral.h rename to ports/nrf/common-hal/_bleio/Peripheral.h index 1620874ca2..a4f62d288a 100644 --- a/ports/nrf/common-hal/bleio/Peripheral.h +++ b/ports/nrf/common-hal/_bleio/Peripheral.h @@ -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, diff --git a/ports/nrf/common-hal/bleio/Scanner.c b/ports/nrf/common-hal/_bleio/Scanner.c similarity index 95% rename from ports/nrf/common-hal/bleio/Scanner.c rename to ports/nrf/common-hal/_bleio/Scanner.c index 57ce940abd..ec73f7eb8f 100644 --- a/ports/nrf/common-hal/bleio/Scanner.c +++ b/ports/nrf/common-hal/_bleio/Scanner.c @@ -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]; diff --git a/ports/nrf/common-hal/bleio/Scanner.h b/ports/nrf/common-hal/_bleio/Scanner.h similarity index 100% rename from ports/nrf/common-hal/bleio/Scanner.h rename to ports/nrf/common-hal/_bleio/Scanner.h diff --git a/ports/nrf/common-hal/bleio/Service.c b/ports/nrf/common-hal/_bleio/Service.c similarity index 94% rename from ports/nrf/common-hal/bleio/Service.c rename to ports/nrf/common-hal/_bleio/Service.c index f69bbd89da..650cdc4ec9 100644 --- a/ports/nrf/common-hal/bleio/Service.c +++ b/ports/nrf/common-hal/_bleio/Service.c @@ -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); diff --git a/ports/nrf/common-hal/bleio/Service.h b/ports/nrf/common-hal/_bleio/Service.h similarity index 98% rename from ports/nrf/common-hal/bleio/Service.h rename to ports/nrf/common-hal/_bleio/Service.h index 03ac2bca80..a4614b9f51 100644 --- a/ports/nrf/common-hal/bleio/Service.h +++ b/ports/nrf/common-hal/_bleio/Service.h @@ -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; diff --git a/ports/nrf/common-hal/bleio/UUID.c b/ports/nrf/common-hal/_bleio/UUID.c similarity index 98% rename from ports/nrf/common-hal/bleio/UUID.c rename to ports/nrf/common-hal/_bleio/UUID.c index ebd6b6d1fb..0e65b7d58d 100644 --- a/ports/nrf/common-hal/bleio/UUID.c +++ b/ports/nrf/common-hal/_bleio/UUID.c @@ -29,8 +29,8 @@ #include #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" diff --git a/ports/nrf/common-hal/bleio/UUID.h b/ports/nrf/common-hal/_bleio/UUID.h similarity index 100% rename from ports/nrf/common-hal/bleio/UUID.h rename to ports/nrf/common-hal/_bleio/UUID.h diff --git a/ports/nrf/common-hal/bleio/__init__.c b/ports/nrf/common-hal/_bleio/__init__.c similarity index 97% rename from ports/nrf/common-hal/bleio/__init__.c rename to ports/nrf/common-hal/_bleio/__init__.c index 4a7597e37b..5530441909 100644 --- a/ports/nrf/common-hal/bleio/__init__.c +++ b/ports/nrf/common-hal/_bleio/__init__.c @@ -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 = { diff --git a/ports/nrf/common-hal/bleio/__init__.h b/ports/nrf/common-hal/_bleio/__init__.h similarity index 100% rename from ports/nrf/common-hal/bleio/__init__.h rename to ports/nrf/common-hal/_bleio/__init__.h diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 03f7876247..8e55835816 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -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" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 3f593416e5..b17c312f7b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -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 \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index c2e2e2d023..5ac66665a4 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -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 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 356a8f95d1..1af71a4162 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -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 diff --git a/shared-bindings/bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c similarity index 92% rename from shared-bindings/bleio/Adapter.c rename to shared-bindings/_bleio/Adapter.c index 2bb7f34653..0caca96b86 100644 --- a/shared-bindings/bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -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 diff --git a/shared-bindings/bleio/Adapter.h b/shared-bindings/_bleio/Adapter.h similarity index 97% rename from shared-bindings/bleio/Adapter.h rename to shared-bindings/_bleio/Adapter.h index 72382616ca..932fc9c958 100644 --- a/shared-bindings/bleio/Adapter.h +++ b/shared-bindings/_bleio/Adapter.h @@ -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; diff --git a/shared-bindings/bleio/Address.c b/shared-bindings/_bleio/Address.c similarity index 96% rename from shared-bindings/bleio/Address.c rename to shared-bindings/_bleio/Address.c index baeb6d7c0a..cdee02b5d7 100644 --- a/shared-bindings/bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -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 //|
-//| >>> 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) { diff --git a/shared-bindings/bleio/Address.h b/shared-bindings/_bleio/Address.h similarity index 98% rename from shared-bindings/bleio/Address.h rename to shared-bindings/_bleio/Address.h index 5e02ee210f..98b6f80e0e 100644 --- a/shared-bindings/bleio/Address.h +++ b/shared-bindings/_bleio/Address.h @@ -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) diff --git a/shared-bindings/bleio/Attribute.c b/shared-bindings/_bleio/Attribute.c similarity index 93% rename from shared-bindings/bleio/Attribute.c rename to shared-bindings/_bleio/Attribute.c index 2cc9ef6d05..2d8b15b9f4 100644 --- a/shared-bindings/bleio/Attribute.c +++ b/shared-bindings/_bleio/Attribute.c @@ -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[] = { diff --git a/shared-bindings/bleio/Attribute.h b/shared-bindings/_bleio/Attribute.h similarity index 94% rename from shared-bindings/bleio/Attribute.h rename to shared-bindings/_bleio/Attribute.h index 39bef50572..a0ce045003 100644 --- a/shared-bindings/bleio/Attribute.h +++ b/shared-bindings/_bleio/Attribute.h @@ -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; diff --git a/shared-bindings/bleio/Central.c b/shared-bindings/_bleio/Central.c similarity index 94% rename from shared-bindings/bleio/Central.c rename to shared-bindings/_bleio/Central.c index 1fc455d8db..084f40cd62 100644 --- a/shared-bindings/bleio/Central.c +++ b/shared-bindings/_bleio/Central.c @@ -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) { diff --git a/shared-bindings/bleio/Central.h b/shared-bindings/_bleio/Central.h similarity index 96% rename from shared-bindings/bleio/Central.h rename to shared-bindings/_bleio/Central.h index cbc437087b..85d788654f 100644 --- a/shared-bindings/bleio/Central.h +++ b/shared-bindings/_bleio/Central.h @@ -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; diff --git a/shared-bindings/bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c similarity index 98% rename from shared-bindings/bleio/Characteristic.c rename to shared-bindings/_bleio/Characteristic.c index 41d81087c3..1981555891 100644 --- a/shared-bindings/bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -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 //| ========================================================= diff --git a/shared-bindings/bleio/Characteristic.h b/shared-bindings/_bleio/Characteristic.h similarity index 92% rename from shared-bindings/bleio/Characteristic.h rename to shared-bindings/_bleio/Characteristic.h index 52df87b36e..a816c60506 100644 --- a/shared-bindings/bleio/Characteristic.h +++ b/shared-bindings/_bleio/Characteristic.h @@ -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; diff --git a/shared-bindings/bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c similarity index 97% rename from shared-bindings/bleio/CharacteristicBuffer.c rename to shared-bindings/_bleio/CharacteristicBuffer.c index 26f9e012b5..9cc708eb78 100644 --- a/shared-bindings/bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -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. diff --git a/shared-bindings/bleio/CharacteristicBuffer.h b/shared-bindings/_bleio/CharacteristicBuffer.h similarity index 97% rename from shared-bindings/bleio/CharacteristicBuffer.h rename to shared-bindings/_bleio/CharacteristicBuffer.h index b45835ff39..83e6fef02f 100644 --- a/shared-bindings/bleio/CharacteristicBuffer.h +++ b/shared-bindings/_bleio/CharacteristicBuffer.h @@ -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; diff --git a/shared-bindings/bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c similarity index 97% rename from shared-bindings/bleio/Descriptor.c rename to shared-bindings/_bleio/Descriptor.c index eba2ea1a88..0ab9fe8e9e 100644 --- a/shared-bindings/bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -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 //| ========================================================= diff --git a/shared-bindings/bleio/Descriptor.h b/shared-bindings/_bleio/Descriptor.h similarity index 93% rename from shared-bindings/bleio/Descriptor.h rename to shared-bindings/_bleio/Descriptor.h index d12ebaab99..7544bdb17b 100644 --- a/shared-bindings/bleio/Descriptor.h +++ b/shared-bindings/_bleio/Descriptor.h @@ -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; diff --git a/shared-bindings/bleio/Peripheral.c b/shared-bindings/_bleio/Peripheral.c similarity index 94% rename from shared-bindings/bleio/Peripheral.c rename to shared-bindings/_bleio/Peripheral.c index 206f1c9a84..0bf2927442 100644 --- a/shared-bindings/bleio/Peripheral.c +++ b/shared-bindings/_bleio/Peripheral.c @@ -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 }; diff --git a/shared-bindings/bleio/Peripheral.h b/shared-bindings/_bleio/Peripheral.h similarity index 97% rename from shared-bindings/bleio/Peripheral.h rename to shared-bindings/_bleio/Peripheral.h index a4bc9542b6..bc56a93389 100644 --- a/shared-bindings/bleio/Peripheral.h +++ b/shared-bindings/_bleio/Peripheral.h @@ -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; diff --git a/shared-bindings/bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c similarity index 92% rename from shared-bindings/bleio/ScanEntry.c rename to shared-bindings/_bleio/ScanEntry.c index 6eb02c7166..bec380d03f 100644 --- a/shared-bindings/bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -29,24 +29,24 @@ #include #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); diff --git a/shared-bindings/bleio/ScanEntry.h b/shared-bindings/_bleio/ScanEntry.h similarity index 97% rename from shared-bindings/bleio/ScanEntry.h rename to shared-bindings/_bleio/ScanEntry.h index 77e93175f9..8af1f050a8 100644 --- a/shared-bindings/bleio/ScanEntry.h +++ b/shared-bindings/_bleio/ScanEntry.h @@ -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; diff --git a/shared-bindings/bleio/Scanner.c b/shared-bindings/_bleio/Scanner.c similarity index 96% rename from shared-bindings/bleio/Scanner.c rename to shared-bindings/_bleio/Scanner.c index 269c42591d..94cec97529 100644 --- a/shared-bindings/bleio/Scanner.c +++ b/shared-bindings/_bleio/Scanner.c @@ -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 //| diff --git a/shared-bindings/bleio/Scanner.h b/shared-bindings/_bleio/Scanner.h similarity index 97% rename from shared-bindings/bleio/Scanner.h rename to shared-bindings/_bleio/Scanner.h index 3a0ce7eae4..cbaa778662 100644 --- a/shared-bindings/bleio/Scanner.h +++ b/shared-bindings/_bleio/Scanner.h @@ -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; diff --git a/shared-bindings/bleio/Service.c b/shared-bindings/_bleio/Service.c similarity index 97% rename from shared-bindings/bleio/Service.c rename to shared-bindings/_bleio/Service.c index f3bfebb7b1..da5633f2a3 100644 --- a/shared-bindings/bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -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 //| ========================================================= diff --git a/shared-bindings/bleio/Service.h b/shared-bindings/_bleio/Service.h similarity index 96% rename from shared-bindings/bleio/Service.h rename to shared-bindings/_bleio/Service.h index ce4e514176..e061bcffcb 100644 --- a/shared-bindings/bleio/Service.h +++ b/shared-bindings/_bleio/Service.h @@ -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; diff --git a/shared-bindings/bleio/UUID.c b/shared-bindings/_bleio/UUID.c similarity index 99% rename from shared-bindings/bleio/UUID.c rename to shared-bindings/_bleio/UUID.c index dca7ea0109..3c0889aad9 100644 --- a/shared-bindings/bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -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 //| ========================================================= diff --git a/shared-bindings/bleio/UUID.h b/shared-bindings/_bleio/UUID.h similarity index 98% rename from shared-bindings/bleio/UUID.h rename to shared-bindings/_bleio/UUID.h index caf039aecb..46ac54ff39 100644 --- a/shared-bindings/bleio/UUID.h +++ b/shared-bindings/_bleio/UUID.h @@ -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); diff --git a/shared-bindings/bleio/__init__.c b/shared-bindings/_bleio/__init__.c similarity index 74% rename from shared-bindings/bleio/__init__.c rename to shared-bindings/_bleio/__init__.c index 739f461a58..f207be8cfc 100644 --- a/shared-bindings/bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -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 `_ -//| 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 `_ +//| 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) }, diff --git a/shared-bindings/bleio/__init__.h b/shared-bindings/_bleio/__init__.h similarity index 94% rename from shared-bindings/bleio/__init__.h rename to shared-bindings/_bleio/__init__.h index c84895068c..67379ae2e1 100644 --- a/shared-bindings/bleio/__init__.h +++ b/shared-bindings/_bleio/__init__.h @@ -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; diff --git a/shared-module/bleio/Address.c b/shared-module/_bleio/Address.c similarity index 95% rename from shared-module/bleio/Address.c rename to shared-module/_bleio/Address.c index 6bc458b7cc..8c8b043fec 100644 --- a/shared-module/bleio/Address.c +++ b/shared-module/_bleio/Address.c @@ -28,8 +28,8 @@ #include #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); diff --git a/shared-module/bleio/Address.h b/shared-module/_bleio/Address.h similarity index 100% rename from shared-module/bleio/Address.h rename to shared-module/_bleio/Address.h diff --git a/shared-module/bleio/Attribute.c b/shared-module/_bleio/Attribute.c similarity index 97% rename from shared-module/bleio/Attribute.c rename to shared-module/_bleio/Attribute.c index 2275003c93..3acfcf1f53 100644 --- a/shared-module/bleio/Attribute.c +++ b/shared-module/_bleio/Attribute.c @@ -27,7 +27,7 @@ #include #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) { diff --git a/shared-module/bleio/Attribute.h b/shared-module/_bleio/Attribute.h similarity index 100% rename from shared-module/bleio/Attribute.h rename to shared-module/_bleio/Attribute.h diff --git a/shared-module/bleio/Characteristic.h b/shared-module/_bleio/Characteristic.h similarity index 100% rename from shared-module/bleio/Characteristic.h rename to shared-module/_bleio/Characteristic.h diff --git a/shared-module/bleio/ScanEntry.c b/shared-module/_bleio/ScanEntry.c similarity index 92% rename from shared-module/bleio/ScanEntry.c rename to shared-module/_bleio/ScanEntry.c index 306ac33c58..8dfa17f31f 100644 --- a/shared-module/bleio/ScanEntry.c +++ b/shared-module/_bleio/ScanEntry.c @@ -28,9 +28,9 @@ #include -#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); diff --git a/shared-module/bleio/ScanEntry.h b/shared-module/_bleio/ScanEntry.h similarity index 97% rename from shared-module/bleio/ScanEntry.h rename to shared-module/_bleio/ScanEntry.h index b302460e67..1e798d78fd 100644 --- a/shared-module/bleio/ScanEntry.h +++ b/shared-module/_bleio/ScanEntry.h @@ -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; From 318d704887cba04587657c75a8fa9862e22e41aa Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 29 Aug 2019 18:48:52 -0400 Subject: [PATCH 33/41] make translate --- locale/ID.po | 130 +++++++++++++++++++-------------------- locale/circuitpython.pot | 130 +++++++++++++++++++-------------------- locale/de_DE.po | 130 +++++++++++++++++++-------------------- locale/en_US.po | 130 +++++++++++++++++++-------------------- locale/en_x_pirate.po | 130 +++++++++++++++++++-------------------- locale/es.po | 130 +++++++++++++++++++-------------------- locale/fil.po | 130 +++++++++++++++++++-------------------- locale/fr.po | 130 +++++++++++++++++++-------------------- locale/it_IT.po | 130 +++++++++++++++++++-------------------- locale/pl.po | 130 +++++++++++++++++++-------------------- locale/pt_BR.po | 130 +++++++++++++++++++-------------------- locale/zh_Latn_pinyin.po | 130 +++++++++++++++++++-------------------- 12 files changed, 780 insertions(+), 780 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 8597714ef6..9c96fd3271 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,7 +52,7 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c #, fuzzy msgid "%q must be >= 1" @@ -218,12 +218,12 @@ msgstr "" msgid "A hardware interrupt channel is already in use" msgstr "Sebuah channel hardware interrupt sedang digunakan" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" msgstr "buffers harus mempunyai panjang yang sama" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -357,7 +357,7 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "DAC sudah digunakan" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." msgstr "buffers harus mempunyai panjang yang sama" @@ -375,7 +375,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -437,7 +437,7 @@ msgstr "tidak dapat mendapatkan ukuran scalar secara tidak ambigu" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -473,7 +473,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -507,7 +507,7 @@ msgstr "" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy msgid "Data too large for advertisement packet" msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment" @@ -545,25 +545,25 @@ msgstr "Error pada regex" msgid "Expected a %q" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -581,17 +581,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Gagal untuk menambahkan karakteristik, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Gagal untuk menambahkan layanan, status: 0x%08lX" @@ -606,66 +606,66 @@ msgstr "Gagal untuk mengalokasikan buffer RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to change softdevice state" msgstr "Gagal untuk merubah status softdevice, error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Gagal untuk melanjutkan scanning, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "Gagal untuk menemukan layanan, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get local address" msgstr "Gagal untuk mendapatkan alamat lokal, error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get softdevice state" msgstr "Gagal untuk mendapatkan status softdevice, error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, fuzzy, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Gagal untuk membaca nilai atribut, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Gagal untuk menulis nilai gatts, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Gagal untuk menambahkan Vendor Spesific UUID, status: 0x%08lX" @@ -675,47 +675,47 @@ msgstr "Gagal untuk menambahkan Vendor Spesific UUID, status: 0x%08lX" msgid "Failed to release mutex, err 0x%04x" msgstr "Gagal untuk melepaskan mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Gagal untuk memulai advertisement, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Gagal untuk melakukan scanning, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Gagal untuk menulis nilai atribut, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Gagal untuk menulis nilai gatts, status: 0x%08lX" @@ -862,7 +862,7 @@ msgstr "Pin-pin tidak valid" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -870,7 +870,7 @@ msgstr "" msgid "Invalid run mode." msgstr "" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -938,7 +938,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -996,9 +996,9 @@ msgstr "" msgid "No such file/directory" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "Not connected" msgstr "Tidak dapat menyambungkan ke AP" @@ -1157,7 +1157,7 @@ msgstr "" msgid "Slices not supported" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "Dukungan soft device, id: 0x%08lX, pc: 0x%08l" @@ -1272,15 +1272,15 @@ msgstr "" msgid "USB Error" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1311,7 +1311,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -1341,13 +1341,13 @@ msgstr "" msgid "Unsupported pull value." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1980,7 +1980,7 @@ msgstr "" msgid "integer required" msgstr "" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2102,8 +2102,8 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2153,7 +2153,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "name must be a string" msgstr "keyword harus berupa string" @@ -2208,7 +2208,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2228,7 +2228,7 @@ msgstr "non-keyword arg setelah */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg setelah keyword arg" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2538,7 +2538,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" msgstr "bits harus memilki nilai 8" @@ -2692,7 +2692,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ce2370af9f..272f081480 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,7 +52,7 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "" @@ -217,12 +217,12 @@ msgstr "" msgid "A hardware interrupt channel is already in use" msgstr "" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -353,7 +353,7 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "" @@ -370,7 +370,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -427,7 +427,7 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -463,7 +463,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -497,7 +497,7 @@ msgstr "" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "" @@ -534,25 +534,25 @@ msgstr "" msgid "Expected a %q" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -570,17 +570,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "" @@ -595,62 +595,62 @@ msgstr "" msgid "Failed to allocate RX buffer of %d bytes" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "" @@ -660,47 +660,47 @@ msgstr "" msgid "Failed to release mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "" @@ -847,7 +847,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -855,7 +855,7 @@ msgstr "" msgid "Invalid run mode." msgstr "" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -923,7 +923,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -981,9 +981,9 @@ msgstr "" msgid "No such file/directory" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "" @@ -1137,7 +1137,7 @@ msgstr "" msgid "Slices not supported" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1249,15 +1249,15 @@ msgstr "" msgid "USB Error" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1288,7 +1288,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -1317,13 +1317,13 @@ msgstr "" msgid "Unsupported pull value." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1946,7 +1946,7 @@ msgstr "" msgid "integer required" msgstr "" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2068,8 +2068,8 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2119,7 +2119,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "" @@ -2173,7 +2173,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2193,7 +2193,7 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2502,7 +2502,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" @@ -2655,7 +2655,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 25f9a97d06..071ec43ab2 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -54,7 +54,7 @@ msgstr "Der Index %q befindet sich außerhalb der Reihung" msgid "%q indices must be integers, not %s" msgstr "%q Indizes müssen ganze Zahlen sein, nicht %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "%q muss >= 1 sein" @@ -219,12 +219,12 @@ msgstr "3-arg pow() wird nicht unterstützt" msgid "A hardware interrupt channel is already in use" msgstr "Ein Hardware Interrupt Kanal wird schon benutzt" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "Die Adresse muss %d Bytes lang sein" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -357,7 +357,7 @@ msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" msgid "Bus pin %d is already in use" msgstr "Bus pin %d wird schon benutzt" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Der Puffer muss 16 Bytes lang sein" @@ -374,7 +374,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "Kann dotstar nicht mit %s verwenden" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -431,7 +431,7 @@ msgstr "sizeof scalar kann nicht eindeutig bestimmt werden" msgid "Cannot write without MOSI pin." msgstr "Kann nicht ohne MOSI-Pin schreiben." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Schreiben von CharacteristicBuffer ist nicht vorgesehen" @@ -467,7 +467,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "Konnte ble_uuid nicht decodieren. Status: 0x%04x" @@ -501,7 +501,7 @@ msgstr "Data 0 pin muss am Byte ausgerichtet sein" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "Zu vielen Daten für das advertisement packet" @@ -538,25 +538,25 @@ msgstr "Fehler in regex" msgid "Expected a %q" msgstr "Erwartet ein(e) %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Characteristic wird erwartet" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "Eine UUID wird erwartet" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -574,17 +574,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Hinzufügen des Characteristic ist gescheitert. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "Dienst konnte nicht hinzugefügt werden. Status: 0x%04x" @@ -599,62 +599,62 @@ msgstr "Konnte keinen RX Buffer allozieren" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Konnte keine RX Buffer mit %d allozieren" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "Fehler beim Ändern des Softdevice-Status" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Der Scanvorgang kann nicht fortgesetzt werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "Es konnten keine Dienste gefunden werden" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "Lokale Adresse konnte nicht abgerufen werden" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "Fehler beim Abrufen des Softdevice-Status" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Kann CCCD value nicht lesen. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "gatts value konnte nicht gelesen werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Kann keine herstellerspezifische UUID hinzufügen. Status: 0x%04x" @@ -664,47 +664,47 @@ msgstr "Kann keine herstellerspezifische UUID hinzufügen. Status: 0x%04x" msgid "Failed to release mutex, err 0x%04x" msgstr "Mutex konnte nicht freigegeben werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Kann advertisement nicht starten. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Der Scanvorgang kann nicht gestartet werden. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Kann advertisement nicht stoppen. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Kann den Attributwert nicht schreiben. Status: 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "gatts value konnte nicht geschrieben werden. Status: 0x%04x" @@ -853,7 +853,7 @@ msgstr "Ungültige Pins" msgid "Invalid polarity" msgstr "Ungültige Polarität" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -861,7 +861,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Ungültiger Ausführungsmodus" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -936,7 +936,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -994,9 +994,9 @@ msgstr "Kein Speicherplatz auf Gerät" msgid "No such file/directory" msgstr "Keine solche Datei/Verzeichnis" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "Nicht verbunden" @@ -1154,7 +1154,7 @@ msgstr "Slice und Wert (value) haben unterschiedliche Längen." msgid "Slices not supported" msgstr "Slices werden nicht unterstützt" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1278,15 +1278,15 @@ msgstr "USB beschäftigt" msgid "USB Error" msgstr "USB Fehler" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "UUID Zeichenfolge ist nicht 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "Der UUID-Wert ist kein str-, int- oder Byte-Puffer" @@ -1317,7 +1317,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Schreiben in nvm nicht möglich." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Unerwarteter nrfx uuid-Typ" @@ -1348,13 +1348,13 @@ msgstr "Nicht unterstützte Operation" msgid "Unsupported pull value." msgstr "Nicht unterstützter Pull-Wert" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1987,7 +1987,7 @@ msgstr "int() arg 2 muss >= 2 und <= 36 sein" msgid "integer required" msgstr "integer erforderlich" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2115,8 +2115,8 @@ msgstr "map buffer zu klein" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2166,7 +2166,7 @@ msgstr "muss Schlüsselwortargument für key function verwenden" msgid "name '%q' is not defined" msgstr "Name '%q' ist nirgends definiert worden (Schreibweise kontrollieren)" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "name muss ein String sein" @@ -2220,7 +2220,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2240,7 +2240,7 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "keine 128-bit UUID" @@ -2554,7 +2554,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout muss >= 0.0 sein" @@ -2711,7 +2711,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/en_US.po b/locale/en_US.po index 47de646bd2..e5425cbfc9 100644 --- a/locale/en_US.po +++ b/locale/en_US.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -52,7 +52,7 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "" @@ -217,12 +217,12 @@ msgstr "" msgid "A hardware interrupt channel is already in use" msgstr "" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -353,7 +353,7 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "" @@ -370,7 +370,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -427,7 +427,7 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -463,7 +463,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -497,7 +497,7 @@ msgstr "" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "" @@ -534,25 +534,25 @@ msgstr "" msgid "Expected a %q" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -570,17 +570,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "" @@ -595,62 +595,62 @@ msgstr "" msgid "Failed to allocate RX buffer of %d bytes" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "" @@ -660,47 +660,47 @@ msgstr "" msgid "Failed to release mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "" @@ -847,7 +847,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -855,7 +855,7 @@ msgstr "" msgid "Invalid run mode." msgstr "" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -923,7 +923,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -981,9 +981,9 @@ msgstr "" msgid "No such file/directory" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "" @@ -1137,7 +1137,7 @@ msgstr "" msgid "Slices not supported" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1249,15 +1249,15 @@ msgstr "" msgid "USB Error" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1288,7 +1288,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -1317,13 +1317,13 @@ msgstr "" msgid "Unsupported pull value." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1946,7 +1946,7 @@ msgstr "" msgid "integer required" msgstr "" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2068,8 +2068,8 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2119,7 +2119,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "" @@ -2173,7 +2173,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2193,7 +2193,7 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2502,7 +2502,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" @@ -2655,7 +2655,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index 6d5a136933..7db72248b6 100644 --- a/locale/en_x_pirate.po +++ b/locale/en_x_pirate.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -54,7 +54,7 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "" @@ -219,12 +219,12 @@ msgstr "" msgid "A hardware interrupt channel is already in use" msgstr "Avast! A hardware interrupt channel be used already" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -357,7 +357,7 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Belay that! Bus pin %d already be in use" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "" @@ -374,7 +374,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -431,7 +431,7 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -467,7 +467,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -501,7 +501,7 @@ msgstr "" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "" @@ -538,25 +538,25 @@ msgstr "" msgid "Expected a %q" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -574,17 +574,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "" @@ -599,62 +599,62 @@ msgstr "" msgid "Failed to allocate RX buffer of %d bytes" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "" @@ -664,47 +664,47 @@ msgstr "" msgid "Failed to release mutex, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "" @@ -851,7 +851,7 @@ msgstr "" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -859,7 +859,7 @@ msgstr "" msgid "Invalid run mode." msgstr "" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -927,7 +927,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -985,9 +985,9 @@ msgstr "" msgid "No such file/directory" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "" @@ -1141,7 +1141,7 @@ msgstr "" msgid "Slices not supported" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1253,15 +1253,15 @@ msgstr "" msgid "USB Error" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1292,7 +1292,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -1321,13 +1321,13 @@ msgstr "" msgid "Unsupported pull value." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1950,7 +1950,7 @@ msgstr "" msgid "integer required" msgstr "" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2072,8 +2072,8 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2123,7 +2123,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "" @@ -2177,7 +2177,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2197,7 +2197,7 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2506,7 +2506,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "" @@ -2659,7 +2659,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/es.po b/locale/es.po index 9569c478c2..bcb0515596 100644 --- a/locale/es.po +++ b/locale/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -54,7 +54,7 @@ msgstr "%q indice fuera de rango" msgid "%q indices must be integers, not %s" msgstr "%q indices deben ser enteros, no %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "%q debe ser >= 1" @@ -219,12 +219,12 @@ msgstr "pow() con 3 argumentos no soportado" msgid "A hardware interrupt channel is already in use" msgstr "El canal EXTINT ya está siendo utilizado" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "La dirección debe ser %d bytes de largo" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -361,7 +361,7 @@ msgstr "Buffer debe ser de longitud 1 como minimo" msgid "Bus pin %d is already in use" msgstr "Bus pin %d ya está siendo utilizado" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer debe de ser 16 bytes" @@ -378,7 +378,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "No se puede usar dotstar con %s" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -435,7 +435,7 @@ msgstr "No se puede obtener inequívocamente sizeof escalar" msgid "Cannot write without MOSI pin." msgstr "No se puede escribir sin pin MOSI." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharateristicBuffer escritura no proporcionada" @@ -471,7 +471,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "No se puede descodificar ble_uuid, err 0x%04x" @@ -505,7 +505,7 @@ msgstr "El pin Data 0 debe estar alineado a bytes" msgid "Data chunk must follow fmt chunk" msgstr "Trozo de datos debe seguir fmt chunk" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "Data es muy grande para el paquete de advertisement." @@ -542,25 +542,25 @@ msgstr "Error en regex" msgid "Expected a %q" msgstr "Se espera un %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Se esperaba una Característica." -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "Se esperaba un UUID" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -578,17 +578,17 @@ msgstr "Fallo enviando comando" msgid "Failed to acquire mutex, err 0x%04x" msgstr "No se puede adquirir el mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Fallo al añadir caracteristica, err: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "Fallo al agregar servicio. err: 0x%02x" @@ -603,63 +603,63 @@ msgstr "Ha fallado la asignación del buffer RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Falló la asignación del buffer RX de %d bytes" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "No se puede cambiar el estado del softdevice" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "No se puede iniciar el escaneo. err: 0x%02x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "No se puede descubrir servicios" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "No se puede obtener la dirección local" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "No se puede obtener el estado del softdevice" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "Error al notificar o indicar el valor del atributo, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "No se puede leer el valor del atributo. err 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, fuzzy, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "Error al leer valor del atributo, err 0x%04" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "No se puede escribir el valor del atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Fallo al registrar el Vendor-Specific UUID, err 0x%04x" @@ -669,47 +669,47 @@ msgstr "Fallo al registrar el Vendor-Specific UUID, err 0x%04x" msgid "Failed to release mutex, err 0x%04x" msgstr "No se puede liberar el mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "No se puede inicar el anuncio. err: 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "No se puede iniciar el escaneo. err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "No se puede detener el anuncio. err: 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "No se puede escribir el valor del atributo. err: 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "No se puede escribir el valor del atributo. err: 0x%04x" @@ -858,7 +858,7 @@ msgstr "pines inválidos" msgid "Invalid polarity" msgstr "Polaridad inválida" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -866,7 +866,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Modo de ejecución inválido." -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -938,7 +938,7 @@ msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" msgid "Must be a %q subclass." msgstr "Debe de ser una subclase de %q" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -996,9 +996,9 @@ msgstr "No queda espacio en el dispositivo" msgid "No such file/directory" msgstr "No existe el archivo/directorio" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "No conectado" @@ -1163,7 +1163,7 @@ msgstr "Slice y value tienen diferentes longitudes" msgid "Slices not supported" msgstr "Rebanadas no soportadas" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "Soft device assert, id: 0x%08lX, pc: 0x%08lX" @@ -1287,15 +1287,15 @@ msgstr "USB ocupado" msgid "USB Error" msgstr "Error USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "UUID string no es 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "UUID valor no es un str, int o byte buffer" @@ -1326,7 +1326,7 @@ msgstr "No se pudo leer los datos de la paleta de colores" msgid "Unable to write to nvm." msgstr "Imposible escribir en nvm" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Tipo de uuid nrfx inesperado" @@ -1356,13 +1356,13 @@ msgstr "Operación no soportada" msgid "Unsupported pull value." msgstr "valor pull no soportado." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -2000,7 +2000,7 @@ msgstr "int() arg 2 debe ser >= 2 y <= 36" msgid "integer required" msgstr "Entero requerido" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2125,8 +2125,8 @@ msgstr "map buffer muy pequeño" msgid "math domain error" msgstr "error de dominio matemático" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2176,7 +2176,7 @@ msgstr "debe utilizar argumento de palabra clave para la función clave" msgid "name '%q' is not defined" msgstr "name '%q' no esta definido" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "name debe de ser un string" @@ -2230,7 +2230,7 @@ msgstr "" msgid "no such attribute" msgstr "no hay tal atributo" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2252,7 +2252,7 @@ msgstr "" "no deberia estar/tener agumento por palabra clave despues de argumento por " "palabra clave" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "no es 128-bit UUID" @@ -2567,7 +2567,7 @@ msgstr "time.struct_time() acepta exactamente 1 argumento" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "timepo muerto >100 (unidades en segundos)" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "tiempo muerto debe ser >= 0.0" @@ -2720,7 +2720,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/fil.po b/locale/fil.po index 3f01e0b6cd..3e8041e6de 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy \n" "Language-Team: fil\n" @@ -52,7 +52,7 @@ msgstr "%q indeks wala sa sakop" msgid "%q indices must be integers, not %s" msgstr "%q indeks ay dapat integers, hindi %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c #, fuzzy msgid "%q must be >= 1" @@ -220,12 +220,12 @@ msgstr "3-arg pow() hindi suportado" msgid "A hardware interrupt channel is already in use" msgstr "Isang channel ng hardware interrupt ay ginagamit na" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" msgstr "ang palette ay dapat 32 bytes ang haba" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -359,7 +359,7 @@ msgstr "Buffer dapat ay hindi baba sa 1 na haba" msgid "Bus pin %d is already in use" msgstr "Ginagamit na ang DAC" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." msgstr "buffer ay dapat bytes-like object" @@ -377,7 +377,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -435,7 +435,7 @@ msgstr "Hindi puedeng hindi sigurado ang get sizeof scalar" msgid "Cannot write without MOSI pin." msgstr "Hindi maaring isulat kapag walang MOSI pin." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -472,7 +472,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -507,7 +507,7 @@ msgstr "graphic ay dapat 2048 bytes ang haba" msgid "Data chunk must follow fmt chunk" msgstr "Dapat sunurin ng Data chunk ang fmt chunk" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy msgid "Data too large for advertisement packet" msgstr "Hindi makasya ang data sa loob ng advertisement packet" @@ -546,27 +546,27 @@ msgstr "May pagkakamali sa REGEX" msgid "Expected a %q" msgstr "Umasa ng %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Hindi mabasa and Characteristic." -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c #, fuzzy msgid "Expected a UUID" msgstr "Umasa ng %q" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -584,17 +584,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Nabigo sa paglagay ng characteristic, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Hindi matagumpay ang paglagay ng service, status: 0x%08lX" @@ -609,66 +609,66 @@ msgstr "Nabigong ilaan ang RX buffer" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Nabigong ilaan ang RX buffer ng %d bytes" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to change softdevice state" msgstr "Nabigo sa pagbago ng softdevice state, error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Hindi maituloy ang pag scan, status: 0x%0xlX" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "Nabigo sa pagdiscover ng services, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get local address" msgstr "Nabigo sa pagkuha ng local na address, , error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get softdevice state" msgstr "Nabigo sa pagkuha ng softdevice state, error: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, fuzzy, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Hindi mabasa ang value ng attribute, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Hindi maisulat ang gatts value, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Hindi matagumpay ang paglagay ng Vender Specific UUID, status: 0x%08lX" @@ -678,47 +678,47 @@ msgstr "Hindi matagumpay ang paglagay ng Vender Specific UUID, status: 0x%08lX" msgid "Failed to release mutex, err 0x%04x" msgstr "Nabigo sa pagrelease ng mutex, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Hindi masimulaan ang advertisement, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Hindi mahinto ang advertisement, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Hindi maisulat ang attribute value, status: 0x%08lX" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Hindi maisulat ang gatts value, status: 0x%08lX" @@ -867,7 +867,7 @@ msgstr "Mali ang pins" msgid "Invalid polarity" msgstr "Mali ang polarity" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -875,7 +875,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Mali ang run mode." -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -947,7 +947,7 @@ msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -1005,9 +1005,9 @@ msgstr "" msgid "No such file/directory" msgstr "Walang file/directory" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "Not connected" msgstr "Hindi maka connect sa AP" @@ -1170,7 +1170,7 @@ msgstr "Slice at value iba't ibang haba." msgid "Slices not supported" msgstr "Hindi suportado ang Slices" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1292,15 +1292,15 @@ msgstr "Busy ang USB" msgid "USB Error" msgstr "May pagkakamali ang USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1331,7 +1331,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Hindi ma i-sulat sa NVM." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" msgstr "hindi inaasahang indent" @@ -1362,13 +1362,13 @@ msgstr "Hindi sinusuportahang operasyon" msgid "Unsupported pull value." msgstr "Hindi suportado ang pull value." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -2012,7 +2012,7 @@ msgstr "int() arg 2 ay dapat >=2 at <= 36" msgid "integer required" msgstr "kailangan ng int" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2138,8 +2138,8 @@ msgstr "masyadong maliit ang buffer map" msgid "math domain error" msgstr "may pagkakamali sa math domain" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2189,7 +2189,7 @@ msgstr "dapat gumamit ng keyword argument para sa key function" msgid "name '%q' is not defined" msgstr "name '%q' ay hindi defined" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "name must be a string" msgstr "ang keywords dapat strings" @@ -2244,7 +2244,7 @@ msgstr "" msgid "no such attribute" msgstr "walang ganoon na attribute" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2264,7 +2264,7 @@ msgstr "non-keyword arg sa huli ng */**" msgid "non-keyword arg after keyword arg" msgstr "non-keyword arg sa huli ng keyword arg" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2579,7 +2579,7 @@ msgstr "time.struct_time() kumukuha ng 1 argument" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "timeout >100 (units ay seconds, hindi na msecs)" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" msgstr "bits ay dapat walo (8)" @@ -2733,7 +2733,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 5c7d16d43e..f8345bcee7 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier \n" "Language-Team: fr\n" @@ -54,7 +54,7 @@ msgstr "index %q hors gamme" msgid "%q indices must be integers, not %s" msgstr "les indices %q doivent être des entiers, pas %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c #, fuzzy msgid "%q must be >= 1" @@ -221,12 +221,12 @@ msgstr "pow() non supporté avec 3 arguments" msgid "A hardware interrupt channel is already in use" msgstr "Un canal d'interruptions matérielles est déjà utilisé" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" msgstr "L'adresse doit être longue de %d octets" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -364,7 +364,7 @@ msgstr "Le tampon doit être de longueur au moins 1" msgid "Bus pin %d is already in use" msgstr "La broche %d du bus est déjà utilisée" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." msgstr "Le tampon d'octets doit être de 16 octets." @@ -382,7 +382,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "Impossible d'utiliser 'dotstar' avec %s" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -441,7 +441,7 @@ msgstr "Impossible d'obtenir la taille du scalaire sans ambigüité" msgid "Cannot write without MOSI pin." msgstr "Impossible d'écrire sans broche MOSI." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Ecriture sur 'CharacteristicBuffer' non fournie" @@ -478,7 +478,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "Impossible de décoder le 'ble_uuid', err 0x%04x" @@ -513,7 +513,7 @@ msgstr "La broche 'Data 0' doit être aligné sur l'octet" msgid "Data chunk must follow fmt chunk" msgstr "Un bloc de données doit suivre un bloc de format" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "Données trop volumineuses pour un paquet de diffusion" @@ -550,27 +550,27 @@ msgstr "Erreur dans l'expression régulière" msgid "Expected a %q" msgstr "Attendu un %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Une 'Characteristic' est attendue" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c #, fuzzy msgid "Expected a UUID" msgstr "Un UUID est attendu" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -588,17 +588,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Echec de l'obtention de mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Echec de l'ajout de caractéristique, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Echec de l'ajout de service, err 0x%04x" @@ -613,67 +613,67 @@ msgstr "Echec de l'allocation du tampon RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Echec de l'allocation de %d octets du tampon RX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to change softdevice state" msgstr "Echec de la modification de l'état du périphérique" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Impossible de poursuivre le scan, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "Echec de la découverte de services" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get local address" msgstr "Echec de l'obtention de l'adresse locale" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get softdevice state" msgstr "Echec de l'obtention de l'état du périphérique" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" "Impossible de notifier ou d'indiquer la valeur de l'attribut, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, fuzzy, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Impossible de lire la valeur 'CCCD', err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "Impossible de lire la valeur de l'attribut, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Impossible de lire la valeur de 'gatts', err 0x%04x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Echec de l'ajout de l'UUID du fournisseur, err 0x%04x" @@ -683,47 +683,47 @@ msgstr "Echec de l'ajout de l'UUID du fournisseur, err 0x%04x" msgid "Failed to release mutex, err 0x%04x" msgstr "Impossible de libérer mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Impossible de commencer à diffuser, err 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Impossible de commencer à scanner, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Echec de l'arrêt de diffusion, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Impossible d'écrire la valeur de l'attribut, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Impossible d'écrire la valeur de 'gatts', err 0x%04x" @@ -875,7 +875,7 @@ msgstr "Broches invalides" msgid "Invalid polarity" msgstr "Polarité invalide" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -883,7 +883,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Mode de lancement invalide." -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -956,7 +956,7 @@ msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -1014,9 +1014,9 @@ msgstr "Il n'y a plus d'espace libre sur le périphérique" msgid "No such file/directory" msgstr "Fichier/dossier introuvable" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "Not connected" msgstr "Non connecté" @@ -1186,7 +1186,7 @@ msgstr "Tranche et valeur de tailles différentes" msgid "Slices not supported" msgstr "Tranches non supportées" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "Assertion en mode 'soft-device', id: 0x%08lX, pc: 0x%08lX" @@ -1312,16 +1312,16 @@ msgstr "USB occupé" msgid "USB Error" msgstr "Erreur USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" "La chaîne UUID n'est pas au format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" "la valeur de l'UUID n'est pas une chaîne de caractères, un entier ou un " @@ -1354,7 +1354,7 @@ msgstr "Impossible de lire les données de la palette de couleurs" msgid "Unable to write to nvm." msgstr "Impossible d'écrire sur la mémoire non-volatile." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" msgstr "Type inattendu pour l'uuid nrfx" @@ -1386,13 +1386,13 @@ msgstr "Opération non supportée" msgid "Unsupported pull value." msgstr "Valeur de tirage 'pull' non supportée." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -2044,7 +2044,7 @@ msgstr "l'argument 2 de int() doit être >=2 et <=36" msgid "integer required" msgstr "entier requis" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2170,8 +2170,8 @@ msgstr "tampon trop petit" msgid "math domain error" msgstr "erreur de domaine math" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2221,7 +2221,7 @@ msgstr "doit utiliser un argument nommé pour une fonction key" msgid "name '%q' is not defined" msgstr "nom '%q' non défini" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "name must be a string" msgstr "les noms doivent être des chaînes de caractère" @@ -2277,7 +2277,7 @@ msgstr "" msgid "no such attribute" msgstr "pas de tel attribut" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2298,7 +2298,7 @@ msgstr "argument non-nommé après */**" msgid "non-keyword arg after keyword arg" msgstr "argument non-nommé après argument nommé" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "n'est pas un UUID 128 bits" @@ -2620,7 +2620,7 @@ msgstr "time.struct_time() prend exactement 1 argument" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "timeout >100 (exprimé en secondes, pas en ms)" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" msgstr "'timeout' doit être >=0.0" @@ -2775,7 +2775,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "'value_count' doit être > 0" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index e7b14ef6b1..1b48a73066 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin \n" "Language-Team: \n" @@ -52,7 +52,7 @@ msgstr "indice %q fuori intervallo" msgid "%q indices must be integers, not %s" msgstr "gli indici %q devono essere interi, non %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c #, fuzzy msgid "%q must be >= 1" @@ -219,12 +219,12 @@ msgstr "pow() con tre argmomenti non supportata" msgid "A hardware interrupt channel is already in use" msgstr "Un canale di interrupt hardware è già in uso" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" msgstr "la palette deve essere lunga 32 byte" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -359,7 +359,7 @@ msgstr "Il buffer deve essere lungo almeno 1" msgid "Bus pin %d is already in use" msgstr "DAC già in uso" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." msgstr "i buffer devono essere della stessa lunghezza" @@ -377,7 +377,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "dotstar non può essere usato con %s" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -436,7 +436,7 @@ msgstr "Impossibile ricavare la grandezza scalare di sizeof inequivocabilmente" msgid "Cannot write without MOSI pin." msgstr "Impossibile scrivere senza pin MOSI." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharacteristicBuffer scritura non dato" @@ -473,7 +473,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -508,7 +508,7 @@ msgstr "graphic deve essere lunga 2048 byte" msgid "Data chunk must follow fmt chunk" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy msgid "Data too large for advertisement packet" msgstr "Impossibile inserire dati nel pacchetto di advertisement." @@ -546,27 +546,27 @@ msgstr "Errore nella regex" msgid "Expected a %q" msgstr "Atteso un %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Non è possibile aggiungere Characteristic." -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c #, fuzzy msgid "Expected a UUID" msgstr "Atteso un %q" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -584,17 +584,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" @@ -609,65 +609,65 @@ msgstr "Impossibile allocare buffer RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Fallita allocazione del buffer RX di %d byte" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to change softdevice state" msgstr "Impossibile fermare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Impossible iniziare la scansione. status: 0x%02x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "Impossibile fermare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get softdevice state" msgstr "Impossibile fermare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "Notificamento o indicazione di attribute value fallito, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, fuzzy, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "Tentative leggere attribute value fallito, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Non è possibile aggiungere l'UUID del vendor specifico da 128-bit" @@ -677,47 +677,47 @@ msgstr "Non è possibile aggiungere l'UUID del vendor specifico da 128-bit" msgid "Failed to release mutex, err 0x%04x" msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Impossibile avviare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Impossible iniziare la scansione. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Impossibile fermare advertisement. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x" @@ -868,7 +868,7 @@ msgstr "Pin non validi" msgid "Invalid polarity" msgstr "Polarità non valida" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -876,7 +876,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Modalità di esecuzione non valida." -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -946,7 +946,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -1004,9 +1004,9 @@ msgstr "Non che spazio sul dispositivo" msgid "No such file/directory" msgstr "Nessun file/directory esistente" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "Not connected" msgstr "Impossible connettersi all'AP" @@ -1176,7 +1176,7 @@ msgstr "" msgid "Slices not supported" msgstr "Slice non supportate" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1291,15 +1291,15 @@ msgstr "USB occupata" msgid "USB Error" msgstr "Errore USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1330,7 +1330,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Imposibile scrivere su nvm." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy msgid "Unexpected nrfx uuid type" msgstr "indentazione inaspettata" @@ -1361,13 +1361,13 @@ msgstr "Operazione non supportata" msgid "Unsupported pull value." msgstr "Valore di pull non supportato." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -2004,7 +2004,7 @@ msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36" msgid "integer required" msgstr "intero richiesto" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2131,8 +2131,8 @@ msgstr "map buffer troppo piccolo" msgid "math domain error" msgstr "errore di dominio matematico" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2182,7 +2182,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "nome '%q'non definito" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "name must be a string" msgstr "argomenti nominati devono essere stringhe" @@ -2238,7 +2238,7 @@ msgstr "" msgid "no such attribute" msgstr "attributo inesistente" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2258,7 +2258,7 @@ msgstr "argomento non nominato dopo */**" msgid "non-keyword arg after keyword arg" msgstr "argomento non nominato seguito da argomento nominato" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2577,7 +2577,7 @@ msgstr "time.struct_time() prende esattamente un argomento" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" msgstr "i bit devono essere 8" @@ -2731,7 +2731,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index 00170cb3fc..c1444c1dd9 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2019-03-19 18:37-0700\n" "Last-Translator: Radomir Dopieralski \n" "Language-Team: pl\n" @@ -53,7 +53,7 @@ msgstr "%q poza zakresem" msgid "%q indices must be integers, not %s" msgstr "%q indeks musi być liczbą całkowitą, a nie %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "%q musi być >= 1" @@ -218,12 +218,12 @@ msgstr "3-argumentowy pow() jest niewspierany" msgid "A hardware interrupt channel is already in use" msgstr "Kanał przerwań sprzętowych w użyciu" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "Adres musi mieć %d bajtów" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -356,7 +356,7 @@ msgstr "Bufor musi mieć długość 1 lub więcej" msgid "Bus pin %d is already in use" msgstr "Nóżka magistrali %d jest w użyciu" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Bufor musi mieć 16 bajtów." @@ -373,7 +373,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "Nie można używać dotstar z %s" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -430,7 +430,7 @@ msgstr "Wielkość skalara jest niejednoznaczna" msgid "Cannot write without MOSI pin." msgstr "Nie można pisać bez nóżki MOSI." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Pisanie do CharacteristicBuffer niewspierane" @@ -466,7 +466,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "Nie można zdekodować ble_uuid, błąd 0x%04x" @@ -500,7 +500,7 @@ msgstr "Nóżka data 0 musi być wyrównana do bajtu" msgid "Data chunk must follow fmt chunk" msgstr "Fragment danych musi następować po fragmencie fmt" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "Zbyt dużo danych pakietu rozgłoszeniowego" @@ -537,25 +537,25 @@ msgstr "Błąd w regex" msgid "Expected a %q" msgstr "Oczekiwano %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Oczekiwano charakterystyki" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "Oczekiwano UUID" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -573,17 +573,17 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nie udało się uzyskać blokady, błąd 0x$04x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Nie udało się dodać charakterystyki, błąd 0x$04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "Nie udało się dodać serwisu, błąd 0x%04x" @@ -598,62 +598,62 @@ msgstr "Nie udała się alokacja bufora RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Nie udała się alokacja %d bajtów na bufor RX" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "Nie udało się zmienić stanu softdevice" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Nie udała się kontynuacja skanowania, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "Nie udało się odkryć serwisów" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "Nie udało się uzyskać lokalnego adresu" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "Nie udało się odczytać stanu softdevice" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "Nie udało się powiadomić o wartości atrybutu, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Nie udało się odczytać CCCD, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "Nie udało się odczytać wartości atrybutu, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Nie udało się odczytać gatts, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Nie udało się zarejestrować UUID dostawcy, błąd 0x%04x" @@ -663,47 +663,47 @@ msgstr "Nie udało się zarejestrować UUID dostawcy, błąd 0x%04x" msgid "Failed to release mutex, err 0x%04x" msgstr "Nie udało się zwolnić blokady, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Nie udało się rozpocząć rozgłaszania, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Nie udało się rozpocząć skanowania, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Nie udało się zatrzymać rozgłaszania, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Nie udało się zapisać atrybutu, błąd 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Nie udało się zapisać gatts, błąd 0x%04x" @@ -852,7 +852,7 @@ msgstr "Złe nóżki" msgid "Invalid polarity" msgstr "Zła polaryzacja" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -860,7 +860,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Zły tryb uruchomienia" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -933,7 +933,7 @@ msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -991,9 +991,9 @@ msgstr "Brak miejsca" msgid "No such file/directory" msgstr "Brak pliku/katalogu" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "Nie podłączono" @@ -1147,7 +1147,7 @@ msgstr "Fragment i wartość są różnych długości." msgid "Slices not supported" msgstr "Fragmenty nieobsługiwane" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "Soft device assert, id: 0x%08lX, pc: 0x%08lX" @@ -1269,15 +1269,15 @@ msgstr "USB Zajęte" msgid "USB Error" msgstr "Błąd USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "UUID inny, niż `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "UUID nie jest typu str, int lub bytes" @@ -1308,7 +1308,7 @@ msgstr "Nie można odczytać danych palety" msgid "Unable to write to nvm." msgstr "Błąd zapisu do NVM." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Nieoczekiwany typ nrfx uuid." @@ -1337,13 +1337,13 @@ msgstr "Zła operacja" msgid "Unsupported pull value." msgstr "Zła wartość podciągnięcia." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1971,7 +1971,7 @@ msgstr "argument 2 do int() busi być pomiędzy 2 a 36" msgid "integer required" msgstr "wymagana liczba całkowita" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2093,8 +2093,8 @@ msgstr "bufor mapy zbyt mały" msgid "math domain error" msgstr "błąd domeny" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2144,7 +2144,7 @@ msgstr "funkcja key musi być podana jako argument nazwany" msgid "name '%q' is not defined" msgstr "nazwa '%q' niezdefiniowana" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "nazwa musi być łańcuchem" @@ -2198,7 +2198,7 @@ msgstr "" msgid "no such attribute" msgstr "nie ma takiego atrybutu" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2218,7 +2218,7 @@ msgstr "argument nienazwany po */**" msgid "non-keyword arg after keyword arg" msgstr "argument nienazwany po nazwanym" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "to nie jest 128-bitowy UUID" @@ -2529,7 +2529,7 @@ msgstr "time.struct_time() wymaga jednego argumentu" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "timeout > 100 (jednostkami są sekundy)" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "timeout musi być >= 0.0" @@ -2682,7 +2682,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "value_count musi być > 0" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index bf55570dbd..a697947d99 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -52,7 +52,7 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c #, fuzzy msgid "%q must be >= 1" @@ -219,12 +219,12 @@ msgstr "" msgid "A hardware interrupt channel is already in use" msgstr "Um canal de interrupção de hardware já está em uso" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" msgstr "buffers devem ser o mesmo tamanho" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -356,7 +356,7 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "DAC em uso" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." msgstr "buffers devem ser o mesmo tamanho" @@ -374,7 +374,7 @@ msgstr "" msgid "Can not use dotstar with %s" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -432,7 +432,7 @@ msgstr "" msgid "Cannot write without MOSI pin." msgstr "Não é possível ler sem um pino MOSI" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "" @@ -469,7 +469,7 @@ msgstr "" msgid "Corrupt raw code" msgstr "" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "" @@ -503,7 +503,7 @@ msgstr "" msgid "Data chunk must follow fmt chunk" msgstr "Pedaço de dados deve seguir o pedaço de cortes" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy msgid "Data too large for advertisement packet" msgstr "Não é possível ajustar dados no pacote de anúncios." @@ -541,27 +541,27 @@ msgstr "Erro no regex" msgid "Expected a %q" msgstr "Esperado um" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c #, fuzzy msgid "Expected a Characteristic" msgstr "Não é possível adicionar Característica." -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c #, fuzzy msgid "Expected a UUID" msgstr "Esperado um" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "" @@ -579,17 +579,17 @@ msgstr "Falha ao enviar comando." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Não é possível ler o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, fuzzy, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to add service, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" @@ -604,65 +604,65 @@ msgstr "Falha ao alocar buffer RX" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Falha ao alocar buffer RX de %d bytes" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to change softdevice state" msgstr "Não pode parar propaganda. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Não é possível iniciar o anúncio. status: 0x%02x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy msgid "Failed to discover services" msgstr "Não pode parar propaganda. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, fuzzy msgid "Failed to get softdevice state" msgstr "Não pode parar propaganda. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, fuzzy, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Não é possível ler o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Não é possível gravar o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, fuzzy, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Não é possível adicionar o UUID de 128 bits específico do fornecedor." @@ -672,47 +672,47 @@ msgstr "Não é possível adicionar o UUID de 128 bits específico do fornecedor msgid "Failed to release mutex, err 0x%04x" msgstr "Não é possível ler o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Não é possível iniciar o anúncio. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, fuzzy, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Não é possível iniciar o anúncio. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, fuzzy, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Não pode parar propaganda. status: 0x%02x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Não é possível gravar o valor do atributo. status: 0x%02x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, fuzzy, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Não é possível gravar o valor do atributo. status: 0x%02x" @@ -861,7 +861,7 @@ msgstr "Pinos inválidos" msgid "Invalid polarity" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -869,7 +869,7 @@ msgstr "" msgid "Invalid run mode." msgstr "" -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -938,7 +938,7 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -996,9 +996,9 @@ msgstr "" msgid "No such file/directory" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "Not connected" msgstr "Não é possível conectar-se ao AP" @@ -1157,7 +1157,7 @@ msgstr "" msgid "Slices not supported" msgstr "" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "" @@ -1269,15 +1269,15 @@ msgstr "USB ocupada" msgid "USB Error" msgstr "Erro na USB" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "" @@ -1308,7 +1308,7 @@ msgstr "" msgid "Unable to write to nvm." msgstr "Não é possível gravar no nvm." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "" @@ -1338,13 +1338,13 @@ msgstr "" msgid "Unsupported pull value." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1971,7 +1971,7 @@ msgstr "" msgid "integer required" msgstr "inteiro requerido" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "" @@ -2093,8 +2093,8 @@ msgstr "" msgid "math domain error" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2144,7 +2144,7 @@ msgstr "" msgid "name '%q' is not defined" msgstr "" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c #, fuzzy msgid "name must be a string" msgstr "heap deve ser uma lista" @@ -2199,7 +2199,7 @@ msgstr "" msgid "no such attribute" msgstr "" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2219,7 +2219,7 @@ msgstr "" msgid "non-keyword arg after keyword arg" msgstr "" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "" @@ -2530,7 +2530,7 @@ msgstr "" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #, fuzzy msgid "timeout must be >= 0.0" msgstr "bits devem ser 8" @@ -2684,7 +2684,7 @@ msgstr "" msgid "value_count must be > 0" msgstr "" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 16f4ecf2ce..67a8f5d71a 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-29 14:16-0400\n" +"POT-Creation-Date: 2019-08-29 18:48-0400\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -54,7 +54,7 @@ msgstr "%q suǒyǐn chāochū fànwéi" msgid "%q indices must be integers, not %s" msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/displayio/Group.c shared-bindings/displayio/Shape.c msgid "%q must be >= 1" msgstr "%q bìxū dàyú huò děngyú 1" @@ -219,12 +219,12 @@ msgstr "bù zhīchí 3-arg pow ()" msgid "A hardware interrupt channel is already in use" msgstr "Yìngjiàn zhōngduàn tōngdào yǐ zài shǐyòng zhōng" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c #, c-format msgid "Address must be %d bytes long" msgstr "Dìzhǐ bìxū shì %d zì jié zhǎng" -#: shared-bindings/bleio/Address.c +#: shared-bindings/_bleio/Address.c msgid "Address type out of range" msgstr "" @@ -357,7 +357,7 @@ msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1" msgid "Bus pin %d is already in use" msgstr "Zǒngxiàn yǐn jiǎo %d yǐ zài shǐyòng zhōng" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Zì jié huǎnchōng qū bìxū shì 16 zì jié." @@ -374,7 +374,7 @@ msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__() msgid "Can not use dotstar with %s" msgstr "Wúfǎ yǔ dotstar yīqǐ shǐyòng %s" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" msgstr "" @@ -431,7 +431,7 @@ msgstr "Wúfǎ míngquè de huòdé biāoliàng de dàxiǎo" msgid "Cannot write without MOSI pin." msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Wèi tígōng zìfú huǎncún xiě rù" @@ -467,7 +467,7 @@ msgstr "Fǔbài de .mpy wénjiàn" msgid "Corrupt raw code" msgstr "Sǔnhuài de yuánshǐ dàimǎ" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Could not decode ble_uuid, err 0x%04x" msgstr "Wúfǎ jiěmǎ kě dú_uuid, err 0x%04x" @@ -501,7 +501,7 @@ msgstr "Shùjù 0 de yǐn jiǎo bìxū shì zì jié duìqí" msgid "Data chunk must follow fmt chunk" msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Data too large for advertisement packet" msgstr "Guǎnggào bāo de shùjù tài dà" @@ -538,25 +538,25 @@ msgstr "Zhèngzé biǎodá shì cuòwù" msgid "Expected a %q" msgstr "Yùqí %q" -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Descriptor.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Descriptor.c msgid "Expected a Characteristic" msgstr "Yùqí de tèdiǎn" -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" msgstr "" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" msgstr "" -#: shared-bindings/bleio/Characteristic.c shared-bindings/bleio/Descriptor.c -#: shared-bindings/bleio/Service.c +#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c +#: shared-bindings/_bleio/Service.c msgid "Expected a UUID" msgstr "Yùqí UUID" -#: shared-bindings/bleio/Central.c +#: shared-bindings/_bleio/Central.c msgid "Expected an Address" msgstr "Qídài yīgè dìzhǐ" @@ -574,17 +574,17 @@ msgstr "Fāsòng mìnglìng shībài." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Wúfǎ huòdé mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Service.c +#: ports/nrf/common-hal/_bleio/Service.c #, c-format msgid "Failed to add characteristic, err 0x%04x" msgstr "Tiānjiā tèxìng shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to add service, err 0x%04x" msgstr "Tiānjiā fúwù shībài, err 0x%04x" @@ -599,62 +599,62 @@ msgstr "Fēnpèi RX huǎnchōng shībài" msgid "Failed to allocate RX buffer of %d bytes" msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to change softdevice state" msgstr "Gēnggǎi ruǎn shèbèi zhuàngtài shībài" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to configure advertising, err 0x%04x" msgstr "Wúfǎ pèizhì guǎnggào, cuòwù 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c msgid "Failed to connect: timeout" msgstr "Liánjiē shībài: Chāoshí" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to continue scanning, err 0x%04x" msgstr "Jìxù sǎomiáo shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "Failed to discover services" msgstr "Fāxiàn fúwù shībài" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get local address" msgstr "Huòqǔ běndì dìzhǐ shībài" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to get softdevice state" msgstr "Wúfǎ huòdé ruǎnjiàn shèbèi zhuàngtài" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to notify or indicate attribute value, err 0x%04x" msgstr "Wúfǎ tōngzhī huò xiǎnshì shǔxìng zhí, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to read CCCD value, err 0x%04x" msgstr "Dòu qǔ CCCD zhí, err 0x%04x shībài" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "Failed to read attribute value, err 0x%04x" msgstr "Dòu qǔ shǔxìng zhí shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to read gatts value, err 0x%04x" msgstr "Wúfǎ dòu qǔ gatts zhí, err 0x%04x" -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c #, c-format msgid "Failed to register Vendor-Specific UUID, err 0x%04x" msgstr "Wúfǎ zhùcè màizhǔ tèdìng de UUID, err 0x%04x" @@ -664,47 +664,47 @@ msgstr "Wúfǎ zhùcè màizhǔ tèdìng de UUID, err 0x%04x" msgid "Failed to release mutex, err 0x%04x" msgstr "Wúfǎ shìfàng mutex, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to set device name, err 0x%04x" msgstr "Wúfǎ shèzhì shèbèi míngchēng, cuòwù 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start advertising, err 0x%04x" msgstr "Qǐdòng guǎnggào shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/Central.c +#: ports/nrf/common-hal/_bleio/Central.c #, c-format msgid "Failed to start connecting, error 0x%04x" msgstr "Wúfǎ kāishǐ liánjiē, cuòwù 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" msgstr "" -#: ports/nrf/common-hal/bleio/Scanner.c +#: ports/nrf/common-hal/_bleio/Scanner.c #, c-format msgid "Failed to start scanning, err 0x%04x" msgstr "Qǐdòng sǎomiáo shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to stop advertising, err 0x%04x" msgstr "Wúfǎ tíngzhǐ guǎnggào, err 0x%04x" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to write CCCD, err 0x%04x" msgstr "Wúfǎ xiě rù CCCD, cuòwù 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write attribute value, err 0x%04x" msgstr "Xiě rù shǔxìng zhí shībài, err 0x%04x" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Failed to write gatts value, err 0x%04x" msgstr "Xiě rù gatts zhí,err 0x%04x shībài" @@ -853,7 +853,7 @@ msgstr "Wúxiào de yǐn jiǎo" msgid "Invalid polarity" msgstr "Wúxiào liǎng jí zhí" -#: shared-bindings/bleio/Characteristic.c +#: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" msgstr "" @@ -861,7 +861,7 @@ msgstr "" msgid "Invalid run mode." msgstr "Wúxiào de yùnxíng móshì." -#: shared-module/bleio/Attribute.c +#: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" msgstr "" @@ -933,7 +933,7 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi msgid "Must be a %q subclass." msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" msgstr "" @@ -991,9 +991,9 @@ msgstr "Shèbèi shàng méiyǒu kònggé" msgid "No such file/directory" msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù" -#: ports/nrf/common-hal/bleio/__init__.c shared-bindings/bleio/Central.c -#: shared-bindings/bleio/CharacteristicBuffer.c -#: shared-bindings/bleio/Peripheral.c +#: ports/nrf/common-hal/_bleio/__init__.c shared-bindings/_bleio/Central.c +#: shared-bindings/_bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/Peripheral.c msgid "Not connected" msgstr "Wèi liánjiē" @@ -1151,7 +1151,7 @@ msgstr "Qiēpiàn hé zhí bùtóng chángdù." msgid "Slices not supported" msgstr "Qiēpiàn bù shòu zhīchí" -#: ports/nrf/common-hal/bleio/Adapter.c +#: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX" msgstr "Ruǎn shèbèi wéihù, id: 0X%08lX, pc: 0X%08lX" @@ -1275,15 +1275,15 @@ msgstr "USB máng" msgid "USB Error" msgstr "USB Cuòwù" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" msgstr "UUID zhěngshù zhí bìxū wèi 0-0xffff" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgstr "UUID Zìfú chuàn bùshì 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" msgstr "UUID zhí bùshì str,int huò zì jié huǎnchōng qū" @@ -1314,7 +1314,7 @@ msgstr "Wúfǎ dòu qǔ sè tiáo shùjù" msgid "Unable to write to nvm." msgstr "Wúfǎ xiě rù nvm." -#: ports/nrf/common-hal/bleio/UUID.c +#: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" msgstr "Yìwài de nrfx uuid lèixíng" @@ -1343,13 +1343,13 @@ msgstr "Bù zhīchí de cāozuò" msgid "Unsupported pull value." msgstr "Bù zhīchí de lādòng zhí." -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" msgstr "" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" msgstr "" @@ -1982,7 +1982,7 @@ msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" msgid "integer required" msgstr "xūyào zhěngshù" -#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Peripheral.c shared-bindings/_bleio/Scanner.c #, c-format msgid "interval must be in range %s-%s" msgstr "Jiàngé bìxū zài %s-%s fànwéi nèi" @@ -2105,8 +2105,8 @@ msgstr "dìtú huǎnchōng qū tài xiǎo" msgid "math domain error" msgstr "shùxué yù cuòwù" -#: ports/nrf/common-hal/bleio/Characteristic.c -#: ports/nrf/common-hal/bleio/Descriptor.c +#: ports/nrf/common-hal/_bleio/Characteristic.c +#: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" @@ -2156,7 +2156,7 @@ msgstr "bìxū shǐyòng guānjiàn cí cānshù" msgid "name '%q' is not defined" msgstr "míngchēng '%q' wèi dìngyì" -#: shared-bindings/bleio/Peripheral.c +#: shared-bindings/_bleio/Peripheral.c msgid "name must be a string" msgstr "míngchēng bìxū shì yīgè zìfú chuàn" @@ -2211,7 +2211,7 @@ msgstr "" msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" -#: ports/nrf/common-hal/bleio/__init__.c +#: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -2231,7 +2231,7 @@ msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" msgid "non-keyword arg after keyword arg" msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" -#: shared-bindings/bleio/UUID.c +#: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" msgstr "bùshì 128 wèi UUID" @@ -2542,7 +2542,7 @@ msgstr "time.struct_time() xūyào wánquán 1 cānshù" msgid "timeout >100 (units are now seconds, not msecs)" msgstr "chāoshí >100 (dānwèi shì miǎo, ér bùshì háomiǎo)" -#: shared-bindings/bleio/CharacteristicBuffer.c +#: shared-bindings/_bleio/CharacteristicBuffer.c msgid "timeout must be >= 0.0" msgstr "chāoshí bìxū shì >= 0.0" @@ -2695,7 +2695,7 @@ msgstr "Zhí bìxū fúhé %d zì jié" msgid "value_count must be > 0" msgstr "zhí jìshù bìxū wèi > 0" -#: shared-bindings/bleio/Scanner.c +#: shared-bindings/_bleio/Scanner.c msgid "window must be <= interval" msgstr "Chuāngkǒu bìxū shì <= jiàngé" From 4b97ec9d231d6049f72d1598032ec11e389bbc3a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 2 Sep 2019 10:25:38 -0400 Subject: [PATCH 34/41] Merge in 4.x status dotstar fix --- supervisor/shared/rgb_led_status.c | 31 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 9f233defa1..fd356cb48f 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -39,7 +39,10 @@ static digitalio_digitalinout_obj_t status_neopixel; #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) uint8_t rgb_status_brightness = 255; -static uint8_t status_apa102_color[12] = {0, 0, 0, 0, 0xff, 0, 0, 0}; + +#define APA102_BUFFER_LENGTH 12 +static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0, 0, 0, 0xff, 0xff, 0xff, 0xff}; + #if CIRCUITPY_BITBANG_APA102 #include "shared-bindings/bitbangio/SPI.h" #include "shared-module/bitbangio/types.h" @@ -104,10 +107,12 @@ void rgb_led_status_init() { apa102_sck_in_use = false; #if CIRCUITPY_BITBANG_APA102 shared_module_bitbangio_spi_try_lock(&status_apa102); - shared_module_bitbangio_spi_configure(&status_apa102, 100000, 0, 1, 8); + // Use 1MHz for clock rate. Some APA102's are spec'd 800kHz-1200kHz, + // though many can run much faster. bitbang will probably run slower. + shared_module_bitbangio_spi_configure(&status_apa102, 1000000, 0, 0, 8); #else common_hal_busio_spi_try_lock(&status_apa102); - common_hal_busio_spi_configure(&status_apa102, 100000, 0, 1, 8); + common_hal_busio_spi_configure(&status_apa102, 1000000, 0, 0, 8); #endif #endif @@ -120,7 +125,7 @@ void rgb_led_status_init() { common_hal_pulseio_pwmout_never_reset(&rgb_status_r); } } - + if (common_hal_mcu_pin_is_free(CP_RGB_STATUS_G)) { pwmout_result_t green_result = common_hal_pulseio_pwmout_construct(&rgb_status_g, CP_RGB_STATUS_G, 0, 50000, false); @@ -186,9 +191,9 @@ void new_status_color(uint32_t rgb) { status_apa102_color[7] = (rgb_adjusted >> 16) & 0xff; #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8); + shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); #else - common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8); + common_hal_busio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); #endif #endif @@ -229,20 +234,20 @@ void temp_status_color(uint32_t rgb) { if (apa102_mosi_in_use || apa102_sck_in_use) { return; } - uint8_t colors[12] = {0, 0, 0, 0, 0xff, rgb_adjusted & 0xff, (rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, 0x0, 0x0, 0x0, 0x0}; + uint8_t colors[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, rgb_adjusted & 0xff, (rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, 0xff, 0xff, 0xff, 0xff}; #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, colors, 12); + shared_module_bitbangio_spi_write(&status_apa102, colors, APA102_BUFFER_LENGTH); #else - common_hal_busio_spi_write(&status_apa102, colors, 12); + common_hal_busio_spi_write(&status_apa102, colors, APA102_BUFFER_LENGTH); #endif #endif #if defined(CP_RGB_STATUS_LED) uint8_t red_u8 = (rgb_adjusted >> 16) & 0xFF; uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; uint8_t blue_u8 = rgb_adjusted & 0xFF; - + uint16_t temp_status_color_rgb[3] = {0}; - + #if defined(CP_RGB_STATUS_INVERTED_PWM) temp_status_color_rgb[0] = (1 << 16) - 1 - ((uint16_t) (red_u8 << 8) + red_u8); temp_status_color_rgb[1] = (1 << 16) - 1 - ((uint16_t) (green_u8 << 8) + green_u8); @@ -265,9 +270,9 @@ void clear_temp_status() { #endif #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) #if CIRCUITPY_BITBANG_APA102 - shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8); + shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); #else - common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8); + common_hal_busio_spi_write(&status_apa102, status_apa102_color, APA102_BUFFER_LENGTH); #endif #endif #if defined(CP_RGB_STATUS_LED) From 12c97b42a47750da04c017554fef3c40575dde3f Mon Sep 17 00:00:00 2001 From: arturo182 Date: Mon, 2 Sep 2019 23:19:47 +0200 Subject: [PATCH 35/41] Add GD25Q32C flash device definition --- supervisor/shared/external_flash/devices.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 5b8f9b298d..4c3764d052 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -103,6 +103,24 @@ typedef struct { .single_status_byte = false, \ } +// Settings for the Gigadevice GD25Q32C 4MiB SPI flash. +// Datasheet: http://www.elm-tech.com/en/products/spi-flash-memory/gd25q32/gd25q32.pdf +#define GD25Q32C {\ + .total_size = (1 << 22), /* 4 MiB */ \ + .start_up_time_us = 5000, \ + .manufacturer_id = 0xc8, \ + .memory_type = 0x40, \ + .capacity = 0x16, \ + .max_clock_speed_mhz = 104, /* if we need 120 then we can turn on high performance mode */ \ + .quad_enable_bit_mask = 0x02, \ + .has_sector_protection = false, \ + .supports_fast_read = true, \ + .supports_qspi = true, \ + .supports_qspi_writes = true, \ + .write_status_register_split = true, \ + .single_status_byte = false, \ +} + // Settings for the Gigadevice GD25Q64C 8MiB SPI flash. // Datasheet: http://www.elm-tech.com/en/products/spi-flash-memory/gd25q64/gd25q64.pdf #define GD25Q64C {\ From 4e19158e0eaa0338ac3b85752c16d79cd737f068 Mon Sep 17 00:00:00 2001 From: sommersoft Date: Mon, 2 Sep 2019 18:46:48 -0500 Subject: [PATCH 36/41] docs: make sphinx include 'docs/static/customstyle.css' --- conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf.py b/conf.py index 56625e758f..3df958fe1f 100644 --- a/conf.py +++ b/conf.py @@ -369,3 +369,6 @@ texinfo_documents = [ intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None), "bus_device": ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None), "register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)} + +def setup(app): + app.add_stylesheet("customstyle.css") From 35c7646ee4112d6654f982818bc40304e34ea9d4 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 3 Sep 2019 08:52:21 -0400 Subject: [PATCH 37/41] Make trivial change to redo GitHub Actions build. The GitHub Actions build for this PR is failing for reasons that make no sense. Make a tiny commit change to see if it will refresh things and work again. --- supervisor/shared/external_flash/devices.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/external_flash/devices.h b/supervisor/shared/external_flash/devices.h index 4c3764d052..e787ba739a 100644 --- a/supervisor/shared/external_flash/devices.h +++ b/supervisor/shared/external_flash/devices.h @@ -66,7 +66,7 @@ typedef struct { bool single_status_byte: 1; } external_flash_device; -// Settings for the Adesto Tech AT25DF081A 1MiB SPI flash. Its on the SAMD21 +// Settings for the Adesto Tech AT25DF081A 1MiB SPI flash. It's on the SAMD21 // Xplained board. // Datasheet: https://www.adestotech.com/wp-content/uploads/doc8715.pdf #define AT25DF081A {\ From b318896b8509df07630d7ee1d27ab46b6dcba1c1 Mon Sep 17 00:00:00 2001 From: Dave Astels Date: Tue, 3 Sep 2019 12:35:41 -0400 Subject: [PATCH 38/41] Capture rotation --- shared-module/displayio/display_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 0f449ea34d..95fa08f547 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -85,6 +85,7 @@ void displayio_display_core_construct(displayio_display_core_t* self, self->ram_width = ram_width; self->ram_height = ram_height; rotation = rotation % 360; + self->rotation = rotation; self->transform.x = 0; self->transform.y = 0; self->transform.scale = 1; From 6c2dff1efd01af8687f22b7f9b4c8baa8acb7786 Mon Sep 17 00:00:00 2001 From: hexthat Date: Tue, 3 Sep 2019 10:30:27 -0700 Subject: [PATCH 39/41] Update zh_Latn_pinyin.po added translations --- locale/zh_Latn_pinyin.po | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 67a8f5d71a..62ea567412 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -226,7 +226,7 @@ msgstr "Dìzhǐ bìxū shì %d zì jié zhǎng" #: shared-bindings/_bleio/Address.c msgid "Address type out of range" -msgstr "" +msgstr "Dìzhǐ lèixíng chāochū fànwéi" #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" @@ -303,7 +303,7 @@ msgstr "" #: shared-module/displayio/Display.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Dī yú zuìdī zhèng sùlǜ" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" @@ -319,7 +319,7 @@ msgstr "Liǎng gè yǐn jiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn" #: shared-bindings/displayio/Display.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "Liàngdù bìxū wèi 0-1.0" #: shared-bindings/supervisor/__init__.c msgid "Brightness must be between 0 and 255" @@ -336,16 +336,16 @@ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié." #: shared-bindings/displayio/Display.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "Huǎnchōng qū bùshì bytearray" #: shared-bindings/displayio/Display.c msgid "Buffer is too small" -msgstr "" +msgstr "Huǎnchōng qū tài xiǎo" #: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "Huǎnchōng qū chángdù%d tài dà. Tā bìxū xiǎoyú%d" #: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c msgid "Buffer must be at least length 1" @@ -511,7 +511,7 @@ msgstr "Mùbiāo róngliàng xiǎoyú mùdì de_chángdù." #: shared-bindings/displayio/Display.c msgid "Display must have a 16 bit colorspace." -msgstr "" +msgstr "Xiǎnshì bìxū jùyǒu 16 wèi yánsè kōngjiān." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -545,11 +545,11 @@ msgstr "Yùqí de tèdiǎn" #: shared-bindings/_bleio/Service.c msgid "Expected a Peripheral" -msgstr "" +msgstr "Qídài yīgè wàiwéi shèbèi" #: shared-bindings/_bleio/Characteristic.c msgid "Expected a Service" -msgstr "" +msgstr "Yùqí fúwù" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c #: shared-bindings/_bleio/Service.c @@ -582,7 +582,7 @@ msgstr "Tiānjiā tèxìng shībài, err 0x%04x" #: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format msgid "Failed to add descriptor, err 0x%04x" -msgstr "" +msgstr "Wúfǎ tiānjiā miáoshù fú, err 0x%04x" #: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format @@ -636,7 +636,7 @@ msgstr "Wúfǎ tōngzhī huò xiǎnshì shǔxìng zhí, err 0x%04x" #: ports/nrf/common-hal/_bleio/Peripheral.c msgid "Failed to pair" -msgstr "" +msgstr "Pèiduì shībài" #: ports/nrf/common-hal/_bleio/Characteristic.c #, c-format @@ -682,7 +682,7 @@ msgstr "Wúfǎ kāishǐ liánjiē, cuòwù 0x%04x" #: ports/nrf/common-hal/_bleio/Peripheral.c #, c-format msgid "Failed to start pairing, error 0x%04x" -msgstr "" +msgstr "Wúfǎ kāishǐ pèiduì, cuòwù 0x%04x" #: ports/nrf/common-hal/_bleio/Scanner.c #, c-format @@ -743,7 +743,7 @@ msgstr "Hánshù xūyào suǒdìng" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Group already used" -msgstr "" +msgstr "Jítuán yǐjīng shǐyòngguò" #: shared-module/displayio/Group.c msgid "Group full" @@ -855,7 +855,7 @@ msgstr "Wúxiào liǎng jí zhí" #: shared-bindings/_bleio/Characteristic.c msgid "Invalid properties" -msgstr "" +msgstr "Wúxiào de shǔxìng" #: shared-bindings/microcontroller/__init__.c msgid "Invalid run mode." @@ -863,7 +863,7 @@ msgstr "Wúxiào de yùnxíng móshì." #: shared-module/_bleio/Attribute.c msgid "Invalid security_mode" -msgstr "" +msgstr "Ānquán móshì wúxiào" #: shared-bindings/audiocore/Mixer.c msgid "Invalid voice count" @@ -879,7 +879,7 @@ msgstr "Guānjiàn zì arg de LHS bìxū shì id" #: shared-module/displayio/Group.c msgid "Layer already in a group." -msgstr "" +msgstr "Tú céng yǐjīng zài yīgè zǔ zhōng." #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass." @@ -931,11 +931,11 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi #: shared-bindings/displayio/Group.c msgid "Must be a %q subclass." -msgstr "" +msgstr "Bìxū shì %q zi lèi." #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" -msgstr "" +msgstr "Zhège tèzhēng méiyǒu CCCD" #: ports/atmel-samd/common-hal/analogio/AnalogOut.c msgid "No DAC on chip" @@ -972,7 +972,7 @@ msgstr "Méiyǒu kěyòng de yìngjiàn suíjī" #: ports/atmel-samd/common-hal/ps2io/Ps2.c msgid "No hardware support on clk pin" -msgstr "" +msgstr "Shízhōng yǐn jiǎo wú yìngjiàn zhīchí" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -981,7 +981,7 @@ msgstr "Méiyǒu zài yǐn jiǎo shàng de yìngjiàn zhīchí" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" -msgstr "" +msgstr "Yǐn jiǎo shàng méiyǒu xiàlā; 1Mohm tuījiàn" #: py/moduerrno.c msgid "No space left on device" @@ -1105,7 +1105,7 @@ msgstr "Zhǐ dú duìxiàng" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" -msgstr "" +msgstr "Shuāxīn tài kuàile" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -1231,11 +1231,11 @@ msgstr "Píng pū gāodù bìxū huàfēn wèi tú gāodù" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" -msgstr "" +msgstr "Píng pū zhǐshù chāochū fànwéi" #: shared-bindings/displayio/TileGrid.c msgid "Tile value out of bounds" -msgstr "" +msgstr "Píng pū zhí chāochū fànwéi" #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" @@ -1346,12 +1346,12 @@ msgstr "Bù zhīchí de lādòng zhí." #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "" +msgstr "Zhí chángdù != Suǒ xū de gùdìng chángdù" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" -msgstr "" +msgstr "Zhí chángdù > zuìdà chángdù" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -2109,7 +2109,7 @@ msgstr "shùxué yù cuòwù" #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "" +msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-%d" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -2205,7 +2205,7 @@ msgstr "méiyǒu mókuài '%q'" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "no reset pin available" -msgstr "" +msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" #: py/runtime.c shared-bindings/_pixelbuf/__init__.c msgid "no such attribute" @@ -2213,7 +2213,7 @@ msgstr "méiyǒu cǐ shǔxìng" #: ports/nrf/common-hal/_bleio/__init__.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "" +msgstr "Zài service_uuids bái míngdān zhōng zhǎodào fēi UUID" #: py/compile.c msgid "non-default argument follows default argument" @@ -2299,11 +2299,11 @@ msgstr "piānlí biānjiè" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "" +msgstr "Jǐn zhīchí wèi shēndù = 16" #: ports/nrf/common-hal/audiobusio/PDMIn.c msgid "only sample_rate=16000 is supported" -msgstr "" +msgstr "Jǐn zhīchí cǎiyàng lǜ = 16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c #: shared-bindings/nvm/ByteArray.c From b53f1698242ef797b7176e32a92b92f282d998d6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 3 Sep 2019 14:46:47 -0700 Subject: [PATCH 40/41] Fix I2CDisplay bus_free to not grab lock Fixes #2098 --- shared-module/displayio/Display.c | 2 +- shared-module/displayio/I2CDisplay.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index f210a80c3c..212ee8c7b1 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -90,7 +90,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t* self, self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, cmd, 1); self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, data, data_size); } - self->core.end_transaction(self->core.bus); + displayio_display_core_end_transaction(&self->core); uint16_t delay_length_ms = 10; if (delay) { data_size++; diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 87261dca00..a3b167a331 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -91,11 +91,13 @@ bool common_hal_displayio_i2cdisplay_bus_free(mp_obj_t obj) { if (!common_hal_busio_i2c_try_lock(self->bus)) { return false; } + common_hal_busio_i2c_unlock(self->bus); return true; } bool common_hal_displayio_i2cdisplay_begin_transaction(mp_obj_t obj) { - return common_hal_displayio_i2cdisplay_bus_free(obj); + displayio_i2cdisplay_obj_t* self = MP_OBJ_TO_PTR(obj); + return !common_hal_busio_i2c_try_lock(self->bus); } void common_hal_displayio_i2cdisplay_send(mp_obj_t obj, display_byte_type_t data_type, display_chip_select_behavior_t chip_select, uint8_t *data, uint32_t data_length) { From 4651f91f94d8031b3cb9e51f1decb6141fbc577f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 3 Sep 2019 14:50:33 -0700 Subject: [PATCH 41/41] Swap to Blinka access token to hopefully not hit rate limit --- .github/workflows/build.yml | 2 +- .github/workflows/create_website_pr.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b5915feb8..36bfdbd8ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,5 +189,5 @@ jobs: working-directory: tools env: UPLOAD_URL: ${{ github.event.release.upload_url }} - ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.BLINKA_GITHUB_ACCESS_TOKEN }} if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 9ba1110eb8..ce93237021 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -34,5 +34,5 @@ jobs: working-directory: tools env: RELEASE_TAG: ${{ github.event.release.tag_name }} - ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }} + ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.BLINKA_GITHUB_ACCESS_TOKEN }} if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')