Merge branch 'main' into set_mac
This commit is contained in:
commit
733bfbc10a
|
@ -7,15 +7,15 @@ msgstr ""
|
|||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||
"PO-Revision-Date: 2021-11-05 04:07+0000\n"
|
||||
"Last-Translator: hexthat <hexthat@gmail.com>\n"
|
||||
"PO-Revision-Date: 2021-11-12 18:46+0000\n"
|
||||
"Last-Translator: River Wang <urfdvw@gmail.com>\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
"Language: zh_Latn_pinyin\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 4.9-dev\n"
|
||||
"X-Generator: Weblate 4.9.1-dev\n"
|
||||
|
||||
#: main.c
|
||||
msgid ""
|
||||
|
@ -31,7 +31,7 @@ msgid ""
|
|||
"Code stopped by auto-reload.\n"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"zì dòng chóng xīn jiā zǎi tíng zhǐ de dài mǎ.\n"
|
||||
"dàimǎ de yùnxíng yīnwéi zìdòng chóngxīn jiāzǎi ér tíngzhǐ.\n"
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid ""
|
||||
|
@ -49,7 +49,7 @@ msgstr " Wénjiàn \"%q\""
|
|||
|
||||
#: py/obj.c
|
||||
msgid " File \"%q\", line %d"
|
||||
msgstr " Wénjiàn \"%q\", dì %d xíng"
|
||||
msgstr " Wénjiàn \"%q\", dì %d háng"
|
||||
|
||||
#: py/builtinhelp.c
|
||||
msgid " is of type %q\n"
|
||||
|
@ -119,7 +119,7 @@ msgstr "%q bì xū wéi %d-%d"
|
|||
|
||||
#: py/argcheck.c shared-bindings/gifio/GifWriter.c
|
||||
msgid "%q must be <= %d"
|
||||
msgstr ""
|
||||
msgstr "%q bì xū <= %d"
|
||||
|
||||
#: py/argcheck.c
|
||||
msgid "%q must be >= %d"
|
||||
|
@ -160,7 +160,7 @@ msgstr "%q bì xū shì 2 de gōng lǜ"
|
|||
|
||||
#: shared-bindings/wifi/Monitor.c
|
||||
msgid "%q out of bounds"
|
||||
msgstr ""
|
||||
msgstr "%q chāo chū jiè xiàn"
|
||||
|
||||
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
|
||||
#: shared-bindings/canio/Match.c
|
||||
|
@ -569,8 +569,9 @@ msgid "Bit depth must be multiple of 8."
|
|||
msgstr "Bǐtè shēndù bìxū shì 8 bèi yǐshàng."
|
||||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
#, fuzzy
|
||||
msgid "Bitmap size and bits per value must match"
|
||||
msgstr ""
|
||||
msgstr "wèi tú dà xiǎo hé měi gè zhí de bǐ tè wèi bì xū pǐ pèi"
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid "Boot device must be first device (interface #0)."
|
||||
|
@ -1008,7 +1009,7 @@ msgstr "FFT jǐn wéi ndarrays dìng yì"
|
|||
|
||||
#: extmod/ulab/code/numpy/fft/fft_tools.c
|
||||
msgid "FFT is implemented for linear arrays only"
|
||||
msgstr "FFT jǐn shì yòng yú xiàn xìng zhèn liè"
|
||||
msgstr "FFT jǐn shì yòng yú yī wéi shù zǔ"
|
||||
|
||||
#: ports/espressif/common-hal/ssl/SSLSocket.c
|
||||
msgid "Failed SSL handshake"
|
||||
|
@ -1097,10 +1098,13 @@ msgstr "gù jiàn yìng xiàng wú xiào"
|
|||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "For L8 colorspace, input bitmap must have 8 bits per pixel"
|
||||
msgstr ""
|
||||
"zài L8 sè yù zhōng, měi gè shū rù de xiàng sù bì xū shì 8 wèi (8 bit) shù jù"
|
||||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel"
|
||||
msgstr ""
|
||||
"zài GRB sè yù zhōng, měi gè shū rù de xiàng sù bì xū shì 16 wèi (16 bit) shù "
|
||||
"jù"
|
||||
|
||||
#: ports/cxd56/common-hal/camera/Camera.c
|
||||
msgid "Format not supported"
|
||||
|
@ -2308,7 +2312,7 @@ msgstr "bù kě yòng chù mō bào jǐng qì"
|
|||
|
||||
#: py/obj.c
|
||||
msgid "Traceback (most recent call last):\n"
|
||||
msgstr "Traceback (Zuìjìn yīcì dǎ diànhuà):\n"
|
||||
msgstr "Traceback (Zuìjìn yīcì diàoyòng zhǐlìng):\n"
|
||||
|
||||
#: shared-bindings/time/__init__.c
|
||||
msgid "Tuple or struct_time argument required"
|
||||
|
@ -2352,7 +2356,7 @@ msgstr "USB cuò wù"
|
|||
|
||||
#: shared-bindings/_bleio/UUID.c
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr "UUID zhěngshù zhí bìxū wèi 0-0xffff"
|
||||
msgstr "UUID de zhí bì xū shì 0-0xffff fàn wéi nèi de zhěng shù"
|
||||
|
||||
#: shared-bindings/_bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
|
@ -2385,11 +2389,11 @@ msgstr "Wúfǎ zhǎodào miǎnfèi de GCLK"
|
|||
|
||||
#: py/parse.c
|
||||
msgid "Unable to init parser"
|
||||
msgstr "Wúfǎ chūshǐ jiěxī qì"
|
||||
msgstr "Wúfǎ chūshǐhuà jiěxī qì"
|
||||
|
||||
#: shared-module/displayio/OnDiskBitmap.c
|
||||
msgid "Unable to read color palette data"
|
||||
msgstr "Wúfǎ dòu qǔ sè tiáo shùjù"
|
||||
msgstr "Wúfǎ dúqǔ tiáosèbǎn shùjù"
|
||||
|
||||
#: shared-bindings/nvm/ByteArray.c
|
||||
msgid "Unable to write to nvm."
|
||||
|
@ -2453,7 +2457,7 @@ msgstr "Bù zhīchí de baudrate"
|
|||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "Unsupported colorspace"
|
||||
msgstr ""
|
||||
msgstr "bú zhī chí de sè cǎi kōng jiān"
|
||||
|
||||
#: shared-module/displayio/display_core.c
|
||||
msgid "Unsupported display bus type"
|
||||
|
@ -2686,7 +2690,7 @@ msgstr "èrjìnzhì bǎn qián bǎn %q wèi zhíxíng"
|
|||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "bitmap sizes must match"
|
||||
msgstr ""
|
||||
msgstr "wèi tú dà xiǎo bì xū pǐ pèi"
|
||||
|
||||
#: extmod/modurandom.c
|
||||
msgid "bits must be 32 or less"
|
||||
|
@ -3587,7 +3591,7 @@ msgstr "jǔzhèn bùshì zhèngdìng de"
|
|||
#: ports/nrf/common-hal/_bleio/Descriptor.c
|
||||
#, c-format
|
||||
msgid "max_length must be 0-%d when fixed_length is %s"
|
||||
msgstr "Dāng gùdìng chángdù wèi %s shí, zuìdà chángdù bìxū wèi 0-%d"
|
||||
msgstr "dāng fixed_length de zhí wéi %s shí, max_length bì xū wéi 0-%d"
|
||||
|
||||
#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c
|
||||
msgid "max_length must be >= 0"
|
||||
|
@ -3636,7 +3640,7 @@ msgstr "zhǎo bù dào mókuài"
|
|||
|
||||
#: ports/espressif/common-hal/wifi/Monitor.c
|
||||
msgid "monitor init failed"
|
||||
msgstr ""
|
||||
msgstr "jiān shì qì chū shǐ huà shī bài"
|
||||
|
||||
#: extmod/ulab/code/numpy/poly.c
|
||||
msgid "more degrees of freedom than data points"
|
||||
|
@ -4195,14 +4199,17 @@ msgstr "yuán miànbǎn tài dà"
|
|||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "source_bitmap must have value_count of 2 or 65536"
|
||||
msgstr ""
|
||||
"yuán wèi tú (source_bitmap) de zhí de shù mù (value_count) bì xū shì 2 huò "
|
||||
"zhě 65536"
|
||||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "source_bitmap must have value_count of 65536"
|
||||
msgstr ""
|
||||
"yuán wèi tú (source_bitmap) de zhí de shù mù (value_count) bì xū shì 65536"
|
||||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "source_bitmap must have value_count of 8"
|
||||
msgstr ""
|
||||
msgstr "yuán wèi tú (source_bitmap) de zhí de shù mù (value_count) bì xū shì 8"
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "start/end indices"
|
||||
|
@ -4450,11 +4457,11 @@ msgstr "bù zhīchí de Xtensa zhǐlìng '%s', shǐyòng %d cānshù"
|
|||
|
||||
#: shared-module/gifio/GifWriter.c
|
||||
msgid "unsupported colorspace for GifWriter"
|
||||
msgstr ""
|
||||
msgstr "GifWriter bú zhī chí cǐ sè cǎi kōng jiān"
|
||||
|
||||
#: shared-bindings/bitmaptools/__init__.c
|
||||
msgid "unsupported colorspace for dither"
|
||||
msgstr ""
|
||||
msgstr "dither bú zhī chí cǐ sè cǎi kōng jiān"
|
||||
|
||||
#: py/objstr.c
|
||||
#, c-format
|
||||
|
|
|
@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
|
|||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_FULL_BUILD = 0
|
||||
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
void board_init(void) {
|
||||
// USB
|
||||
common_hal_never_reset_pin(&pin_GPIO19);
|
||||
common_hal_never_reset_pin(&pin_GPIO20);
|
||||
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
// display init sequence according to LilyGO example app
|
||||
uint8_t display_init_sequence[] = {
|
||||
// sw reset
|
||||
0x01, 0 | DELAY, 150,
|
||||
// sleep out
|
||||
0x11, 0 | DELAY, 255,
|
||||
// normal display mode on
|
||||
0x13, 0,
|
||||
// display and color format settings
|
||||
0x36, 1, 0x60,
|
||||
0xB6, 2, 0x0A, 0x82,
|
||||
0x3A, 1 | DELAY, 0x55, 10,
|
||||
// ST7789V frame rate setting
|
||||
0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
|
||||
// voltages: VGH / VGL
|
||||
0xB7, 1, 0x35,
|
||||
// ST7789V power setting
|
||||
0xBB, 1, 0x28,
|
||||
0xC0, 1, 0x0C,
|
||||
0xC2, 2, 0x01, 0xFF,
|
||||
0xC3, 1, 0x10,
|
||||
0xC4, 1, 0x20,
|
||||
0xC6, 1, 0x0F,
|
||||
0xD0, 2, 0xA4, 0xA1,
|
||||
// ST7789V gamma setting
|
||||
0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
|
||||
0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
|
||||
0x21, 0,
|
||||
// display on
|
||||
0x29, 0 | DELAY, 255,
|
||||
};
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
// USB
|
||||
common_hal_never_reset_pin(&pin_GPIO19);
|
||||
common_hal_never_reset_pin(&pin_GPIO20);
|
||||
|
||||
|
||||
busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus;
|
||||
|
||||
common_hal_busio_spi_construct(
|
||||
spi,
|
||||
&pin_GPIO36, // CLK
|
||||
&pin_GPIO35, // MOSI
|
||||
NULL // MISO not connected
|
||||
);
|
||||
|
||||
common_hal_busio_spi_never_reset(spi);
|
||||
|
||||
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO39, // DC
|
||||
&pin_GPIO21, // CS
|
||||
&pin_GPIO40, // RST
|
||||
40000000, // baudrate
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
||||
// workaround as board_init() is called before reset_port() in main.c
|
||||
pwmout_reset();
|
||||
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
135, // height (after rotation)
|
||||
40, // column start
|
||||
52, // row start
|
||||
0, // rotation
|
||||
16, // color depth
|
||||
false, // grayscale
|
||||
false, // pixels in a byte share a row. Only valid for depths < 8
|
||||
1, // bytes per cell. Only valid for depths < 8
|
||||
false, // reverse_pixels_in_byte. Only valid for depths < 8
|
||||
true, // reverse_pixels_in_word
|
||||
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
|
||||
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
|
||||
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
|
||||
display_init_sequence,
|
||||
sizeof(display_init_sequence),
|
||||
&pin_GPIO45, // backlight pin
|
||||
NO_BRIGHTNESS_COMMAND,
|
||||
1.0f, // brightness (ignored)
|
||||
false, // auto_brightness
|
||||
false, // single_byte_bounds
|
||||
false, // data_as_commands
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
|
@ -26,11 +26,11 @@
|
|||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM"
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32-S2 TFT"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34)
|
||||
|
||||
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
|
||||
|
||||
|
@ -38,9 +38,12 @@
|
|||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3)
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO41)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO42)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_GPIO2)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_GPIO1)
|
|
@ -1,6 +1,7 @@
|
|||
USB_VID = 0x239A
|
||||
USB_PID = 0x8FFF
|
||||
USB_PRODUCT = "Feather ESP32S2 no PSRAM"
|
||||
USB_PID = 0x8110
|
||||
|
||||
USB_PRODUCT = "Feather ESP32-S2 TFT"
|
||||
USB_MANUFACTURER = "Adafruit"
|
||||
|
||||
IDF_TARGET = esp32s2
|
||||
|
@ -17,8 +18,3 @@ CIRCUITPY_ESP_FLASH_FREQ=40m
|
|||
CIRCUITPY_ESP_FLASH_SIZE=4MB
|
||||
|
||||
CIRCUITPY_MODULE=wroom
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register
|
|
@ -1,15 +1,15 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_R2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
|
@ -41,8 +41,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
|
||||
|
@ -53,14 +53,21 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO42) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO45) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,33 @@
|
|||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM16=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
CONFIG_SPIRAM_SIZE=2097152
|
||||
|
||||
#
|
||||
# PSRAM clock and cs IO for ESP32S2
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM clock and cs IO for ESP32S2
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_SPEED_80M is not set
|
||||
CONFIG_SPIRAM_SPEED_40M=y
|
||||
# CONFIG_SPIRAM_SPEED_26M is not set
|
||||
# CONFIG_SPIRAM_SPEED_20M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
||||
# end of SPI RAM config
|
|
@ -29,6 +29,7 @@
|
|||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/displayio/__init__.h"
|
||||
#include "shared-bindings/displayio/Bitmap.h"
|
||||
|
||||
MAKE_ENUM_VALUE(displayio_colorspace_type, displayio_colorspace, RGB888, DISPLAYIO_COLORSPACE_RGB888);
|
||||
MAKE_ENUM_VALUE(displayio_colorspace_type, displayio_colorspace, RGB565, DISPLAYIO_COLORSPACE_RGB565);
|
||||
|
@ -78,6 +79,7 @@ MAKE_ENUM_TYPE(displayio, ColorSpace, displayio_colorspace);
|
|||
|
||||
STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_displayio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Bitmap), MP_ROM_PTR(&displayio_bitmap_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Colorspace), MP_ROM_PTR(&displayio_colorspace_type) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table);
|
||||
|
@ -87,4 +89,4 @@ const mp_obj_module_t displayio_module = {
|
|||
.globals = (mp_obj_dict_t *)&displayio_module_globals,
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module, CIRCUITPY_DISPLAYIO_COLORSPACE_ONLY);
|
||||
MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module, CIRCUITPY_DISPLAYIO_UNIX);
|
|
@ -27,10 +27,22 @@ SRC_C += $(SRC_QRIO)
|
|||
CFLAGS += -DCIRCUITPY_QRIO=1
|
||||
$(BUILD)/lib/quirc/lib/%.o: CFLAGS += -Wno-shadow -Wno-sign-compare -include shared-module/qrio/quirc_alloc.h
|
||||
|
||||
SRC_GIFIO := $(patsubst ../../%,%,$(wildcard ../../shared-bindings/gifio/*.c ../../shared-module/gifio/*.c)) shared/runtime/context_manager_helpers.c displayio_colorspace_only.c shared-module/displayio/ColorConverter.c shared-bindings/util.c
|
||||
SRC_C += $(SRC_GIFIO)
|
||||
SRC_BITMAP := \
|
||||
$(patsubst ../../%,%,$(wildcard ../../shared-bindings/gifio/*.c ../../shared-module/gifio/*.c)) \
|
||||
shared/runtime/context_manager_helpers.c \
|
||||
displayio_min.c \
|
||||
shared-bindings/displayio/Bitmap.c \
|
||||
shared-module/displayio/area.c \
|
||||
shared-module/displayio/Bitmap.c \
|
||||
shared-module/displayio/ColorConverter.c \
|
||||
shared-bindings/bitmaptools/__init__.c \
|
||||
shared-module/bitmaptools/__init__.c \
|
||||
shared-bindings/util.c \
|
||||
|
||||
CFLAGS += -DCIRCUITPY_GIFIO=1 -DCIRCUITPY_DISPLAYIO_COLORSPACE_ONLY=1
|
||||
$(info $(SRC_BITMAP))
|
||||
SRC_C += $(SRC_BITMAP)
|
||||
|
||||
CFLAGS += -DCIRCUITPY_GIFIO=1 -DCIRCUITPY_DISPLAYIO_UNIX=1 -DCIRCUITPY_BITMAPTOOLS=1
|
||||
|
||||
SRC_C += coverage.c
|
||||
SRC_CXX += coveragecpp.cpp
|
||||
|
|
|
@ -534,6 +534,7 @@ SRC_SHARED_MODULE_ALL = \
|
|||
displayio/Palette.c \
|
||||
displayio/Shape.c \
|
||||
displayio/TileGrid.c \
|
||||
displayio/area.c \
|
||||
displayio/__init__.c \
|
||||
fontio/BuiltinFont.c \
|
||||
fontio/__init__.c \
|
||||
|
|
|
@ -176,6 +176,10 @@ extern void common_hal_mcu_enable_interrupts(void);
|
|||
#define INT_FMT "%d"
|
||||
typedef int mp_int_t; // must be pointer size
|
||||
typedef unsigned mp_uint_t; // must be pointer size
|
||||
#if __GNUC__ >= 10 // on recent gcc versions we can check that this is so
|
||||
_Static_assert(sizeof(mp_int_t) == sizeof(void *));
|
||||
_Static_assert(sizeof(mp_uint_t) == sizeof(void *));
|
||||
#endif
|
||||
typedef long mp_off_t;
|
||||
|
||||
#define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)
|
||||
|
|
|
@ -553,7 +553,6 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
|
|||
mp_obj_exception_t *self = get_native_exception(self_in);
|
||||
|
||||
// Try to allocate memory for the traceback, with fallback to emergency traceback object
|
||||
|
||||
if (self->traceback == NULL || self->traceback == (mp_obj_traceback_t *)&mp_const_empty_traceback_obj) {
|
||||
self->traceback = m_new_obj_maybe(mp_obj_traceback_t);
|
||||
if (self->traceback == NULL) {
|
||||
|
@ -561,9 +560,11 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
|
|||
}
|
||||
}
|
||||
|
||||
// append this traceback info to traceback data
|
||||
// if memory allocation fails (eg because gc is locked), just return
|
||||
// populate traceback object
|
||||
*self->traceback = mp_const_empty_traceback_obj;
|
||||
|
||||
// append the provided traceback info to traceback data
|
||||
// if memory allocation fails (eg because gc is locked), just return
|
||||
if (self->traceback->data == NULL) {
|
||||
self->traceback->data = m_new_maybe(size_t, TRACEBACK_ENTRY_LEN);
|
||||
if (self->traceback->data == NULL) {
|
||||
|
|
|
@ -36,6 +36,13 @@
|
|||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#if MICROPY_VFS
|
||||
#include "extmod/vfs.h"
|
||||
#endif
|
||||
#if defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX
|
||||
#include "extmod/vfs_posix.h"
|
||||
#endif
|
||||
|
||||
//| """Collection of bitmap manipulation tools"""
|
||||
//|
|
||||
|
||||
|
@ -154,8 +161,8 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args
|
|||
ARG_angle, ARG_scale, ARG_skip_index};
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
|
||||
|
||||
{MP_QSTR_ox, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to destination->width / 2
|
||||
{MP_QSTR_oy, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to destination->height / 2
|
||||
|
@ -207,13 +214,13 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args
|
|||
args[ARG_source_clip1].u_obj, &source_clip1_x, &source_clip1_y);
|
||||
|
||||
// Confirm the angle value
|
||||
float angle = 0.0;
|
||||
mp_float_t angle = 0.0;
|
||||
if (args[ARG_angle].u_obj != mp_const_none) {
|
||||
angle = mp_obj_get_float(args[ARG_angle].u_obj);
|
||||
}
|
||||
|
||||
// Confirm the scale value
|
||||
float scale = 1.0;
|
||||
mp_float_t scale = 1.0;
|
||||
if (args[ARG_scale].u_obj != mp_const_none) {
|
||||
scale = mp_obj_get_float(args[ARG_scale].u_obj);
|
||||
}
|
||||
|
@ -269,10 +276,10 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args,
|
|||
enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2};
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_source_bitmap_1, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_source_bitmap_2, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}},
|
||||
{MP_QSTR_source_bitmap_1, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}},
|
||||
{MP_QSTR_source_bitmap_2, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}},
|
||||
{MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}},
|
||||
{MP_QSTR_factor_1, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}},
|
||||
{MP_QSTR_factor_2, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}},
|
||||
};
|
||||
|
@ -283,8 +290,8 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args,
|
|||
displayio_bitmap_t *source1 = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_source_bitmap_1].u_obj, &displayio_bitmap_type, MP_QSTR_source_bitmap_1)); // the first source bitmap
|
||||
displayio_bitmap_t *source2 = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_source_bitmap_2].u_obj, &displayio_bitmap_type, MP_QSTR_source_bitmap_2)); // the second source bitmap
|
||||
|
||||
float factor1 = (args[ARG_factor_1].u_obj == mp_const_none) ? .5f : mp_obj_float_get(args[ARG_factor_1].u_obj);
|
||||
float factor2 = (args[ARG_factor_2].u_obj == mp_const_none) ? 1 - factor1 : mp_obj_float_get(args[ARG_factor_2].u_obj);
|
||||
mp_float_t factor1 = (args[ARG_factor_1].u_obj == mp_const_none) ? MICROPY_FLOAT_CONST(.5) : mp_obj_float_get(args[ARG_factor_1].u_obj);
|
||||
mp_float_t factor2 = (args[ARG_factor_2].u_obj == mp_const_none) ? 1 - factor1 : mp_obj_float_get(args[ARG_factor_2].u_obj);
|
||||
|
||||
displayio_colorspace_t colorspace = (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj);
|
||||
|
||||
|
@ -346,12 +353,12 @@ STATIC mp_obj_t bitmaptools_obj_fill_region(size_t n_args, const mp_obj_t *pos_a
|
|||
enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value};
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_value, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_value, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
};
|
||||
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);
|
||||
|
@ -398,10 +405,10 @@ STATIC mp_obj_t bitmaptools_obj_boundary_fill(size_t n_args, const mp_obj_t *pos
|
|||
enum {ARG_dest_bitmap, ARG_x, ARG_y, ARG_fill_color_value, ARG_replaced_color_value};
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_fill_color_value, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_fill_color_value, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_replaced_color_value, MP_ARG_INT, {.u_int = INT_MAX} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
|
@ -461,12 +468,12 @@ STATIC mp_obj_t bitmaptools_obj_draw_line(size_t n_args, const mp_obj_t *pos_arg
|
|||
enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value};
|
||||
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_value, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_x1, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_y1, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_x2, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_y2, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
{MP_QSTR_value, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL}},
|
||||
};
|
||||
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);
|
||||
|
@ -532,8 +539,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_line_obj, 0, bitmaptools_obj_draw_li
|
|||
STATIC mp_obj_t bitmaptools_arrayblit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_bitmap, ARG_data, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_x1, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_y1, MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_x2, MP_ARG_INT, {.u_int = -1} },
|
||||
|
@ -598,9 +605,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_arrayblit_obj, 0, bitmaptools_arrayblit);
|
|||
STATIC mp_obj_t bitmaptools_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_bitmap, ARG_file, ARG_bits_per_pixel, ARG_element_size, ARG_reverse_pixels_in_element, ARG_swap_bytes_in_element, ARG_reverse_rows };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_file, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_bits_per_pixel, MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_file, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_bits_per_pixel, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_element_size, MP_ARG_INT, { .u_int = 1 } },
|
||||
{ MP_QSTR_reverse_pixels_in_element, MP_ARG_BOOL, { .u_bool = false } },
|
||||
{ MP_QSTR_swap_bytes_in_element, MP_ARG_BOOL, { .u_bool = false } },
|
||||
|
@ -682,9 +689,9 @@ MAKE_ENUM_TYPE(bitmaptools, DitherAlgorithm, bitmaptools_dither_algorithm);
|
|||
STATIC mp_obj_t bitmaptools_dither(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_dest_bitmap, ARG_source_bitmap, ARG_source_colorspace, ARG_algorithm };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_source_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_source_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_algorithm, MP_ARG_OBJ, { .u_obj = MP_ROM_PTR((void *)&dither_algorithm_Atkinson_obj) } },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
|
|
|
@ -46,8 +46,8 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16
|
|||
displayio_bitmap_t *source, int16_t px, int16_t py,
|
||||
int16_t source_clip0_x, int16_t source_clip0_y,
|
||||
int16_t source_clip1_x, int16_t source_clip1_y,
|
||||
float angle,
|
||||
float scale,
|
||||
mp_float_t angle,
|
||||
mp_float_t scale,
|
||||
uint32_t skip_index, bool skip_index_none);
|
||||
|
||||
void common_hal_bitmaptools_fill_region(displayio_bitmap_t *destination,
|
||||
|
@ -68,6 +68,6 @@ void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, pyb_file_obj_t *f
|
|||
void common_hal_bitmaptools_arrayblit(displayio_bitmap_t *self, void *data, int element_size, int x1, int y1, int x2, int y2, bool skip_specified, uint32_t skip_index);
|
||||
void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bitmap_t *source_bitmap, displayio_colorspace_t colorspace, bitmaptools_dither_algorithm_t algorithm);
|
||||
|
||||
void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, float factor1, float factor2);
|
||||
void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H
|
||||
|
|
|
@ -240,8 +240,8 @@ STATIC mp_obj_t canio_can_listen(size_t n_args, const mp_obj_t *pos_args, mp_map
|
|||
|
||||
enum { ARG_matches, ARG_timeout, NUM_ARGS };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_matches, MP_ARG_OBJ, {.u_obj = 0} },
|
||||
{ MP_QSTR_timeout, MP_ARG_OBJ, {.u_obj = 0} },
|
||||
{ MP_QSTR_matches, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_timeout, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "py/binary.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-bindings/util.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
|
@ -206,9 +205,9 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val
|
|||
STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum {ARG_x, ARG_y, ARG_source, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index};
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT},
|
||||
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ},
|
||||
{MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} },
|
||||
{MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} },
|
||||
{MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{MP_QSTR_x1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
//| Pin used to latch parallel data going into the shift register.
|
||||
//| :param bool value_to_latch: Pin state to latch data being read.
|
||||
//| ``True`` if the data is latched when ``latch`` goes high
|
||||
//| ``False`` if the data is latched when ``latch goes low.
|
||||
//| ``False`` if the data is latched when ``latch`` goes low.
|
||||
//| The default is ``True``, which is how the 74HC165 operates. The CD4021 latch is the opposite.
|
||||
//| Once the data is latched, it will be shifted out by toggling the clock pin.
|
||||
//| :param int key_count: number of data lines to clock in
|
||||
|
|
|
@ -44,8 +44,8 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16
|
|||
displayio_bitmap_t *source, int16_t px, int16_t py,
|
||||
int16_t source_clip0_x, int16_t source_clip0_y,
|
||||
int16_t source_clip1_x, int16_t source_clip1_y,
|
||||
float angle,
|
||||
float scale,
|
||||
mp_float_t angle,
|
||||
mp_float_t scale,
|
||||
uint32_t skip_index, bool skip_index_none) {
|
||||
|
||||
// Copies region from source to the destination bitmap, including rotation,
|
||||
|
@ -105,10 +105,10 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16
|
|||
int16_t maxx = dest_clip0_x;
|
||||
int16_t maxy = dest_clip0_y;
|
||||
|
||||
float sinAngle = sinf(angle);
|
||||
float cosAngle = cosf(angle);
|
||||
mp_float_t sinAngle = MICROPY_FLOAT_C_FUN(sin)(angle);
|
||||
mp_float_t cosAngle = MICROPY_FLOAT_C_FUN(cos)(angle);
|
||||
|
||||
float dx, dy;
|
||||
mp_float_t dx, dy;
|
||||
|
||||
/* Compute the position of where each corner on the source bitmap
|
||||
will be on the destination to get a bounding box for scanning */
|
||||
|
@ -186,27 +186,27 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16
|
|||
maxy = dest_clip1_y - 1;
|
||||
}
|
||||
|
||||
float dvCol = cosAngle / scale;
|
||||
float duCol = sinAngle / scale;
|
||||
mp_float_t dvCol = cosAngle / scale;
|
||||
mp_float_t duCol = sinAngle / scale;
|
||||
|
||||
float duRow = dvCol;
|
||||
float dvRow = -duCol;
|
||||
mp_float_t duRow = dvCol;
|
||||
mp_float_t dvRow = -duCol;
|
||||
|
||||
float startu = px - (ox * dvCol + oy * duCol);
|
||||
float startv = py - (ox * dvRow + oy * duRow);
|
||||
mp_float_t startu = px - (ox * dvCol + oy * duCol);
|
||||
mp_float_t startv = py - (ox * dvRow + oy * duRow);
|
||||
|
||||
float rowu = startu + miny * duCol;
|
||||
float rowv = startv + miny * dvCol;
|
||||
mp_float_t rowu = startu + miny * duCol;
|
||||
mp_float_t rowv = startv + miny * dvCol;
|
||||
|
||||
displayio_area_t dirty_area = {minx, miny, maxx + 1, maxy + 1};
|
||||
displayio_area_t dirty_area = {minx, miny, maxx + 1, maxy + 1, NULL};
|
||||
displayio_bitmap_set_dirty_area(self, &dirty_area);
|
||||
|
||||
for (y = miny; y <= maxy; y++) {
|
||||
float u = rowu + minx * duRow;
|
||||
float v = rowv + minx * dvRow;
|
||||
mp_float_t u = rowu + minx * duRow;
|
||||
mp_float_t v = rowv + minx * dvRow;
|
||||
for (x = minx; x <= maxx; x++) {
|
||||
if (u >= source_clip0_x && u < source_clip1_x && v >= source_clip0_y && v < source_clip1_y) {
|
||||
uint32_t c = common_hal_displayio_bitmap_get_pixel(source, u, v);
|
||||
uint32_t c = common_hal_displayio_bitmap_get_pixel(source, (int)u, (int)v);
|
||||
if ((skip_index_none) || (c != skip_index)) {
|
||||
displayio_bitmap_write_pixel(self, x, y, c);
|
||||
}
|
||||
|
@ -227,10 +227,10 @@ void common_hal_bitmaptools_fill_region(displayio_bitmap_t *destination,
|
|||
//
|
||||
// input checks should ensure that x1 < x2 and y1 < y2 and are within the bitmap region
|
||||
|
||||
displayio_area_t area = { x1, y1, x2, y2 };
|
||||
displayio_area_t area = { x1, y1, x2, y2, NULL };
|
||||
displayio_area_canon(&area);
|
||||
|
||||
displayio_area_t bitmap_area = { 0, 0, destination->width, destination->height };
|
||||
displayio_area_t bitmap_area = { 0, 0, destination->width, destination->height, NULL };
|
||||
displayio_area_compute_overlap(&area, &bitmap_area, &area);
|
||||
|
||||
// update the dirty rectangle
|
||||
|
@ -378,7 +378,7 @@ void common_hal_bitmaptools_boundary_fill(displayio_bitmap_t *destination,
|
|||
}
|
||||
|
||||
// set dirty the area so displayio will draw
|
||||
displayio_area_t area = { minx, miny, maxx + 1, maxy + 1};
|
||||
displayio_area_t area = { minx, miny, maxx + 1, maxy + 1, NULL};
|
||||
displayio_bitmap_set_dirty_area(destination, &area);
|
||||
|
||||
}
|
||||
|
@ -408,8 +408,8 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination,
|
|||
ybb0 = y1;
|
||||
ybb1 = y0 + 1;
|
||||
}
|
||||
displayio_area_t area = { xbb0, ybb0, xbb1, ybb1 };
|
||||
displayio_area_t bitmap_area = { 0, 0, destination->width, destination->height };
|
||||
displayio_area_t area = { xbb0, ybb0, xbb1, ybb1, NULL };
|
||||
displayio_area_t bitmap_area = { 0, 0, destination->width, destination->height, NULL };
|
||||
displayio_area_compute_overlap(&area, &bitmap_area, &area);
|
||||
|
||||
displayio_bitmap_set_dirty_area(destination, &area);
|
||||
|
@ -460,7 +460,7 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination,
|
|||
dx = x1 - x0;
|
||||
dy = abs(y1 - y0);
|
||||
|
||||
float err = dx / 2;
|
||||
mp_float_t err = dx / 2;
|
||||
|
||||
if (y0 < y1) {
|
||||
ystep = 1;
|
||||
|
@ -509,14 +509,14 @@ void common_hal_bitmaptools_arrayblit(displayio_bitmap_t *self, void *data, int
|
|||
}
|
||||
}
|
||||
}
|
||||
displayio_area_t area = { x1, y1, x2, y2 };
|
||||
displayio_area_t area = { x1, y1, x2, y2, NULL };
|
||||
displayio_bitmap_set_dirty_area(self, &area);
|
||||
}
|
||||
|
||||
void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, pyb_file_obj_t *file, int element_size, int bits_per_pixel, bool reverse_pixels_in_element, bool swap_bytes, bool reverse_rows) {
|
||||
uint32_t mask = (1 << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1;
|
||||
|
||||
displayio_area_t a = {0, 0, self->width, self->height};
|
||||
displayio_area_t a = {0, 0, self->width, self->height, NULL};
|
||||
displayio_bitmap_set_dirty_area(self, &a);
|
||||
|
||||
size_t elements_per_row = (self->width * bits_per_pixel + element_size * 8 - 1) / (element_size * 8);
|
||||
|
@ -785,12 +785,12 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi
|
|||
fill_row(source_bitmap, swap, rows[2], y + 2, info->mx);
|
||||
}
|
||||
|
||||
displayio_area_t a = { 0, 0, width, height };
|
||||
displayio_area_t a = { 0, 0, width, height, NULL };
|
||||
displayio_bitmap_set_dirty_area(dest_bitmap, &a);
|
||||
}
|
||||
|
||||
void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, float factor1, float factor2) {
|
||||
displayio_area_t a = {0, 0, dest->width, dest->height};
|
||||
void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2) {
|
||||
displayio_area_t a = {0, 0, dest->width, dest->height, NULL};
|
||||
displayio_bitmap_set_dirty_area(dest, &a);
|
||||
|
||||
int ifactor1 = (int)(factor1 * 256);
|
||||
|
|
|
@ -113,7 +113,7 @@ void displayio_bitmap_set_dirty_area(displayio_bitmap_t *self, const displayio_a
|
|||
displayio_area_t area = *dirty_area;
|
||||
displayio_area_canon(&area);
|
||||
displayio_area_union(&area, &self->dirty_area, &area);
|
||||
displayio_area_t bitmap_area = {0, 0, self->width, self->height};
|
||||
displayio_area_t bitmap_area = {0, 0, self->width, self->height, NULL};
|
||||
displayio_area_compute_overlap(&area, &bitmap_area, &self->dirty_area);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16
|
|||
dirty_y_max = self->height;
|
||||
}
|
||||
|
||||
displayio_area_t a = { x, y, dirty_x_max, dirty_y_max};
|
||||
displayio_area_t a = { x, y, dirty_x_max, dirty_y_max, NULL};
|
||||
displayio_bitmap_set_dirty_area(self, &a);
|
||||
|
||||
bool x_reverse = false;
|
||||
|
@ -199,7 +199,7 @@ void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16
|
|||
|
||||
void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *self, int16_t x, int16_t y, uint32_t value) {
|
||||
// update the dirty region
|
||||
displayio_area_t a = {x, y, x + 1, y + 1};
|
||||
displayio_area_t a = {x, y, x + 1, y + 1, NULL};
|
||||
displayio_bitmap_set_dirty_area(self, &a);
|
||||
|
||||
// write the pixel
|
||||
|
@ -221,7 +221,7 @@ void displayio_bitmap_finish_refresh(displayio_bitmap_t *self) {
|
|||
}
|
||||
|
||||
void common_hal_displayio_bitmap_fill(displayio_bitmap_t *self, uint32_t value) {
|
||||
displayio_area_t a = {0, 0, self->width, self->height};
|
||||
displayio_area_t a = {0, 0, self->width, self->height, NULL};
|
||||
displayio_bitmap_set_dirty_area(self, &a);
|
||||
|
||||
// build the packed word
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -249,138 +275,6 @@ void displayio_gc_collect(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void displayio_area_copy(const displayio_area_t *src, displayio_area_t *dst) {
|
||||
dst->x1 = src->x1;
|
||||
dst->y1 = src->y1;
|
||||
dst->x2 = src->x2;
|
||||
dst->y2 = src->y2;
|
||||
}
|
||||
|
||||
void displayio_area_scale(displayio_area_t *area, uint16_t scale) {
|
||||
area->x1 *= scale;
|
||||
area->y1 *= scale;
|
||||
area->x2 *= scale;
|
||||
area->y2 *= scale;
|
||||
}
|
||||
|
||||
void displayio_area_shift(displayio_area_t *area, int16_t dx, int16_t dy) {
|
||||
area->x1 += dx;
|
||||
area->y1 += dy;
|
||||
area->x2 += dx;
|
||||
area->y2 += dy;
|
||||
}
|
||||
|
||||
bool displayio_area_compute_overlap(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *overlap) {
|
||||
overlap->x1 = a->x1;
|
||||
if (b->x1 > overlap->x1) {
|
||||
overlap->x1 = b->x1;
|
||||
}
|
||||
overlap->x2 = a->x2;
|
||||
if (b->x2 < overlap->x2) {
|
||||
overlap->x2 = b->x2;
|
||||
}
|
||||
if (overlap->x1 >= overlap->x2) {
|
||||
return false;
|
||||
}
|
||||
overlap->y1 = a->y1;
|
||||
if (b->y1 > overlap->y1) {
|
||||
overlap->y1 = b->y1;
|
||||
}
|
||||
overlap->y2 = a->y2;
|
||||
if (b->y2 < overlap->y2) {
|
||||
overlap->y2 = b->y2;
|
||||
}
|
||||
if (overlap->y1 >= overlap->y2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool displayio_area_empty(const displayio_area_t *a) {
|
||||
return (a->x1 == a->x2) || (a->y1 == a->y2);
|
||||
}
|
||||
|
||||
void displayio_area_canon(displayio_area_t *a) {
|
||||
if (a->x1 > a->x2) {
|
||||
int16_t t = a->x1;
|
||||
a->x1 = a->x2;
|
||||
a->x2 = t;
|
||||
}
|
||||
if (a->y1 > a->y2) {
|
||||
int16_t t = a->y1;
|
||||
a->y1 = a->y2;
|
||||
a->y2 = t;
|
||||
}
|
||||
}
|
||||
|
||||
void displayio_area_union(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *u) {
|
||||
|
||||
if (displayio_area_empty(a)) {
|
||||
displayio_area_copy(b, u);
|
||||
return;
|
||||
}
|
||||
if (displayio_area_empty(b)) {
|
||||
displayio_area_copy(a, u);
|
||||
return;
|
||||
}
|
||||
u->x1 = MIN(a->x1, b->x1);
|
||||
u->y1 = MIN(a->y1, b->y1);
|
||||
u->x2 = MAX(a->x2, b->x2);
|
||||
u->y2 = MAX(a->y2, b->y2);
|
||||
}
|
||||
|
||||
uint16_t displayio_area_width(const displayio_area_t *area) {
|
||||
return area->x2 - area->x1;
|
||||
}
|
||||
|
||||
uint16_t displayio_area_height(const displayio_area_t *area) {
|
||||
return area->y2 - area->y1;
|
||||
}
|
||||
|
||||
uint32_t displayio_area_size(const displayio_area_t *area) {
|
||||
return displayio_area_width(area) * displayio_area_height(area);
|
||||
}
|
||||
|
||||
bool displayio_area_equal(const displayio_area_t *a, const displayio_area_t *b) {
|
||||
return a->x1 == b->x1 &&
|
||||
a->y1 == b->y1 &&
|
||||
a->x2 == b->x2 &&
|
||||
a->y2 == b->y2;
|
||||
}
|
||||
|
||||
// Original and whole must be in the same coordinate space.
|
||||
void displayio_area_transform_within(bool mirror_x, bool mirror_y, bool transpose_xy,
|
||||
const displayio_area_t *original,
|
||||
const displayio_area_t *whole,
|
||||
displayio_area_t *transformed) {
|
||||
if (mirror_x) {
|
||||
transformed->x1 = whole->x1 + (whole->x2 - original->x2);
|
||||
transformed->x2 = whole->x2 - (original->x1 - whole->x1);
|
||||
} else {
|
||||
transformed->x1 = original->x1;
|
||||
transformed->x2 = original->x2;
|
||||
}
|
||||
if (mirror_y) {
|
||||
transformed->y1 = whole->y1 + (whole->y2 - original->y2);
|
||||
transformed->y2 = whole->y2 - (original->y1 - whole->y1);
|
||||
} else {
|
||||
transformed->y1 = original->y1;
|
||||
transformed->y2 = original->y2;
|
||||
}
|
||||
if (transpose_xy) {
|
||||
int16_t y1 = transformed->y1;
|
||||
int16_t y2 = transformed->y2;
|
||||
transformed->y1 = whole->y1 + (transformed->x1 - whole->x1);
|
||||
transformed->y2 = whole->y1 + (transformed->x2 - whole->x1);
|
||||
transformed->x2 = whole->x1 + (y2 - whole->y1);
|
||||
transformed->x1 = whole->x1 + (y1 - whole->y1);
|
||||
}
|
||||
}
|
||||
|
||||
primary_display_t *allocate_display(void) {
|
||||
for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) {
|
||||
mp_const_obj_t display_type = displays[i].display.base.type;
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-module/displayio/area.h"
|
||||
|
||||
#include "py/misc.h"
|
||||
|
||||
void displayio_area_copy(const displayio_area_t *src, displayio_area_t *dst) {
|
||||
dst->x1 = src->x1;
|
||||
dst->y1 = src->y1;
|
||||
dst->x2 = src->x2;
|
||||
dst->y2 = src->y2;
|
||||
}
|
||||
|
||||
void displayio_area_scale(displayio_area_t *area, uint16_t scale) {
|
||||
area->x1 *= scale;
|
||||
area->y1 *= scale;
|
||||
area->x2 *= scale;
|
||||
area->y2 *= scale;
|
||||
}
|
||||
|
||||
void displayio_area_shift(displayio_area_t *area, int16_t dx, int16_t dy) {
|
||||
area->x1 += dx;
|
||||
area->y1 += dy;
|
||||
area->x2 += dx;
|
||||
area->y2 += dy;
|
||||
}
|
||||
|
||||
bool displayio_area_compute_overlap(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *overlap) {
|
||||
overlap->x1 = a->x1;
|
||||
if (b->x1 > overlap->x1) {
|
||||
overlap->x1 = b->x1;
|
||||
}
|
||||
overlap->x2 = a->x2;
|
||||
if (b->x2 < overlap->x2) {
|
||||
overlap->x2 = b->x2;
|
||||
}
|
||||
if (overlap->x1 >= overlap->x2) {
|
||||
return false;
|
||||
}
|
||||
overlap->y1 = a->y1;
|
||||
if (b->y1 > overlap->y1) {
|
||||
overlap->y1 = b->y1;
|
||||
}
|
||||
overlap->y2 = a->y2;
|
||||
if (b->y2 < overlap->y2) {
|
||||
overlap->y2 = b->y2;
|
||||
}
|
||||
if (overlap->y1 >= overlap->y2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool displayio_area_empty(const displayio_area_t *a) {
|
||||
return (a->x1 == a->x2) || (a->y1 == a->y2);
|
||||
}
|
||||
|
||||
void displayio_area_canon(displayio_area_t *a) {
|
||||
if (a->x1 > a->x2) {
|
||||
int16_t t = a->x1;
|
||||
a->x1 = a->x2;
|
||||
a->x2 = t;
|
||||
}
|
||||
if (a->y1 > a->y2) {
|
||||
int16_t t = a->y1;
|
||||
a->y1 = a->y2;
|
||||
a->y2 = t;
|
||||
}
|
||||
}
|
||||
|
||||
void displayio_area_union(const displayio_area_t *a,
|
||||
const displayio_area_t *b,
|
||||
displayio_area_t *u) {
|
||||
|
||||
if (displayio_area_empty(a)) {
|
||||
displayio_area_copy(b, u);
|
||||
return;
|
||||
}
|
||||
if (displayio_area_empty(b)) {
|
||||
displayio_area_copy(a, u);
|
||||
return;
|
||||
}
|
||||
u->x1 = MIN(a->x1, b->x1);
|
||||
u->y1 = MIN(a->y1, b->y1);
|
||||
u->x2 = MAX(a->x2, b->x2);
|
||||
u->y2 = MAX(a->y2, b->y2);
|
||||
}
|
||||
|
||||
uint16_t displayio_area_width(const displayio_area_t *area) {
|
||||
return area->x2 - area->x1;
|
||||
}
|
||||
|
||||
uint16_t displayio_area_height(const displayio_area_t *area) {
|
||||
return area->y2 - area->y1;
|
||||
}
|
||||
|
||||
uint32_t displayio_area_size(const displayio_area_t *area) {
|
||||
return displayio_area_width(area) * displayio_area_height(area);
|
||||
}
|
||||
|
||||
bool displayio_area_equal(const displayio_area_t *a, const displayio_area_t *b) {
|
||||
return a->x1 == b->x1 &&
|
||||
a->y1 == b->y1 &&
|
||||
a->x2 == b->x2 &&
|
||||
a->y2 == b->y2;
|
||||
}
|
||||
|
||||
// Original and whole must be in the same coordinate space.
|
||||
void displayio_area_transform_within(bool mirror_x, bool mirror_y, bool transpose_xy,
|
||||
const displayio_area_t *original,
|
||||
const displayio_area_t *whole,
|
||||
displayio_area_t *transformed) {
|
||||
if (mirror_x) {
|
||||
transformed->x1 = whole->x1 + (whole->x2 - original->x2);
|
||||
transformed->x2 = whole->x2 - (original->x1 - whole->x1);
|
||||
} else {
|
||||
transformed->x1 = original->x1;
|
||||
transformed->x2 = original->x2;
|
||||
}
|
||||
if (mirror_y) {
|
||||
transformed->y1 = whole->y1 + (whole->y2 - original->y2);
|
||||
transformed->y2 = whole->y2 - (original->y1 - whole->y1);
|
||||
} else {
|
||||
transformed->y1 = original->y1;
|
||||
transformed->y2 = original->y2;
|
||||
}
|
||||
if (transpose_xy) {
|
||||
int16_t y1 = transformed->y1;
|
||||
int16_t y2 = transformed->y2;
|
||||
transformed->y1 = whole->y1 + (transformed->x1 - whole->x1);
|
||||
transformed->y2 = whole->y1 + (transformed->x2 - whole->x1);
|
||||
transformed->x2 = whole->x1 + (y2 - whole->y1);
|
||||
transformed->x1 = whole->x1 + (y1 - whole->y1);
|
||||
}
|
||||
}
|
|
@ -27,7 +27,10 @@
|
|||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_AREA_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_AREA_H
|
||||
|
||||
// Implementations are in __init__.c
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Implementations are in area.c
|
||||
typedef struct _displayio_area_t displayio_area_t;
|
||||
|
||||
struct _displayio_area_t {
|
||||
|
|
|
@ -1 +1 @@
|
|||
../tools/cpboard.py
|
||||
../tools/cpboard.py
|
||||
|
|
|
@ -30,15 +30,15 @@ ame__
|
|||
mport
|
||||
|
||||
builtins micropython _thread array
|
||||
binascii btree cexample cmath
|
||||
collections cppexample displayio errno
|
||||
ffi framebuf gc gifio
|
||||
hashlib json math qrio
|
||||
re sys termios ubinascii
|
||||
uctypes uerrno uheapq uio
|
||||
ujson ulab uos urandom
|
||||
ure uselect ustruct utime
|
||||
utimeq uzlib
|
||||
binascii bitmaptools btree cexample
|
||||
cmath collections cppexample displayio
|
||||
errno ffi framebuf gc
|
||||
gifio hashlib json math
|
||||
qrio re sys termios
|
||||
ubinascii uctypes uerrno uheapq
|
||||
uio ujson ulab uos
|
||||
urandom ure uselect ustruct
|
||||
utime utimeq uzlib
|
||||
ime
|
||||
|
||||
utime utimeq
|
||||
|
|
|
@ -76,7 +76,8 @@ def set_boards_to_build(build_all):
|
|||
port_matches = port_pattern.search(p)
|
||||
if port_matches:
|
||||
port = port_matches.group(1)
|
||||
boards_to_build.update(port_to_boards[port])
|
||||
if port != "unix":
|
||||
boards_to_build.update(port_to_boards[port])
|
||||
continue
|
||||
|
||||
# Otherwise build it all
|
||||
|
|
Loading…
Reference in New Issue