Merge pull request #2550 from tannewt/tweak_pixelbuf

Encapsulate the buffers within PixelBuf
This commit is contained in:
Jeff Epler 2020-01-30 13:55:02 -06:00 committed by GitHub
commit ba47aa25a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 638 additions and 910 deletions

View File

@ -28,6 +28,7 @@
#include <string.h>
#include "py/runtime.h"
#include "py/objtype.h"
#include "py/proto.h"
#if MICROPY_PY_FRAMEBUF
@ -304,9 +305,18 @@ STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, cons
return MP_OBJ_FROM_PTR(o);
}
STATIC const mp_obj_type_t mp_type_framebuf;
// Helper to ensure we have the native super class instead of a subclass.
static mp_obj_framebuf_t* native_framebuf(mp_obj_t framebuf_obj) {
mp_obj_t native_framebuf = mp_instance_cast_to_native_base(framebuf_obj, &mp_type_framebuf);
mp_obj_assert_native_inited(native_framebuf);
return MP_OBJ_TO_PTR(native_framebuf);
}
STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) {
(void)flags;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_framebuf_t *self = native_framebuf(self_in);
bufinfo->buf = self->buf;
bufinfo->len = self->stride * self->height * (self->format == FRAMEBUF_RGB565 ? 2 : 1);
bufinfo->typecode = 'B'; // view framebuf as bytes
@ -314,7 +324,7 @@ STATIC mp_int_t framebuf_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo,
}
STATIC mp_obj_t framebuf_fill(mp_obj_t self_in, mp_obj_t col_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_framebuf_t *self = native_framebuf(self_in);
mp_int_t col = mp_obj_get_int(col_in);
formats[self->format].fill_rect(self, 0, 0, self->width, self->height, col);
return mp_const_none;
@ -324,7 +334,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(framebuf_fill_obj, framebuf_fill);
STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t width = mp_obj_get_int(args[3]);
@ -338,7 +348,7 @@ STATIC mp_obj_t framebuf_fill_rect(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_fill_rect_obj, 6, 6, framebuf_fill_rect);
STATIC mp_obj_t framebuf_pixel(size_t n_args, const mp_obj_t *args) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
if (0 <= x && x < self->width && 0 <= y && y < self->height) {
@ -357,7 +367,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_pixel_obj, 3, 4, framebuf_pi
STATIC mp_obj_t framebuf_hline(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]);
@ -372,7 +382,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_hline_obj, 5, 5, framebuf_hl
STATIC mp_obj_t framebuf_vline(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t h = mp_obj_get_int(args[3]);
@ -387,7 +397,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_vline_obj, 5, 5, framebuf_vl
STATIC mp_obj_t framebuf_rect(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x = mp_obj_get_int(args[1]);
mp_int_t y = mp_obj_get_int(args[2]);
mp_int_t w = mp_obj_get_int(args[3]);
@ -406,7 +416,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_rect_obj, 6, 6, framebuf_rec
STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
(void)n_args;
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_int_t x1 = mp_obj_get_int(args[1]);
mp_int_t y1 = mp_obj_get_int(args[2]);
mp_int_t x2 = mp_obj_get_int(args[3]);
@ -470,8 +480,8 @@ STATIC mp_obj_t framebuf_line(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_line_obj, 6, 6, framebuf_line);
STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *source = MP_OBJ_TO_PTR(args[1]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
mp_obj_framebuf_t *source = native_framebuf(args[1]);
mp_int_t x = mp_obj_get_int(args[2]);
mp_int_t y = mp_obj_get_int(args[3]);
mp_int_t key = -1;
@ -513,7 +523,7 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(framebuf_blit_obj, 4, 5, framebuf_blit);
STATIC mp_obj_t framebuf_scroll(mp_obj_t self_in, mp_obj_t xstep_in, mp_obj_t ystep_in) {
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_framebuf_t *self = native_framebuf(self_in);
mp_int_t xstep = mp_obj_get_int(xstep_in);
mp_int_t ystep = mp_obj_get_int(ystep_in);
int sx, y, xend, yend, dx, dy;
@ -546,7 +556,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(framebuf_scroll_obj, framebuf_scroll);
STATIC mp_obj_t framebuf_text(size_t n_args, const mp_obj_t *args) {
// extract arguments
mp_obj_framebuf_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_framebuf_t *self = native_framebuf(args[0]);
const char *str = mp_obj_str_get_str(args[1]);
mp_int_t x0 = mp_obj_get_int(args[2]);
mp_int_t y0 = mp_obj_get_int(args[3]);

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -512,11 +512,8 @@ msgstr "Clock unit sedang digunakan"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -661,10 +658,6 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -692,11 +685,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Gagal untuk mengalokasikan buffer RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1148,10 +1141,6 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Tambahkan module apapun pada filesystem\n"
@ -1203,10 +1192,6 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1632,11 +1617,6 @@ msgstr ""
msgid "branch not in range"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2528,10 +2508,6 @@ msgstr ""
msgid "queue overflow"
msgstr "antrian meluap (overflow)"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr "relative import"
@ -2765,16 +2741,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr "tipe tidak diketahui"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -502,11 +502,8 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -650,10 +647,6 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -681,11 +674,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1136,10 +1129,6 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@ -1189,10 +1178,6 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1609,11 +1594,6 @@ msgstr ""
msgid "branch not in range"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2503,10 +2483,6 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@ -2739,16 +2715,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -506,11 +506,8 @@ msgstr "Clock unit wird benutzt"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Spalteneintrag muss digitalio.DigitalInOut sein"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr "Der Befehl muss zwischen 0 und 255 liegen"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Der Befehl muss ein int zwischen 0 und 255 sein"
@ -654,10 +651,6 @@ msgstr "Erwartet ein(e) %q"
msgid "Expected a Characteristic"
msgstr "Characteristic wird erwartet"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr "Ein Service wird erwartet"
@ -685,11 +678,11 @@ msgstr "Kommando nicht gesendet."
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Konnte keinen RX Buffer allozieren"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1151,10 +1144,6 @@ msgstr "Zugang verweigert"
msgid "Pin does not have ADC capabilities"
msgstr "Pin hat keine ADC Funktionalität"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr "Pixel außerhalb der Puffergrenzen"
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "und alle Module im Dateisystem \n"
@ -1206,10 +1195,6 @@ msgstr "Eine RTC wird auf diesem Board nicht unterstützt"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr "Bereich außerhalb der Grenzen"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Nur lesen möglich, da Schreibgeschützt"
@ -1637,11 +1622,6 @@ msgstr "Es müssen 8 oder 16 bits_per_sample sein"
msgid "branch not in range"
msgstr "Zweig ist außerhalb der Reichweite"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr "buf ist zu klein. brauche %d Bytes"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "Puffer muss ein bytes-artiges Objekt sein"
@ -2541,10 +2521,6 @@ msgstr ""
msgid "queue overflow"
msgstr "Warteschlangenüberlauf"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr "rawbuf hat nicht die gleiche Größe wie buf"
#: py/builtinimport.c
msgid "relative import"
msgstr "relativer Import"
@ -2784,16 +2760,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr "unbekannter Typ"
@ -2921,6 +2887,9 @@ msgstr ""
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "Characteristic wird bereits von einem anderen Dienst verwendet."
#~ msgid "Command must be 0-255"
#~ msgstr "Der Befehl muss zwischen 0 und 255 liegen"
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Konnte ble_uuid nicht decodieren. Status: 0x%04x"
@ -3122,6 +3091,12 @@ msgstr ""
#~ msgid "Pins not valid for SPI"
#~ msgstr "Pins nicht gültig für SPI"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Pixel außerhalb der Puffergrenzen"
#~ msgid "Range out of bounds"
#~ msgstr "Bereich außerhalb der Grenzen"
#~ msgid "STA must be active"
#~ msgstr "STA muss aktiv sein"
@ -3192,6 +3167,10 @@ msgstr ""
#~ "Sie laufen im abgesicherten Modus, was bedeutet, dass etwas Unerwartetes "
#~ "passiert ist.\n"
#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf ist zu klein. brauche %d Bytes"
#~ msgid "buffer too long"
#~ msgstr "Buffer zu lang"
@ -3251,6 +3230,9 @@ msgstr ""
#~ msgid "pin does not have IRQ capabilities"
#~ msgstr "Pin hat keine IRQ Fähigkeiten"
#~ msgid "rawbuf is not the same size as buf"
#~ msgstr "rawbuf hat nicht die gleiche Größe wie buf"
#~ msgid "readonly attribute"
#~ msgstr "Readonly-Attribut"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -502,11 +502,8 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -650,10 +647,6 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -681,11 +674,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1136,10 +1129,6 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@ -1189,10 +1178,6 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1609,11 +1594,6 @@ msgstr ""
msgid "branch not in range"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2503,10 +2483,6 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@ -2739,16 +2715,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -506,11 +506,8 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr ""
@ -654,10 +651,6 @@ msgstr ""
msgid "Expected a Characteristic"
msgstr ""
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -685,11 +678,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1140,10 +1133,6 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Belay that! Th' Pin be not ADC capable"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@ -1193,10 +1182,6 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1613,11 +1598,6 @@ msgstr ""
msgid "branch not in range"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2507,10 +2487,6 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@ -2743,16 +2719,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -508,11 +508,8 @@ msgstr "Clock unit está siendo utilizado"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Entrada de columna debe ser digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Command debe estar entre 0 y 255."
@ -656,10 +653,6 @@ msgstr "Se espera un %q"
msgid "Expected a Characteristic"
msgstr "Se esperaba una Característica."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -687,11 +680,11 @@ msgstr "Fallo enviando comando"
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "No se puede adquirir el mutex, status: 0x%08lX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Ha fallado la asignación del buffer RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1150,10 +1143,6 @@ msgstr "Permiso denegado"
msgid "Pin does not have ADC capabilities"
msgstr "Pin no tiene capacidad ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr "Pixel beyond bounds of buffer"
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@ -1205,11 +1194,6 @@ msgstr "RTC no soportado en esta placa"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, fuzzy
msgid "Range out of bounds"
msgstr "address fuera de límites"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Solo-lectura"
@ -1634,11 +1618,6 @@ msgstr "bits_per_sample debe ser 8 ó 16"
msgid "branch not in range"
msgstr "El argumento de chr() no esta en el rango(256)"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr "buf es demasiado pequeño. necesita %d bytes"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "buffer debe de ser un objeto bytes-like"
@ -2542,10 +2521,6 @@ msgstr "pow() con 3 argumentos requiere enteros"
msgid "queue overflow"
msgstr "desbordamiento de cola(queue)"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr "rawbuf no es el mismo tamaño que buf"
#: py/builtinimport.c
msgid "relative import"
msgstr "import relativo"
@ -2781,16 +2756,6 @@ msgstr "especificador de conversión %c desconocido"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "codigo format desconocido '%c' para el typo de objeto '%s'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "codigo format desconocido '%c' para el typo de objeto 'float'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "codigo format desconocido '%c' para objeto de tipo 'str'"
#: py/compile.c
msgid "unknown type"
msgstr "tipo desconocido"
@ -3143,6 +3108,13 @@ msgstr "paso cero"
#~ msgid "Pins not valid for SPI"
#~ msgstr "Pines no válidos para SPI"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Pixel beyond bounds of buffer"
#, fuzzy
#~ msgid "Range out of bounds"
#~ msgstr "address fuera de límites"
#~ msgid "STA must be active"
#~ msgstr "STA debe estar activo"
@ -3222,6 +3194,10 @@ msgstr "paso cero"
#~ msgid "bad GATT role"
#~ msgstr "mal GATT role"
#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf es demasiado pequeño. necesita %d bytes"
#~ msgid "buffer too long"
#~ msgstr "buffer demasiado largo"
@ -3305,6 +3281,9 @@ msgstr "paso cero"
#~ msgid "position must be 2-tuple"
#~ msgstr "posición debe ser 2-tuple"
#~ msgid "rawbuf is not the same size as buf"
#~ msgstr "rawbuf no es el mismo tamaño que buf"
#, fuzzy
#~ msgid "readonly attribute"
#~ msgstr "atributo no legible"
@ -3333,6 +3312,14 @@ msgstr "paso cero"
#~ msgid "unknown config param"
#~ msgstr "parámetro config desconocido"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "codigo format desconocido '%c' para el typo de objeto 'float'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "codigo format desconocido '%c' para objeto de tipo 'str'"
#~ msgid "unknown status param"
#~ msgstr "status param desconocido"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -510,11 +510,8 @@ msgstr "Clock unit ginagamit"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
msgstr "Sa gitna ng 0 o 255 dapat ang bytes."
@ -663,10 +660,6 @@ msgstr "Umasa ng %q"
msgid "Expected a Characteristic"
msgstr "Hindi mabasa and Characteristic."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -695,11 +688,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Nabigong ilaan ang RX buffer"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1156,10 +1149,6 @@ msgstr "Walang pahintulot"
msgid "Pin does not have ADC capabilities"
msgstr "Ang pin ay walang kakayahan sa ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
@ -1211,11 +1200,6 @@ msgstr "Hindi supportado ang RTC sa board na ito"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, fuzzy
msgid "Range out of bounds"
msgstr "wala sa sakop ang address"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Basahin-lamang"
@ -1643,11 +1627,6 @@ msgstr "bits_per_sample ay dapat 8 o 16"
msgid "branch not in range"
msgstr "branch wala sa range"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "buffer ay dapat bytes-like object"
@ -2556,10 +2535,6 @@ msgstr "pow() na may 3 argumento kailangan ng integers"
msgid "queue overflow"
msgstr "puno na ang pila (overflow)"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr "relative import"
@ -2796,16 +2771,6 @@ msgstr "hindi alam ang conversion specifier na %c"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "hindi alam ang format code '%c' para sa object na ang type ay '%s'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "hindi alam ang format code '%c' sa object na ang type ay 'float'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "hindi alam ang format ng code na '%c' para sa object ng type ay 'str'"
#: py/compile.c
msgid "unknown type"
msgstr "hindi malaman ang type (unknown type)"
@ -3123,6 +3088,10 @@ msgstr "zero step"
#~ msgid "Pins not valid for SPI"
#~ msgstr "Mali ang pins para sa SPI"
#, fuzzy
#~ msgid "Range out of bounds"
#~ msgstr "wala sa sakop ang address"
#~ msgid "STA must be active"
#~ msgstr "Dapat aktibo ang STA"
@ -3285,6 +3254,15 @@ msgstr "zero step"
#~ msgid "unknown config param"
#~ msgstr "hindi alam na config param"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "hindi alam ang format code '%c' sa object na ang type ay 'float'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr ""
#~ "hindi alam ang format ng code na '%c' para sa object ng type ay 'str'"
#~ msgid "unknown status param"
#~ msgstr "hindi alam na status param"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -515,11 +515,8 @@ msgstr "Horloge en cours d'utilisation"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "L'entrée 'Column' doit être un digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
msgstr "La commande doit être un entier entre 0 et 255"
@ -666,10 +663,6 @@ msgstr "Attendu un %q"
msgid "Expected a Characteristic"
msgstr "Une 'Characteristic' est attendue"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -698,11 +691,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Echec de l'obtention de mutex, err 0x%04x"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Echec de l'allocation du tampon RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1170,10 +1163,6 @@ msgstr "Permission refusée"
msgid "Pin does not have ADC capabilities"
msgstr "La broche ne peut être utilisée pour l'ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr "Pixel au-delà des limites du tampon"
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@ -1224,11 +1213,6 @@ msgstr "RTC non supportée sur cette carte"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, fuzzy
msgid "Range out of bounds"
msgstr "adresse hors limites"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Lecture seule"
@ -1662,11 +1646,6 @@ msgstr "'bits_per_sample' doivent être 8 ou 16"
msgid "branch not in range"
msgstr "branche hors-bornes"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr "'buf' est trop petit. Besoin de %d octets"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "le tampon doit être un objet bytes-like"
@ -2589,10 +2568,6 @@ msgstr "pow() avec 3 arguments nécessite des entiers"
msgid "queue overflow"
msgstr "dépassement de file"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr "'rawbuf' n'est pas de la même taille que 'buf'"
#: py/builtinimport.c
msgid "relative import"
msgstr "import relatif"
@ -2830,16 +2805,6 @@ msgstr "spécification %c de conversion inconnue"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "code de format '%c' inconnu pour un objet de type '%s'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "code de format '%c' inconnu pour un objet de type 'float'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "code de format '%c' inconnu pour un objet de type 'str'"
#: py/compile.c
msgid "unknown type"
msgstr "type inconnu"
@ -3201,6 +3166,13 @@ msgstr "'step' nul"
#~ msgid "Pins not valid for SPI"
#~ msgstr "Broche invalide pour le SPI"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Pixel au-delà des limites du tampon"
#, fuzzy
#~ msgid "Range out of bounds"
#~ msgstr "adresse hors limites"
#~ msgid "STA must be active"
#~ msgstr "'STA' doit être actif"
@ -3281,6 +3253,10 @@ msgstr "'step' nul"
#~ msgid "bad GATT role"
#~ msgstr "mauvais rôle GATT"
#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "'buf' est trop petit. Besoin de %d octets"
#~ msgid "buffer too long"
#~ msgstr "tampon trop long"
@ -3364,6 +3340,9 @@ msgstr "'step' nul"
#~ msgid "position must be 2-tuple"
#~ msgstr "position doit être un 2-tuple"
#~ msgid "rawbuf is not the same size as buf"
#~ msgstr "'rawbuf' n'est pas de la même taille que 'buf'"
#, fuzzy
#~ msgid "readonly attribute"
#~ msgstr "attribut en lecture seule"
@ -3389,6 +3368,14 @@ msgstr "'step' nul"
#~ msgid "unknown config param"
#~ msgstr "paramètre de config. inconnu"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "code de format '%c' inconnu pour un objet de type 'float'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "code de format '%c' inconnu pour un objet de type 'str'"
#~ msgid "unknown status param"
#~ msgstr "paramètre de statut inconnu"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -511,11 +511,8 @@ msgstr "Unità di clock in uso"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
msgstr "I byte devono essere compresi tra 0 e 255"
@ -663,10 +660,6 @@ msgstr "Atteso un %q"
msgid "Expected a Characteristic"
msgstr "Non è possibile aggiungere Characteristic."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -695,11 +688,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Impossibile allocare buffer RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1165,10 +1158,6 @@ msgstr "Permesso negato"
msgid "Pin does not have ADC capabilities"
msgstr "Il pin non ha capacità di ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@ -1220,11 +1209,6 @@ msgstr "RTC non supportato su questa scheda"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, fuzzy
msgid "Range out of bounds"
msgstr "indirizzo fuori limite"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Sola lettura"
@ -1648,11 +1632,6 @@ msgstr "i bit devono essere 7, 8 o 9"
msgid "branch not in range"
msgstr "argomento di chr() non è in range(256)"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2563,10 +2542,6 @@ msgstr "pow() con 3 argomenti richiede interi"
msgid "queue overflow"
msgstr "overflow della coda"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr "importazione relativa"
@ -2803,16 +2778,6 @@ msgstr "specificatore di conversione %s sconosciuto"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "codice di formattaione '%c' sconosciuto per oggetto di tipo '%s'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "codice di formattazione '%c' sconosciuto per oggetto di tipo 'float'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "codice di formattazione '%c' sconosciuto per oggetto di tipo 'str'"
#: py/compile.c
msgid "unknown type"
msgstr "tipo sconosciuto"
@ -3134,6 +3099,10 @@ msgstr "zero step"
#~ msgid "Pins not valid for SPI"
#~ msgstr "Pin non validi per SPI"
#, fuzzy
#~ msgid "Range out of bounds"
#~ msgstr "indirizzo fuori limite"
#~ msgid "STA must be active"
#~ msgstr "STA deve essere attiva"
@ -3272,6 +3241,15 @@ msgstr "zero step"
#~ msgid "unknown config param"
#~ msgstr "parametro di configurazione sconosciuto"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr ""
#~ "codice di formattazione '%c' sconosciuto per oggetto di tipo 'float'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "codice di formattazione '%c' sconosciuto per oggetto di tipo 'str'"
#~ msgid "unknown status param"
#~ msgstr "prametro di stato sconosciuto"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -506,11 +506,8 @@ msgstr ""
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "명령은 0에서 255 사이의 정수(int) 여야합니다"
@ -654,10 +651,6 @@ msgstr "%q 이 예상되었습니다."
msgid "Expected a Characteristic"
msgstr "특성(Characteristic)이 예상되었습니다."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -685,11 +678,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1140,10 +1133,6 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@ -1193,10 +1182,6 @@ msgstr ""
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr ""
@ -1614,11 +1599,6 @@ msgstr "bits_per_sample은 8 또는 16이어야합니다."
msgid "branch not in range"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2508,10 +2488,6 @@ msgstr ""
msgid "queue overflow"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@ -2744,16 +2720,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@ -505,11 +505,8 @@ msgstr "Jednostka zegara w użyciu"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Kolumny muszą być typu digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Komenda musi być int pomiędzy 0 a 255"
@ -653,10 +650,6 @@ msgstr "Oczekiwano %q"
msgid "Expected a Characteristic"
msgstr "Oczekiwano charakterystyki"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -684,11 +677,11 @@ msgstr ""
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Nie udało się uzyskać blokady, błąd 0x$04x"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Nie udała się alokacja bufora RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1141,10 +1134,6 @@ msgstr "Odmowa dostępu"
msgid "Pin does not have ADC capabilities"
msgstr "Nóżka nie obsługuje ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr "Piksel poza granicami bufora"
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Oraz moduły w systemie plików\n"
@ -1194,10 +1183,6 @@ msgstr "Brak obsługi RTC"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr "Zakres poza granicami"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Tylko do odczytu"
@ -1617,11 +1602,6 @@ msgstr "bits_per_sample musi być 8 lub 16"
msgid "branch not in range"
msgstr "skok poza zakres"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr "buf zbyt mały. Wymagane %d bajtów"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "bufor mysi być typu bytes"
@ -2513,10 +2493,6 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych"
msgid "queue overflow"
msgstr "przepełnienie kolejki"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr "rawbuf nie jest tej samej wielkości co buf"
#: py/builtinimport.c
msgid "relative import"
msgstr "relatywny import"
@ -2750,16 +2726,6 @@ msgstr "zła specyfikacja konwersji %c"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "zły kod formatowania '%c' dla obiektu typu '%s'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "zły kod foratowania '%c' dla obiektu typu 'float'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "zły kod formatowania '%c' dla obiektu typu 'str'"
#: py/compile.c
msgid "unknown type"
msgstr "zły typ"
@ -3009,6 +2975,12 @@ msgstr "zerowy krok"
#~ msgid "Only slices with step=1 (aka None) are supported"
#~ msgstr "Wspierane są tylko fragmenty z step=1 (albo None)"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Piksel poza granicami bufora"
#~ msgid "Range out of bounds"
#~ msgstr "Zakres poza granicami"
#~ msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
#~ msgstr "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
@ -3063,6 +3035,10 @@ msgstr "zerowy krok"
#~ msgid "bad GATT role"
#~ msgstr "zła rola GATT"
#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "buf zbyt mały. Wymagane %d bajtów"
#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "byteorder musi być typu ByteOrder (jest %s)"
@ -3077,6 +3053,9 @@ msgstr "zerowy krok"
#~ msgid "name must be a string"
#~ msgstr "nazwa musi być łańcuchem"
#~ msgid "rawbuf is not the same size as buf"
#~ msgstr "rawbuf nie jest tej samej wielkości co buf"
#~ msgid "services includes an object that is not a Service"
#~ msgstr "obiekt typu innego niż Service w services"
@ -3089,5 +3068,13 @@ msgstr "zerowy krok"
#~ msgid "timeout >100 (units are now seconds, not msecs)"
#~ msgstr "timeout > 100 (jednostkami są sekundy)"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "zły kod foratowania '%c' dla obiektu typu 'float'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "zły kod formatowania '%c' dla obiektu typu 'str'"
#~ msgid "write_args must be a list, tuple, or None"
#~ msgstr "write_args musi być listą, krotką lub None"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -507,11 +507,8 @@ msgstr "Unidade de Clock em uso"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr ""
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr ""
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
#, fuzzy
msgid "Command must be an int between 0 and 255"
msgstr "Os bytes devem estar entre 0 e 255."
@ -658,10 +655,6 @@ msgstr "Esperado um"
msgid "Expected a Characteristic"
msgstr "Não é possível adicionar Característica."
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr ""
@ -690,11 +683,11 @@ 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/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Falha ao alocar buffer RX"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1151,10 +1144,6 @@ msgstr "Permissão negada"
msgid "Pin does not have ADC capabilities"
msgstr "O pino não tem recursos de ADC"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr ""
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@ -1205,10 +1194,6 @@ msgstr "O RTC não é suportado nesta placa"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr ""
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Somente leitura"
@ -1629,11 +1614,6 @@ msgstr "bits devem ser 8"
msgid "branch not in range"
msgstr "Calibração está fora do intervalo"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
@ -2525,10 +2505,6 @@ msgstr ""
msgid "queue overflow"
msgstr "estouro de fila"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr ""
#: py/builtinimport.c
msgid "relative import"
msgstr ""
@ -2763,16 +2739,6 @@ msgstr ""
msgid "unknown format code '%c' for object of type '%s'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr ""
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr ""
#: py/compile.c
msgid "unknown type"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-01-18 11:56-0800\n"
"POT-Creation-Date: 2020-01-29 17:27-0800\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -506,11 +506,8 @@ msgstr "Shǐyòng shízhōng dānwèi"
msgid "Column entry must be digitalio.DigitalInOut"
msgstr "Liè tiáomù bìxū shì digitalio.DigitalInOut"
#: shared-bindings/displayio/I2CDisplay.c
msgid "Command must be 0-255"
msgstr "Mìnglìng bìxū wèi 0-255"
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/ParallelBus.c
#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c
#: shared-bindings/displayio/ParallelBus.c
msgid "Command must be an int between 0 and 255"
msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int"
@ -654,10 +651,6 @@ msgstr "Yùqí %q"
msgid "Expected a Characteristic"
msgstr "Yùqí de tèdiǎn"
#: shared-bindings/_pixelbuf/__init__.c
msgid "Expected a PixelBuf instance"
msgstr ""
#: shared-bindings/_bleio/Characteristic.c
msgid "Expected a Service"
msgstr "Yùqí fúwù"
@ -685,11 +678,11 @@ 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/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
msgid "Failed to allocate RX buffer"
msgstr "Fēnpèi RX huǎnchōng shībài"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
@ -1146,10 +1139,6 @@ msgstr "Quánxiàn bèi jùjué"
msgid "Pin does not have ADC capabilities"
msgstr "Pin méiyǒu ADC nénglì"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Pixel beyond bounds of buffer"
msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè"
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
@ -1199,10 +1188,6 @@ msgstr "Cǐ bǎn bù zhīchí RTC"
msgid "Random number generation error"
msgstr ""
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "Range out of bounds"
msgstr "Fànwéi chāochū biānjiè"
#: shared-bindings/pulseio/PulseIn.c
msgid "Read-only"
msgstr "Zhǐ dú"
@ -1626,11 +1611,6 @@ msgstr "měi jiàn yàngběn bìxū wèi 8 huò 16"
msgid "branch not in range"
msgstr "fēnzhī bùzài fànwéi nèi"
#: shared-bindings/_pixelbuf/PixelBuf.c
#, c-format
msgid "buf is too small. need %d bytes"
msgstr "huǎnchōng tài xiǎo. Xūyào%d zì jié"
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr "huǎnchōng qū bìxū shì zì jié lèi duìxiàng"
@ -2525,10 +2505,6 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù"
msgid "queue overflow"
msgstr "duìliè yìchū"
#: shared-bindings/_pixelbuf/PixelBuf.c
msgid "rawbuf is not the same size as buf"
msgstr "yuánshǐ huǎnchōng qū hé huǎnchōng qū de dàxiǎo bùtóng"
#: py/builtinimport.c
msgid "relative import"
msgstr "xiāngduì dǎorù"
@ -2763,16 +2739,6 @@ msgstr "wèizhī de zhuǎnhuàn biāozhù %c"
msgid "unknown format code '%c' for object of type '%s'"
msgstr "lèixíng '%s' duìxiàng wèizhī de géshì dàimǎ '%c'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'float'"
msgstr "lèixíng 'float' duìxiàng wèizhī de géshì dàimǎ '%c'"
#: py/objstr.c
#, c-format
msgid "unknown format code '%c' for object of type 'str'"
msgstr "lèixíng 'str' duìxiàng wèizhī de géshì dàimǎ '%c'"
#: py/compile.c
msgid "unknown type"
msgstr "wèizhī lèixíng"
@ -2888,6 +2854,9 @@ msgstr "líng bù"
#~ 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 "Command must be 0-255"
#~ msgstr "Mìnglìng bìxū wèi 0-255"
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Wúfǎ jiěmǎ kě dú_uuid, err 0x%04x"
@ -3060,6 +3029,12 @@ msgstr "líng bù"
#~ msgid "Only slices with step=1 (aka None) are supported"
#~ msgstr "Jǐn zhīchí 1 bù qiēpiàn"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè"
#~ msgid "Range out of bounds"
#~ msgstr "Fànwéi chāochū biānjiè"
#~ msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
#~ msgstr "Ruǎn shèbèi wéihù, id: 0X%08lX, pc: 0X%08lX"
@ -3116,6 +3091,10 @@ msgstr "líng bù"
#~ msgid "bad GATT role"
#~ msgstr "zǒng xiédìng de bùliáng juésè"
#, c-format
#~ msgid "buf is too small. need %d bytes"
#~ msgstr "huǎnchōng tài xiǎo. Xūyào%d zì jié"
#, c-format
#~ msgid "byteorder is not an instance of ByteOrder (got a %s)"
#~ msgstr "zì jié bùshì zì jié xù shílì (yǒu %s)"
@ -3132,6 +3111,9 @@ msgstr "líng bù"
#~ msgid "name must be a string"
#~ msgstr "míngchēng bìxū shì yīgè zìfú chuàn"
#~ msgid "rawbuf is not the same size as buf"
#~ msgstr "yuánshǐ huǎnchōng qū hé huǎnchōng qū de dàxiǎo bùtóng"
#~ msgid "row must be packed and word aligned"
#~ msgstr "xíng bìxū dǎbāo bìngqiě zì duìqí"
@ -3150,6 +3132,14 @@ msgstr "líng bù"
#~ msgid "too many arguments"
#~ msgstr "tài duō cānshù"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'float'"
#~ msgstr "lèixíng 'float' duìxiàng wèizhī de géshì dàimǎ '%c'"
#, c-format
#~ msgid "unknown format code '%c' for object of type 'str'"
#~ msgstr "lèixíng 'str' duìxiàng wèizhī de géshì dàimǎ '%c'"
#~ msgid "unsupported bitmap type"
#~ msgstr "bù zhīchí de bitmap lèixíng"

View File

@ -150,7 +150,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
self->buffer = (uint8_t *) gc_alloc(self->buffer_length * sizeof(uint8_t), false, true);
if (self->buffer == NULL) {
common_hal_busio_uart_deinit(self);
mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer"));
mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t));
}
} else {
self->buffer_length = 0;

View File

@ -93,7 +93,7 @@ STATIC mp_obj_t list_make_new(const mp_obj_type_t *type_in, size_t n_args, const
}
STATIC mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
switch (op) {
case MP_UNARY_OP_BOOL: return mp_obj_new_bool(self->len != 0);
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->len);
@ -108,7 +108,7 @@ STATIC mp_obj_t list_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
mp_obj_list_t *o = MP_OBJ_TO_PTR(lhs);
mp_obj_list_t *o = mp_instance_cast_to_native_base(lhs, &mp_type_list);
switch (op) {
case MP_BINARY_OP_ADD: {
if (!MP_OBJ_IS_TYPE(rhs, &mp_type_list)) {
@ -239,7 +239,7 @@ STATIC mp_obj_t list_getiter(mp_obj_t o_in, mp_obj_iter_buf_t *iter_buf) {
mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
if (self->len >= self->alloc) {
self->items = m_renew(mp_obj_t, self->items, self->alloc, self->alloc * 2);
self->alloc *= 2;
@ -252,8 +252,8 @@ mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg) {
STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
if (MP_OBJ_IS_TYPE(arg_in, &mp_type_list)) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *arg = MP_OBJ_TO_PTR(arg_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
mp_obj_list_t *arg = mp_instance_cast_to_native_base(arg_in, &mp_type_list);
if (self->len + arg->len > self->alloc) {
// TODO: use alloc policy for "4"
@ -272,7 +272,7 @@ STATIC mp_obj_t list_extend(mp_obj_t self_in, mp_obj_t arg_in) {
STATIC mp_obj_t list_pop(size_t n_args, const mp_obj_t *args) {
mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_list_t *self = mp_instance_cast_to_native_base(args[0], &mp_type_list);
if (self->len == 0) {
mp_raise_IndexError(translate("pop from empty list"));
}
@ -332,7 +332,7 @@ mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
mp_check_self(MP_OBJ_IS_TYPE(pos_args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(pos_args[0]);
mp_obj_list_t *self = mp_instance_cast_to_native_base(pos_args[0], &mp_type_list);
if (self->len > 1) {
mp_quicksort(self->items, self->items + self->len - 1,
@ -345,7 +345,7 @@ mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_
mp_obj_t mp_obj_list_clear(mp_obj_t self_in) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
self->len = 0;
self->items = m_renew(mp_obj_t, self->items, self->alloc, LIST_MIN_ALLOC);
self->alloc = LIST_MIN_ALLOC;
@ -355,25 +355,25 @@ mp_obj_t mp_obj_list_clear(mp_obj_t self_in) {
STATIC mp_obj_t list_copy(mp_obj_t self_in) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
return mp_obj_new_list(self->len, self->items);
}
STATIC mp_obj_t list_count(mp_obj_t self_in, mp_obj_t value) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
return mp_seq_count_obj(self->items, self->len, value);
}
STATIC mp_obj_t list_index(size_t n_args, const mp_obj_t *args) {
mp_check_self(MP_OBJ_IS_TYPE(args[0], &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(args[0]);
mp_obj_list_t *self = mp_instance_cast_to_native_base(args[0], &mp_type_list);
return mp_seq_index_obj(self->items, self->len, n_args, args);
}
STATIC mp_obj_t list_insert(mp_obj_t self_in, mp_obj_t idx, mp_obj_t obj) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
// insert has its own strange index logic
mp_int_t index = MP_OBJ_SMALL_INT_VALUE(idx);
if (index < 0) {
@ -407,7 +407,7 @@ mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value) {
STATIC mp_obj_t list_reverse(mp_obj_t self_in) {
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
mp_int_t len = self->len;
for (mp_int_t i = 0; i < len/2; i++) {
@ -484,7 +484,7 @@ mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items) {
}
void mp_obj_list_get(mp_obj_t self_in, size_t *len, mp_obj_t **items) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
*len = self->len;
*items = self->items;
}
@ -497,7 +497,7 @@ void mp_obj_list_set_len(mp_obj_t self_in, size_t len) {
}
void mp_obj_list_store(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
size_t i = mp_get_index(self->base.type, self->len, index, false);
self->items[i] = value;
}

View File

@ -1352,7 +1352,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
terse_str_format_value_error();
} else {
mp_raise_ValueError_varg(
translate("unknown format code '%c' for object of type 'float'"),
translate("unknown format code '%c' for object of type '%s'"),
type, mp_obj_get_type_str(arg));
}
}
@ -1388,7 +1388,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar
terse_str_format_value_error();
} else {
mp_raise_ValueError_varg(
translate("unknown format code '%c' for object of type 'str'"),
translate("unknown format code '%c' for object of type '%s'"),
type, mp_obj_get_type_str(arg));
}
}

View File

@ -187,14 +187,7 @@ STATIC void mp_obj_class_lookup(struct class_lookup_data *lookup, const mp_obj_
return;
} else {
mp_obj_instance_t *obj = lookup->obj;
mp_obj_t obj_obj;
if (obj != NULL && mp_obj_is_native_type(type) && type != &mp_type_object /* object is not a real type */) {
// If we're dealing with native base class, then it applies to native sub-object
obj_obj = obj->subobj[0];
} else {
obj_obj = MP_OBJ_FROM_PTR(obj);
}
mp_convert_member_lookup(obj_obj, type, elem->value, lookup->dest);
mp_convert_member_lookup(MP_OBJ_FROM_PTR(obj), type, elem->value, lookup->dest);
}
#if DEBUG_PRINT
printf("mp_obj_class_lookup: Returning: ");

View File

@ -36,13 +36,14 @@
#include <string.h>
#include "PixelBuf.h"
#include "shared-bindings/_pixelbuf/types.h"
#include "../../shared-module/_pixelbuf/PixelBuf.h"
#include "shared-bindings/_pixelbuf/PixelBuf.h"
#include "shared-module/_pixelbuf/PixelBuf.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
extern const int32_t colorwheel(float pos);
static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t* parsed);
//| .. currentmodule:: pixelbuf
//|
//| :class:`PixelBuf` -- A fast RGB[W] pixel buffer for LED and similar devices
@ -50,140 +51,109 @@ extern const int32_t colorwheel(float pos);
//|
//| :class:`~_pixelbuf.PixelBuf` implements an RGB[W] bytearray abstraction.
//|
//| .. class:: PixelBuf(size, buf, byteorder="BGR", brightness=0, rawbuf=None, offset=0, auto_write=False)
//| .. class:: PixelBuf(size, *, byteorder="BGR", brightness=0, auto_write=False, header=b"", trailer=b"")
//|
//| Create a PixelBuf object of the specified size, byteorder, and bits per pixel.
//|
//| When given a second bytearray (``rawbuf``), changing brightness adjusts the
//| brightness of all members of ``buf``.
//| When brightness is less than 1.0, a second buffer will be used to store the color values
//| before they are adjusted for brightness.
//|
//| When only given ``buf``, ``brightness`` applies to the next pixel assignment.
//|
//| When ``P`` (pwm duration) is present as the 4th character of the byteorder
//| string, the 4th value in the tuple/list for a pixel is the individual pixel
//| When ``P`` (pwm duration) is present as the 4th character of the byteorder
//| string, the 4th value in the tuple/list for a pixel is the individual pixel
//| brightness (0.0-1.0) and will enable a Dotstar compatible 1st byte in the
//| output buffer (``buf``).
//|
//| :param ~int size: Number of pixelsx
//| :param ~bytearray buf: Bytearray in which to store pixel data
//| :param ~str byteorder: Byte order string (such as "BGR" or "PBGR")
//| :param ~float brightness: Brightness (0 to 1.0, default 1.0)
//| :param ~bytearray rawbuf: Bytearray in which to store raw pixel data (before brightness adjustment)
//| :param ~int offset: Offset from start of buffer (default 0)
//| :param ~bool auto_write: Whether to automatically write pixels (Default False)
//| :param bytes header: Sequence of bytes to always send before pixel values.
//| :param bytes trailer: Sequence of bytes to always send after pixel values.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 2, MP_OBJ_FUN_ARGS_MAX, true);
enum { ARG_size, ARG_buf, ARG_byteorder, ARG_brightness, ARG_rawbuf, ARG_offset,
ARG_auto_write };
mp_arg_check_num(n_args, kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true);
enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_size, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_byteorder, MP_ARG_OBJ, { .u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_BGR) } },
{ MP_QSTR_brightness, MP_ARG_OBJ, { .u_obj = mp_const_none } },
{ MP_QSTR_rawbuf, MP_ARG_OBJ, { .u_obj = mp_const_none } },
{ MP_QSTR_offset, MP_ARG_INT, { .u_int = 0 } },
{ MP_QSTR_auto_write, MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_byteorder, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_BGR) } },
{ MP_QSTR_brightness, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } },
{ MP_QSTR_auto_write, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_header, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } },
{ MP_QSTR_trailer, 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 char *byteorder = NULL;
pixelbuf_byteorder_details_t byteorder_details;
size_t bo_len;
if (!MP_OBJ_IS_STR(args[ARG_byteorder].u_obj))
parse_byteorder(args[ARG_byteorder].u_obj, &byteorder_details);
mp_buffer_info_t header_bufinfo;
mp_buffer_info_t trailer_bufinfo;
if (!mp_get_buffer(args[ARG_header].u_obj, &header_bufinfo, MP_BUFFER_READ)) {
header_bufinfo.buf = NULL;
header_bufinfo.len = 0;
}
if (!mp_get_buffer(args[ARG_trailer].u_obj, &trailer_bufinfo, MP_BUFFER_READ)) {
trailer_bufinfo.buf = NULL;
trailer_bufinfo.len = 0;
}
float brightness = 1.0;
if (args[ARG_brightness].u_obj != mp_const_none) {
brightness = mp_obj_get_float(args[ARG_brightness].u_obj);
if (brightness < 0) {
brightness = 0;
} else if (brightness > 1) {
brightness = 1;
}
}
// Validation complete, allocate and populate object.
pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t);
self->base.type = &pixelbuf_pixelbuf_type;
common_hal__pixelbuf_pixelbuf_construct(self, args[ARG_size].u_int,
&byteorder_details, brightness, args[ARG_auto_write].u_bool, header_bufinfo.buf,
header_bufinfo.len, trailer_bufinfo.buf, trailer_bufinfo.len);
return MP_OBJ_FROM_PTR(self);
}
static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t* parsed) {
if (!MP_OBJ_IS_STR(byteorder_obj)) {
mp_raise_TypeError(translate("byteorder is not a string"));
}
byteorder = mp_obj_str_get_data(args[ARG_byteorder].u_obj, &bo_len);
if (bo_len < 3 || bo_len > 4)
size_t bo_len;
const char *byteorder = mp_obj_str_get_data(byteorder_obj, &bo_len);
if (bo_len < 3 || bo_len > 4) {
mp_raise_ValueError(translate("Invalid byteorder string"));
byteorder_details.order = args[ARG_byteorder].u_obj;
}
parsed->order_string = byteorder_obj;
byteorder_details.bpp = bo_len;
parsed->bpp = bo_len;
char *dotstar = strchr(byteorder, 'P');
char *r = strchr(byteorder, 'R');
char *g = strchr(byteorder, 'G');
char *b = strchr(byteorder, 'B');
char *w = strchr(byteorder, 'W');
int num_chars = (dotstar ? 1 : 0) + (w ? 1 : 0) + (r ? 1 : 0) + (g ? 1 : 0) + (b ? 1 : 0);
if ((num_chars < byteorder_details.bpp) || !(r && b && g))
if ((num_chars < parsed->bpp) || !(r && b && g)) {
mp_raise_ValueError(translate("Invalid byteorder string"));
byteorder_details.is_dotstar = dotstar ? true : false;
byteorder_details.has_white = w ? true : false;
byteorder_details.byteorder.r = r - byteorder;
byteorder_details.byteorder.g = g - byteorder;
byteorder_details.byteorder.b = b - byteorder;
byteorder_details.byteorder.w = w ? w - byteorder : 0;
}
parsed->is_dotstar = dotstar ? true : false;
parsed->has_white = w ? true : false;
parsed->byteorder.r = r - byteorder;
parsed->byteorder.g = g - byteorder;
parsed->byteorder.b = b - byteorder;
parsed->byteorder.w = w ? w - byteorder : 0;
// The dotstar brightness byte is always first (as it goes with the pixel start bits)
if (dotstar && byteorder[0] != 'P') {
mp_raise_ValueError(translate("Invalid byteorder string"));
}
if (byteorder_details.has_white && byteorder_details.is_dotstar)
if (parsed->has_white && parsed->is_dotstar) {
mp_raise_ValueError(translate("Invalid byteorder string"));
size_t effective_bpp = byteorder_details.is_dotstar ? 4 : byteorder_details.bpp; // Always 4 for DotStar
size_t bytes = args[ARG_size].u_int * effective_bpp;
size_t offset = args[ARG_offset].u_int;
mp_buffer_info_t bufinfo, rawbufinfo;
mp_get_buffer_raise(args[ARG_buf].u_obj, &bufinfo, MP_BUFFER_READ | MP_BUFFER_WRITE);
bool two_buffers = args[ARG_rawbuf].u_obj != mp_const_none;
if (two_buffers) {
mp_get_buffer_raise(args[ARG_rawbuf].u_obj, &rawbufinfo, MP_BUFFER_READ | MP_BUFFER_WRITE);
if (rawbufinfo.len != bufinfo.len) {
mp_raise_ValueError(translate("rawbuf is not the same size as buf"));
}
}
if (bytes + offset > bufinfo.len)
mp_raise_ValueError_varg(translate("buf is too small. need %d bytes"), bytes + offset);
// Validation complete, allocate and populate object.
pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t);
self->base.type = &pixelbuf_pixelbuf_type;
self->pixels = args[ARG_size].u_int;
self->bytes = bytes;
self->byteorder = byteorder_details; // Copied because we modify for dotstar
self->bytearray = args[ARG_buf].u_obj;
self->two_buffers = two_buffers;
self->rawbytearray = two_buffers ? args[ARG_rawbuf].u_obj : NULL;
self->offset = offset;
self->buf = (uint8_t *)bufinfo.buf + offset;
self->rawbuf = two_buffers ? (uint8_t *)rawbufinfo.buf + offset : NULL;
self->pixel_step = effective_bpp;
self->auto_write = args[ARG_auto_write].u_bool;
if (args[ARG_brightness].u_obj == mp_const_none) {
self->brightness = 1.0;
} else {
self->brightness = mp_obj_get_float(args[ARG_brightness].u_obj);
if (self->brightness < 0)
self->brightness = 0;
else if (self->brightness > 1)
self->brightness = 1;
}
if (self->byteorder.is_dotstar) {
// Initialize the buffer with the dotstar start bytes.
// Note: Header and end must be setup by caller
for (uint i = 0; i < self->pixels * 4; i += 4) {
self->buf[i] = DOTSTAR_LED_START_FULL_BRIGHT;
if (two_buffers) {
self->rawbuf[i] = DOTSTAR_LED_START_FULL_BRIGHT;
}
}
}
return MP_OBJ_FROM_PTR(self);
}
// Helper to ensure we have the native super class instead of a subclass.
static pixelbuf_pixelbuf_obj_t* native_pixelbuf(mp_obj_t pixelbuf_obj) {
mp_obj_t native_pixelbuf = mp_instance_cast_to_native_base(pixelbuf_obj, &pixelbuf_pixelbuf_type);
mp_obj_assert_native_inited(native_pixelbuf);
return MP_OBJ_TO_PTR(native_pixelbuf);
}
//| .. attribute:: bpp
@ -191,8 +161,7 @@ static pixelbuf_pixelbuf_obj_t* native_pixelbuf(mp_obj_t pixelbuf_obj) {
//| The number of bytes per pixel in the buffer (read-only)
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
return mp_obj_new_int_from_uint(self->byteorder.bpp);
return MP_OBJ_NEW_SMALL_INT(common_hal__pixelbuf_pixelbuf_get_bpp(self_in));
}
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_bpp_obj, pixelbuf_pixelbuf_obj_get_bpp);
@ -207,30 +176,24 @@ const mp_obj_property_t pixelbuf_pixelbuf_bpp_obj = {
//| .. attribute:: brightness
//|
//| Float value between 0 and 1. Output brightness.
//| If the PixelBuf was allocated with two both a buf and a rawbuf,
//| setting this value causes a recomputation of the values in buf.
//| If only a buf was provided, then the brightness only applies to
//| future pixel changes.
//| In DotStar mode
//|
//| When brightness is less than 1.0, a second buffer will be used to store the color values
//| before they are adjusted for brightness.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
return mp_obj_new_float(self->brightness);
return mp_obj_new_float(common_hal__pixelbuf_pixelbuf_get_brightness(self_in));
}
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_brightness_obj, pixelbuf_pixelbuf_obj_get_brightness);
STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_brightness(mp_obj_t self_in, mp_obj_t value) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
self->brightness = mp_obj_float_get(value);
if (self->brightness > 1)
self->brightness = 1;
else if (self->brightness < 0)
self->brightness = 0;
if (self->two_buffers)
pixelbuf_recalculate_brightness(self);
if (self->auto_write)
pixelbuf_call_show(self_in);
mp_float_t brightness = mp_obj_float_get(value);
if (brightness > 1) {
brightness = 1;
} else if (brightness < 0) {
brightness = 0;
}
common_hal__pixelbuf_pixelbuf_set_brightness(self_in, brightness);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_brightness_obj, pixelbuf_pixelbuf_obj_set_brightness);
@ -242,37 +205,18 @@ const mp_obj_property_t pixelbuf_pixelbuf_brightness_obj = {
(mp_obj_t)&mp_const_none_obj},
};
void pixelbuf_recalculate_brightness(pixelbuf_pixelbuf_obj_t *self) {
uint8_t *buf = (uint8_t *)self->buf;
uint8_t *rawbuf = (uint8_t *)self->rawbuf;
// Compensate for shifted buffer (bpp=3 dotstar)
for (uint i = 0; i < self->bytes; i++) {
// Don't adjust per-pixel luminance bytes in dotstar mode
if (!self->byteorder.is_dotstar || (i % 4 != 0))
buf[i] = rawbuf[i] * self->brightness;
}
}
mp_obj_t pixelbuf_call_show(mp_obj_t self_in) {
mp_obj_t dest[2];
mp_load_method(self_in, MP_QSTR_show, dest);
return mp_call_method_n_kw(0, 0, dest);
}
//| .. attribute:: auto_write
//|
//| Whether to automatically write the pixels after each update.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
return mp_obj_new_bool(self->auto_write);
return mp_obj_new_bool(common_hal__pixelbuf_pixelbuf_get_auto_write(self_in));
}
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_auto_write_obj, pixelbuf_pixelbuf_obj_get_auto_write);
STATIC mp_obj_t pixelbuf_pixelbuf_obj_set_auto_write(mp_obj_t self_in, mp_obj_t value) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
self->auto_write = mp_obj_is_true(value);
common_hal__pixelbuf_pixelbuf_set_auto_write(self_in, mp_obj_is_true(value));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_set_auto_write_obj, pixelbuf_pixelbuf_obj_set_auto_write);
@ -284,33 +228,12 @@ const mp_obj_property_t pixelbuf_pixelbuf_auto_write_obj = {
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: buf
//|
//| (read-only) bytearray of pixel data after brightness adjustment. If an offset was provided
//| then this bytearray is the subset of the bytearray passed in that represents the
//| actual pixels.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_buf(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
return mp_obj_new_bytearray_by_ref(self->bytes, self->buf);
}
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_buf_obj, pixelbuf_pixelbuf_obj_get_buf);
const mp_obj_property_t pixelbuf_pixelbuf_buf_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&pixelbuf_pixelbuf_get_buf_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
//| .. attribute:: byteorder
//|
//| byteorder string for the buffer (read-only)
//|
STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
return self->byteorder.order;
return common_hal__pixelbuf_pixelbuf_get_byteorder_string(self_in);
}
MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_get_byteorder_str, pixelbuf_pixelbuf_obj_get_byteorder);
@ -322,32 +245,49 @@ const mp_obj_property_t pixelbuf_pixelbuf_byteorder_str = {
};
STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
switch (op) {
case MP_UNARY_OP_BOOL: return mp_const_true;
case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->pixels);
case MP_UNARY_OP_LEN:
return MP_OBJ_NEW_SMALL_INT(common_hal__pixelbuf_pixelbuf_get_len(self_in));
default: return MP_OBJ_NULL; // op not supported
}
}
//| .. method:: show()
//|
//| Must be implemented in subclasses.
//| Transmits the color data to the pixels so that they are shown. This is done automatically
//| when `auto_write` is True.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) {
mp_raise_NotImplementedError(NULL);
common_hal__pixelbuf_pixelbuf_show(self_in);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show);
//| .. function:: fill(color)
//|
//| Fills the given pixelbuf with the given color.
//|
STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) {
common_hal__pixelbuf_pixelbuf_fill(self_in, value);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill);
//| .. method:: __getitem__(index)
//|
//| Returns the pixel value at the given index.
//| Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values
//| between 0 and 255.
//|
//| .. method:: __setitem__(index, value)
//|
//| Sets the pixel value at the given index.
//| Sets the pixel value at the given index. Value can either be a tuple of (Red, Green, Blue
//| [, White]) values between 0 and 255 or an integer where the red, green and blue values are
//| packed into the lower three bytes (0xRRGGBB).
//|
STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) {
if (value == MP_OBJ_NULL) {
@ -356,32 +296,34 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
return MP_OBJ_NULL; // op not supported
}
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
if (0) {
#if MICROPY_PY_BUILTINS_SLICE
} else if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
mp_bound_slice_t slice;
mp_seq_get_fast_slice_indexes(self->pixels, index_in, &slice);
size_t length = common_hal__pixelbuf_pixelbuf_get_len(self_in);
mp_seq_get_fast_slice_indexes(length, index_in, &slice);
if ((slice.stop * self->pixel_step) > self->bytes)
mp_raise_IndexError(translate("Range out of bounds"));
if (slice.step < 0)
if (slice.step < 0) {
mp_raise_IndexError(translate("Negative step not supported"));
}
if (value == MP_OBJ_SENTINEL) { // Get
size_t len = slice.stop - slice.start;
if (slice.step > 1) {
len = (len / slice.step) + (len % slice.step ? 1 : 0);
}
uint8_t *readbuf = self->two_buffers ? self->rawbuf : self->buf;
return pixelbuf_get_pixel_array(readbuf + slice.start, len, &self->byteorder, self->pixel_step, slice.step, self->byteorder.is_dotstar);
mp_obj_tuple_t* t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL));
for (uint i = 0; i < len; i++) {
t->items[i] = common_hal__pixelbuf_pixelbuf_get_pixel(self_in, i * slice.step);
}
return MP_OBJ_FROM_PTR(t);
} else { // Set
#if MICROPY_PY_ARRAY_SLICE_ASSIGN
if (!(MP_OBJ_IS_TYPE(value, &mp_type_list) || MP_OBJ_IS_TYPE(value, &mp_type_tuple)))
if (!(MP_OBJ_IS_TYPE(value, &mp_type_list) || MP_OBJ_IS_TYPE(value, &mp_type_tuple))) {
mp_raise_ValueError(translate("tuple/list required on RHS"));
}
size_t dst_len = (slice.stop - slice.start);
if (slice.step > 1) {
@ -398,21 +340,12 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
num_items = l->len;
src_objs = l->items;
}
if (num_items != dst_len)
if (num_items != dst_len) {
mp_raise_ValueError_varg(translate("Unmatched number of items on RHS (expected %d, got %d)."),
dst_len, num_items);
size_t target_i = slice.start;
for (size_t i = slice.start; target_i < slice.stop; i++, target_i += slice.step) {
mp_obj_t *item = src_objs[i-slice.start];
if (MP_OBJ_IS_TYPE(value, &mp_type_list) || MP_OBJ_IS_TYPE(value, &mp_type_tuple) || MP_OBJ_IS_INT(value)) {
pixelbuf_set_pixel(self->buf + (target_i * self->pixel_step),
self->two_buffers ? self->rawbuf + (i * self->pixel_step) : NULL,
self->brightness, item, &self->byteorder, self->byteorder.is_dotstar);
}
}
if (self->auto_write)
pixelbuf_call_show(self_in);
common_hal__pixelbuf_pixelbuf_set_pixels(self_in, slice.start, slice.stop, slice.step, src_objs);
return mp_const_none;
#else
return MP_OBJ_NULL; // op not supported
@ -420,19 +353,13 @@ STATIC mp_obj_t pixelbuf_pixelbuf_subscr(mp_obj_t self_in, mp_obj_t index_in, mp
}
#endif
} else { // Single index rather than slice.
size_t index = mp_get_index(self->base.type, self->pixels, index_in, false);
size_t offset = (index * self->pixel_step);
if (offset > self->bytes)
mp_raise_IndexError(translate("Pixel beyond bounds of buffer"));
size_t length = common_hal__pixelbuf_pixelbuf_get_len(self_in);
size_t index = mp_get_index(mp_obj_get_type(self_in), length, index_in, false);
if (value == MP_OBJ_SENTINEL) { // Get
uint8_t *pixelstart = (uint8_t *)(self->two_buffers ? self->rawbuf : self->buf) + offset;
return pixelbuf_get_pixel(pixelstart, &self->byteorder, self->byteorder.is_dotstar);
return common_hal__pixelbuf_pixelbuf_get_pixel(self_in, index);
} else { // Store
pixelbuf_set_pixel(self->buf + offset, self->two_buffers ? self->rawbuf + offset : NULL,
self->brightness, value, &self->byteorder, self->byteorder.is_dotstar);
if (self->auto_write)
pixelbuf_call_show(self_in);
common_hal__pixelbuf_pixelbuf_set_pixel(self_in, index, value);
return mp_const_none;
}
}
@ -442,9 +369,9 @@ STATIC const mp_rom_map_elem_t pixelbuf_pixelbuf_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_auto_write), MP_ROM_PTR(&pixelbuf_pixelbuf_auto_write_obj)},
{ MP_ROM_QSTR(MP_QSTR_bpp), MP_ROM_PTR(&pixelbuf_pixelbuf_bpp_obj)},
{ MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&pixelbuf_pixelbuf_brightness_obj)},
{ MP_ROM_QSTR(MP_QSTR_buf), MP_ROM_PTR(&pixelbuf_pixelbuf_buf_obj)},
{ MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelbuf_pixelbuf_byteorder_str)},
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pixelbuf_pixelbuf_show_obj)},
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelbuf_pixelbuf_fill_obj)},
};
STATIC MP_DEFINE_CONST_DICT(pixelbuf_pixelbuf_locals_dict, pixelbuf_pixelbuf_locals_dict_table);

View File

@ -27,27 +27,26 @@
#ifndef CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
#define CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H
#include "shared-bindings/_pixelbuf/types.h"
#include "shared-module/_pixelbuf/PixelBuf.h"
const mp_obj_type_t pixelbuf_pixelbuf_type;
typedef struct {
mp_obj_base_t base;
size_t pixels;
size_t bytes;
size_t pixel_step;
pixelbuf_byteorder_details_t byteorder;
mp_obj_t bytearray;
mp_obj_t rawbytearray;
mp_float_t brightness;
bool two_buffers;
size_t offset;
uint8_t *rawbuf;
uint8_t *buf;
bool auto_write;
} pixelbuf_pixelbuf_obj_t;
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write, uint8_t* header,
size_t header_len, uint8_t* trailer, size_t trailer_len);
void pixelbuf_recalculate_brightness(pixelbuf_pixelbuf_obj_t *self);
mp_obj_t pixelbuf_call_show(mp_obj_t self_in);
// These take mp_obj_t because they are called on subclasses of PixelBuf.
uint8_t common_hal__pixelbuf_pixelbuf_get_bpp(mp_obj_t self);
mp_float_t common_hal__pixelbuf_pixelbuf_get_brightness(mp_obj_t self);
void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self, mp_float_t brightness);
bool common_hal__pixelbuf_pixelbuf_get_auto_write(mp_obj_t self);
void common_hal__pixelbuf_pixelbuf_set_auto_write(mp_obj_t self, bool auto_write);
size_t common_hal__pixelbuf_pixelbuf_get_len(mp_obj_t self_in);
mp_obj_t common_hal__pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self);
void common_hal__pixelbuf_pixelbuf_fill(mp_obj_t self, mp_obj_t item);
void common_hal__pixelbuf_pixelbuf_show(mp_obj_t self);
mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self, size_t index);
void common_hal__pixelbuf_pixelbuf_set_pixel(mp_obj_t self, size_t index, mp_obj_t item);
void common_hal__pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, size_t stop, size_t step, mp_obj_t* values);
#endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H

View File

@ -29,11 +29,8 @@
#include "py/runtime.h"
#include "py/objproperty.h"
#include "types.h"
#include "__init__.h"
#include "PixelBuf.h"
#include "../../shared-module/_pixelbuf/PixelBuf.h"
#include "shared-bindings/_pixelbuf/__init__.h"
#include "shared-bindings/_pixelbuf/PixelBuf.h"
//| :mod:`_pixelbuf` --- Fast RGB(W) pixel buffer and helpers
@ -82,39 +79,15 @@ const int32_t colorwheel(float pos) {
}
}
//| .. function:: fill(pixelbuf, color)
//|
//| Fills the given pixelbuf with the given color.
//|
STATIC mp_obj_t pixelbuf_fill(mp_obj_t pixelbuf_in, mp_obj_t value) {
mp_obj_t obj = mp_instance_cast_to_native_base(pixelbuf_in, &pixelbuf_pixelbuf_type);
if (obj == MP_OBJ_NULL)
mp_raise_TypeError(translate("Expected a PixelBuf instance"));
pixelbuf_pixelbuf_obj_t *pixelbuf = MP_OBJ_TO_PTR(obj);
for (size_t offset = 0; offset < pixelbuf->bytes; offset+= pixelbuf->pixel_step) {
pixelbuf_set_pixel(pixelbuf->buf + offset, pixelbuf->two_buffers ? (pixelbuf->rawbuf + offset) : NULL,
pixelbuf->brightness, value, &pixelbuf->byteorder, pixelbuf->byteorder.is_dotstar);
}
if (pixelbuf->auto_write)
pixelbuf_call_show(pixelbuf_in);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_fill_obj, pixelbuf_fill);
STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelbuf) },
{ MP_ROM_QSTR(MP_QSTR_PixelBuf), MP_ROM_PTR(&pixelbuf_pixelbuf_type) },
{ MP_ROM_QSTR(MP_QSTR_wheel), MP_ROM_PTR(&pixelbuf_wheel_obj) },
{ MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelbuf_fill_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pixelbuf_module_globals, pixelbuf_module_globals_table);
const mp_obj_module_t pixelbuf_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&pixelbuf_module_globals,
.base = { &mp_type_module },
.globals = (mp_obj_dict_t*)&pixelbuf_module_globals,
};

View File

@ -30,6 +30,5 @@
#include "common-hal/digitalio/DigitalInOut.h"
const int32_t colorwheel(float pos);
extern void common_hal_neopixel_write(const digitalio_digitalinout_obj_t* gpio, uint8_t *pixels, uint32_t numBytes);
#endif //CP_SHARED_BINDINGS_PIXELBUF_INIT_H

View File

@ -1,47 +0,0 @@
/*
* This file is part of the Circuit Python project, https://github.com/adafruit/circuitpython
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Roy Hooper
*
* 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 CIRCUITPYTHON_PIXELBUF_TYPES_H
#define CIRCUITPYTHON_PIXELBUF_TYPES_H
//| :orphan:
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t w;
} pixelbuf_rgbw_t;
typedef struct {
uint8_t bpp;
pixelbuf_rgbw_t byteorder;
bool has_white;
bool is_dotstar;
mp_obj_t *order;
} pixelbuf_byteorder_details_t;
#endif // CIRCUITPYTHON_PIXELBUF_TYPES_H

View File

@ -118,7 +118,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_o
STATIC mp_obj_t displayio_i2cdisplay_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) {
mp_raise_ValueError(translate("Command must be 0-255"));
mp_raise_ValueError(translate("Command must be an int between 0 and 255"));
}
uint8_t command = command_int;
mp_buffer_info_t bufinfo;

View File

@ -26,95 +26,263 @@
#include "py/obj.h"
#include "py/objarray.h"
#include "py/objstr.h"
#include "py/objtype.h"
#include "py/runtime.h"
#include "PixelBuf.h"
#include "shared-bindings/_pixelbuf/PixelBuf.h"
#include <string.h>
void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_details_t *byteorder) {
buf[byteorder->byteorder.r] = value >> 16 & 0xff;
buf[byteorder->byteorder.g] = (value >> 8) & 0xff;
buf[byteorder->byteorder.b] = value & 0xff;
if (byteorder->bpp == 4 && byteorder->has_white &&
(buf[byteorder->byteorder.r] == buf[byteorder->byteorder.g] &&
buf[byteorder->byteorder.r] == buf[byteorder->byteorder.b])) {
buf[byteorder->byteorder.w] = buf[byteorder->byteorder.r];
buf[byteorder->byteorder.r] = buf[byteorder->byteorder.g] = buf[byteorder->byteorder.b] = 0;
// Helper to ensure we have the native super class instead of a subclass.
static pixelbuf_pixelbuf_obj_t* native_pixelbuf(mp_obj_t pixelbuf_obj) {
mp_obj_t native_pixelbuf = mp_instance_cast_to_native_base(pixelbuf_obj, &pixelbuf_pixelbuf_type);
mp_obj_assert_native_inited(native_pixelbuf);
return MP_OBJ_TO_PTR(native_pixelbuf);
}
void common_hal__pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
pixelbuf_byteorder_details_t* byteorder, mp_float_t brightness, bool auto_write,
uint8_t* header, size_t header_len, uint8_t* trailer, size_t trailer_len) {
self->pixel_count = n;
self->byteorder = *byteorder; // Copied because we modify for dotstar
self->bytes_per_pixel = byteorder->is_dotstar ? 4 : byteorder->bpp;
self->auto_write = false;
size_t pixel_len = self->pixel_count * self->bytes_per_pixel;
self->transmit_buffer_obj = mp_obj_new_bytes_of_zeros(header_len + pixel_len + trailer_len);
mp_obj_str_t *o = MP_OBJ_TO_PTR(self->transmit_buffer_obj);
// Abuse the bytes object a bit by mutating it's data by dropping the const. If the user's
// Python code holds onto it, they'll find out that it changes. At least this way it isn't
// mutable by the code itself.
uint8_t* transmit_buffer = (uint8_t*) o->data;
memcpy(transmit_buffer, header, header_len);
memcpy(transmit_buffer + header_len + pixel_len, trailer, trailer_len);
self->post_brightness_buffer = transmit_buffer + header_len;
if (self->byteorder.is_dotstar) {
// Initialize the buffer with the dotstar start bytes.
// Note: Header and end must be setup by caller
for (uint i = 0; i < self->pixel_count * 4; i += 4) {
self->post_brightness_buffer[i] = DOTSTAR_LED_START_FULL_BRIGHT;
}
}
// Call set_brightness so that it can allocate a second buffer if needed.
self->brightness = 1.0;
common_hal__pixelbuf_pixelbuf_set_brightness(MP_OBJ_FROM_PTR(self), brightness);
// Turn on auto_write. We don't want to do it with the above brightness call.
self->auto_write = auto_write;
}
size_t common_hal__pixelbuf_pixelbuf_get_len(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
return self->pixel_count;
}
uint8_t common_hal__pixelbuf_pixelbuf_get_bpp(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
return self->byteorder.bpp;
}
mp_obj_t common_hal__pixelbuf_pixelbuf_get_byteorder_string(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
return self->byteorder.order_string;
}
bool common_hal__pixelbuf_pixelbuf_get_auto_write(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
return self->auto_write;
}
void common_hal__pixelbuf_pixelbuf_set_auto_write(mp_obj_t self_in, bool auto_write) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
self->auto_write = auto_write;
}
mp_float_t common_hal__pixelbuf_pixelbuf_get_brightness(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
return self->brightness;
}
void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_float_t brightness) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
// Skip out if the brightness is already set. The default of self->brightness is 1.0. So, this
// also prevents the pre_brightness_buffer allocation when brightness is set to 1.0 again.
mp_float_t change = brightness - self->brightness;
if (-0.001 < change && change < 0.001) {
return;
}
self->brightness = brightness;
size_t pixel_len = self->pixel_count * self->bytes_per_pixel;
if (self->pre_brightness_buffer == NULL) {
self->pre_brightness_buffer = m_malloc(pixel_len, false);
memcpy(self->pre_brightness_buffer, self->post_brightness_buffer, pixel_len);
}
for (size_t i = 0; i < pixel_len; i++) {
// Don't adjust per-pixel luminance bytes in dotstar mode
if (self->byteorder.is_dotstar && i % 4 == 0) {
continue;
}
self->post_brightness_buffer[i] = self->pre_brightness_buffer[i] * self->brightness;
}
if (self->auto_write) {
common_hal__pixelbuf_pixelbuf_show(self_in);
}
}
void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_details_t *byteorder, bool dotstar) {
if (MP_OBJ_IS_INT(item)) {
uint8_t *target = rawbuf ? rawbuf : buf;
pixelbuf_set_pixel_int(target, mp_obj_get_int_truncated(item), byteorder);
if (dotstar) {
buf[0] = DOTSTAR_LED_START_FULL_BRIGHT;
if (rawbuf)
rawbuf[0] = DOTSTAR_LED_START_FULL_BRIGHT;
}
if (rawbuf) {
buf[byteorder->byteorder.r] = rawbuf[byteorder->byteorder.r] * brightness;
buf[byteorder->byteorder.g] = rawbuf[byteorder->byteorder.g] * brightness;
buf[byteorder->byteorder.b] = rawbuf[byteorder->byteorder.b] * brightness;
} else {
buf[byteorder->byteorder.r] *= brightness;
buf[byteorder->byteorder.g] *= brightness;
buf[byteorder->byteorder.b] *= brightness;
void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t* self, mp_obj_t color, uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* w) {
pixelbuf_byteorder_details_t *byteorder = &self->byteorder;
// w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have
// per-pixel brightness). Set the defaults here in case it isn't set below.
if (byteorder->is_dotstar) {
*w = 255;
} else {
*w = 0;
}
if (MP_OBJ_IS_INT(color)) {
mp_int_t value = mp_obj_get_int_truncated(color);
*r = value >> 16 & 0xff;
*g = (value >> 8) & 0xff;
*b = value & 0xff;
// Int colors can't set white directly so convert to white when all components are equal.
if (!byteorder->is_dotstar && byteorder->bpp == 4 && byteorder->has_white && *r == *g && *r == *b) {
*w = *r;
*r = 0;
*g = 0;
*b = 0;
}
} else {
mp_obj_t *items;
size_t len;
mp_obj_get_array(item, &len, &items);
if (len != byteorder->bpp && !dotstar)
mp_obj_get_array(color, &len, &items);
if (len != byteorder->bpp && !byteorder->is_dotstar) {
mp_raise_ValueError_varg(translate("Expected tuple of length %d, got %d"), byteorder->bpp, len);
buf[byteorder->byteorder.r] = mp_obj_get_int_truncated(items[PIXEL_R]) * brightness;
buf[byteorder->byteorder.g] = mp_obj_get_int_truncated(items[PIXEL_G]) * brightness;
buf[byteorder->byteorder.b] = mp_obj_get_int_truncated(items[PIXEL_B]) * brightness;
if (rawbuf) {
rawbuf[byteorder->byteorder.r] = mp_obj_get_int_truncated(items[PIXEL_R]);
rawbuf[byteorder->byteorder.g] = mp_obj_get_int_truncated(items[PIXEL_G]);
rawbuf[byteorder->byteorder.b] = mp_obj_get_int_truncated(items[PIXEL_B]);
}
*r = mp_obj_get_int_truncated(items[PIXEL_R]);
*g = mp_obj_get_int_truncated(items[PIXEL_G]);
*b = mp_obj_get_int_truncated(items[PIXEL_B]);
if (len > 3) {
if (dotstar) {
buf[byteorder->byteorder.w] = DOTSTAR_LED_START | DOTSTAR_BRIGHTNESS(mp_obj_get_float(items[PIXEL_W]));
if (rawbuf)
rawbuf[byteorder->byteorder.w] = buf[byteorder->byteorder.w];
if (mp_obj_is_float(items[PIXEL_W])) {
*w = 255 * mp_obj_get_float(items[PIXEL_W]);
} else {
buf[byteorder->byteorder.w] = mp_obj_get_int_truncated(items[PIXEL_W]) * brightness;
if (rawbuf)
rawbuf[byteorder->byteorder.w] = mp_obj_get_int_truncated(items[PIXEL_W]);
*w = mp_obj_get_int_truncated(items[PIXEL_W]);
}
} else if (dotstar) {
buf[byteorder->byteorder.w] = DOTSTAR_LED_START_FULL_BRIGHT;
if (rawbuf)
rawbuf[byteorder->byteorder.w] = DOTSTAR_LED_START_FULL_BRIGHT;
}
}
}
mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_details_t *byteorder, uint8_t step, mp_int_t slice_step, bool dotstar) {
mp_obj_t elems[len];
for (uint i = 0; i < len; i++) {
elems[i] = pixelbuf_get_pixel(buf + ((i * slice_step) * step), byteorder, dotstar);
void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t* self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) {
// DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right
// by three to leave the top five bits.
if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) {
w = DOTSTAR_LED_START | w >> 3;
}
return mp_obj_new_tuple(len, elems);
}
pixelbuf_rgbw_t *rgbw_order = &self->byteorder.byteorder;
size_t offset = index * self->bytes_per_pixel;
if (self->pre_brightness_buffer != NULL) {
uint8_t* pre_brightness_buffer = self->pre_brightness_buffer + offset;
if (self->bytes_per_pixel == 4) {
pre_brightness_buffer[rgbw_order->w] = w;
}
mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_details_t *byteorder, bool dotstar) {
mp_obj_t elems[byteorder->bpp];
elems[0] = mp_obj_new_int(buf[byteorder->byteorder.r]);
elems[1] = mp_obj_new_int(buf[byteorder->byteorder.g]);
elems[2] = mp_obj_new_int(buf[byteorder->byteorder.b]);
if (byteorder->bpp > 3)
{
if (dotstar)
elems[3] = mp_obj_new_float(DOTSTAR_GET_BRIGHTNESS(buf[byteorder->byteorder.w]));
else
elems[3] = mp_obj_new_int(buf[byteorder->byteorder.w]);
pre_brightness_buffer[rgbw_order->r] = r;
pre_brightness_buffer[rgbw_order->g] = g;
pre_brightness_buffer[rgbw_order->b] = b;
}
return mp_obj_new_tuple(byteorder->bpp, elems);
uint8_t* post_brightness_buffer = self->post_brightness_buffer + offset;
if (self->bytes_per_pixel == 4) {
// Only apply brightness if w is actually white (aka not DotStar.)
if (!self->byteorder.is_dotstar) {
w *= self->brightness;
}
post_brightness_buffer[rgbw_order->w] = w;
}
post_brightness_buffer[rgbw_order->r] = r * self->brightness;
post_brightness_buffer[rgbw_order->g] = g * self->brightness;
post_brightness_buffer[rgbw_order->b] = b * self->brightness;
}
void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t* self, size_t index, mp_obj_t value) {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t w;
_pixelbuf_parse_color(self, value, &r, &g, &b, &w);
_pixelbuf_set_pixel_color(self, index, r, g, b, w);
}
void common_hal__pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, size_t stop, size_t step, mp_obj_t* values) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
size_t source_i = 0;
for (size_t target_i = start; target_i < stop; target_i += step) {
_pixelbuf_set_pixel(self, target_i, values[source_i]);
source_i++;
}
if (self->auto_write) {
common_hal__pixelbuf_pixelbuf_show(self_in);
}
}
void common_hal__pixelbuf_pixelbuf_set_pixel(mp_obj_t self_in, size_t index, mp_obj_t value) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
_pixelbuf_set_pixel(self, index, value);
if (self->auto_write) {
common_hal__pixelbuf_pixelbuf_show(self_in);
}
}
mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
mp_obj_t elems[self->byteorder.bpp];
uint8_t* pixel_buffer = self->post_brightness_buffer;
if (self->pre_brightness_buffer != NULL) {
pixel_buffer = self->pre_brightness_buffer;
}
pixelbuf_rgbw_t *rgbw_order = &self->byteorder.byteorder;
elems[0] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->r]);
elems[1] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->g]);
elems[2] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->b]);
if (self->byteorder.bpp > 3) {
uint8_t w = pixel_buffer[rgbw_order->w];
if (self->byteorder.is_dotstar) {
elems[3] = mp_obj_new_float((w & 0b00011111) / 31.0);
} else {
elems[3] = MP_OBJ_NEW_SMALL_INT(w);
}
}
return mp_obj_new_tuple(self->byteorder.bpp, elems);
}
void common_hal__pixelbuf_pixelbuf_show(mp_obj_t self_in) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
mp_obj_t dest[2 + 1];
mp_load_method(self_in, MP_QSTR__transmit, dest);
dest[2] = self->transmit_buffer_obj;
mp_call_method_n_kw(1, 0, dest);
}
void common_hal__pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) {
pixelbuf_pixelbuf_obj_t* self = native_pixelbuf(self_in);
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t w;
_pixelbuf_parse_color(self, fill_color, &r, &g, &b, &w);
for (size_t i = 0; i < self->pixel_count; i++) {
_pixelbuf_set_pixel_color(self, i, r, g, b, w);
}
if (self->auto_write) {
common_hal__pixelbuf_pixelbuf_show(self_in);
}
}

View File

@ -27,24 +27,45 @@
#include "py/obj.h"
#include "py/objarray.h"
#include "../../shared-bindings/_pixelbuf/types.h"
#ifndef PIXELBUF_SHARED_MODULE_H
#define PIXELBUF_SHARED_MODULE_H
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t w;
} pixelbuf_rgbw_t;
typedef struct {
uint8_t bpp;
pixelbuf_rgbw_t byteorder;
bool has_white;
bool is_dotstar;
mp_obj_t order_string;
} pixelbuf_byteorder_details_t;
typedef struct {
mp_obj_base_t base;
size_t pixel_count;
size_t bytes_per_pixel;
pixelbuf_byteorder_details_t byteorder;
mp_float_t brightness;
mp_obj_t transmit_buffer_obj;
// The post_brightness_buffer is offset into the buffer allocated in transmit_buffer_obj to
// account for any header.
uint8_t *post_brightness_buffer;
uint8_t *pre_brightness_buffer;
bool auto_write;
} pixelbuf_pixelbuf_obj_t;
#define PIXEL_R 0
#define PIXEL_G 1
#define PIXEL_B 2
#define PIXEL_W 3
#define DOTSTAR_LED_START 0b11100000
#define DOTSTAR_BRIGHTNESS(brightness) ((32 - (uint8_t)(32 - brightness * 31)) & 0b00011111)
#define DOTSTAR_GET_BRIGHTNESS(value) ((value & 0b00011111) / 31.0)
#define DOTSTAR_LED_START_FULL_BRIGHT 0xFF
void pixelbuf_set_pixel(uint8_t *buf, uint8_t *rawbuf, float brightness, mp_obj_t *item, pixelbuf_byteorder_details_t *byteorder, bool dotstar);
mp_obj_t *pixelbuf_get_pixel(uint8_t *buf, pixelbuf_byteorder_details_t *byteorder, bool dotstar);
mp_obj_t *pixelbuf_get_pixel_array(uint8_t *buf, uint len, pixelbuf_byteorder_details_t *byteorder, uint8_t step, mp_int_t slice_step, bool dotstar);
void pixelbuf_set_pixel_int(uint8_t *buf, mp_int_t value, pixelbuf_byteorder_details_t *byteorder);
#endif