From a50ee4f6503af0c6d0f62976a4aa2c1de0f694f1 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 17 Mar 2019 13:31:14 +0100 Subject: Add frozen stage module to ugame10 board And also ignore some more pins. This is needed for the builds on the circuitpython.org to be functional. --- frozen/circuitpython-stage | 1 + 1 file changed, 1 insertion(+) create mode 160000 frozen/circuitpython-stage (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage new file mode 160000 index 000000000..d8a9d8c1d --- /dev/null +++ b/frozen/circuitpython-stage @@ -0,0 +1 @@ +Subproject commit d8a9d8c1d73041e4cc5669c5441f531ecba517fc -- cgit v1.2.3 From c3136f4f32df28cc29596fc9ba76dcc0bfd533f0 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 6 Apr 2019 14:02:18 +0200 Subject: Enable displayio for uGame10 board Also, make the _stage library work with the fourwire bus, to re-use the display. --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/ugame10/board.c | 73 ++++++++++++++++++++++++ ports/atmel-samd/boards/ugame10/mpconfigboard.h | 9 ++- ports/atmel-samd/boards/ugame10/mpconfigboard.mk | 7 ++- ports/atmel-samd/boards/ugame10/pins.c | 5 +- shared-bindings/_stage/__init__.c | 11 +++- 6 files changed, 95 insertions(+), 12 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index d8a9d8c1d..347b02095 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit d8a9d8c1d73041e4cc5669c5441f531ecba517fc +Subproject commit 347b02095449075d3e9bb1b7bac6d3a8a2151df2 diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index d7e856d61..cd67dabe3 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -26,7 +26,80 @@ #include "boards/board.h" +#include "shared-bindings/board/__init__.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/busio/SPI.h" + +#include "tick.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0xb1, 3, 0x01, 0x2C, 0x2D, // _FRMCTR1 + 0xb2, 3, 0x01, 0x2C, 0x2D, // + 0xb3, 6, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, + 0xb4, 1, 0x07, // _INVCTR line inversion + 0xc0, 3, 0xa2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xc1, 1, 0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xc2, 2, 0x0a, 0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xc3, 2, 0x8a, 0x2a, + 0xc4, 2, 0x8a, 0xee, + 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x2a, 0, // _INVOFF + 0x36, 1, 0xa8, // _MADCTL bottom to top refresh + // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, + // fix on VTL + 0x3a, 1, 0x05, // COLMOD - 16bit color + 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, + 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, + 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 + 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 100, // _DISPON +}; + void board_init(void) { + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + busio_spi_obj_t *spi = common_hal_board_create_spi(); + common_hal_busio_spi_configure(spi, 24000000, 0, 0, 8); + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_PA09, // Command or data + &pin_PA08, // Chip select + NULL); // Reset + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 128, // Width + 128, // Height + 3, // column start + 2, // row start + 0, // rotation + 16, // Color depth + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + NULL, + false, // single_byte_bounds + false); // data as commands } bool board_requests_safe_mode(void) { diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.h b/ports/atmel-samd/boards/ugame10/mpconfigboard.h index caa05bc1a..452633649 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.h +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.h @@ -7,7 +7,7 @@ #define SPI_FLASH_CS_PIN &pin_PA18 // These are pins not to reset. -#define MICROPY_PORT_A (0) +#define MICROPY_PORT_A (PORT_PA06 | PORT_PA07 | PORT_PA08 | PORT_PA09) #define MICROPY_PORT_B (0) #define MICROPY_PORT_C (0) @@ -19,10 +19,9 @@ #define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - CIRCUITPY_INTERNAL_NVM_SIZE) -#define EXTRA_BUILTIN_MODULES \ - { MP_OBJ_NEW_QSTR(MP_QSTR_audioio), (mp_obj_t)&audioio_module }, \ - { MP_OBJ_NEW_QSTR(MP_QSTR_gamepad),(mp_obj_t)&gamepad_module }, \ - { MP_OBJ_NEW_QSTR(MP_QSTR__stage), (mp_obj_t)&stage_module } +#define DEFAULT_SPI_BUS_SCK (&pin_PA07) +#define DEFAULT_SPI_BUS_MISO (&pin_PA11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA06) #define IGNORE_PIN_PB00 1 #define IGNORE_PIN_PB01 1 diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk index 0a727c8b1..4a0330d57 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk @@ -17,13 +17,16 @@ CIRCUITPY_MATH = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_ANALOGIO = 1 CIRCUITPY_GAMEPAD = 1 +CIRCUITPY_DISPLAYIO = 1 + CIRCUITPY_TOUCHIO = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_RTC = 0 -CIRCUITPY_SAMD = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_USB_HID = 0 +CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_SMALL_BUILD = 1 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_PIXELBUF = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage diff --git a/ports/atmel-samd/boards/ugame10/pins.c b/ports/atmel-samd/boards/ugame10/pins.c index 904ac224b..4a03f8bb5 100644 --- a/ports/atmel-samd/boards/ugame10/pins.c +++ b/ports/atmel-samd/boards/ugame10/pins.c @@ -1,4 +1,5 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_X), MP_ROM_PTR(&pin_PA00) }, @@ -23,8 +24,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_B), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_C), MP_ROM_PTR(&pin_PA15) }, { MP_ROM_QSTR(MP_QSTR_D), MP_ROM_PTR(&pin_PA28) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 24a359664..95cbda846 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -28,6 +28,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" #include "shared-module/_stage/__init__.h" #include "Layer.h" #include "Text.h" @@ -85,12 +86,18 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { uint16_t *buffer = bufinfo.buf; size_t buffer_size = bufinfo.len / 2; // 16-bit indexing - busio_spi_obj_t *spi = MP_OBJ_TO_PTR(args[6]); + displayio_fourwire_obj_t *bus = MP_OBJ_TO_PTR(args[6]); + while (!common_hal_displayio_fourwire_begin_transaction(bus)) { +#ifdef MICROPY_VM_HOOK_LOOP + MICROPY_VM_HOOK_LOOP ; +#endif + } if (!render_stage(x0, y0, x1, y1, layers, layers_size, - buffer, buffer_size, spi)) { + buffer, buffer_size, bus->bus)) { mp_raise_OSError(MP_EIO); } + common_hal_displayio_fourwire_end_transaction(bus); return mp_const_none; } -- cgit v1.2.3 From dabbded622878f8c8dbea17310b4b63f71a387d3 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Fri, 12 Apr 2019 11:19:19 +0200 Subject: Got back to using Display object in the Stage library --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/ugame10/board.c | 2 +- ports/atmel-samd/boards/ugame10/mpconfigboard.mk | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 347b02095..a7b3295ff 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 347b02095449075d3e9bb1b7bac6d3a8a2151df2 +Subproject commit a7b3295ff573ce03cd7111a6cf7bf9cfe1e4f657 diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index cd67dabe3..a4f6bb175 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = { 0xc4, 2, 0x8a, 0xee, 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V 0x2a, 0, // _INVOFF - 0x36, 1, 0xa8, // _MADCTL bottom to top refresh + 0x36, 1, 0xa0, // _MADCTL bottom to top refresh // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk index 4a0330d57..cafd84b21 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk @@ -29,4 +29,6 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_PIXELBUF = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10 + +CIRCUITPY_DISPLAY_FONT = "../../tools/Tecate-bitmap-fonts/bitmap/phallus/lemon.bdf" -- cgit v1.2.3 From d39e7e7dd51aa55e92cfda3e05ea80ae1abe409d Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Fri, 12 Apr 2019 11:56:23 +0200 Subject: Use displayio.Display directly --- frozen/circuitpython-stage | 2 +- shared-bindings/_stage/__init__.c | 24 +++++++++++------------- shared-module/_stage/__init__.c | 14 ++++---------- shared-module/_stage/__init__.h | 6 +++--- supervisor/supervisor.mk | 2 +- 5 files changed, 20 insertions(+), 28 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index a7b3295ff..069fad835 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit a7b3295ff573ce03cd7111a6cf7bf9cfe1e4f657 +Subproject commit 069fad8357623f5ea2ff3c865a5b8ed54608afd7 diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 95cbda846..466098061 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -28,7 +28,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "shared-bindings/busio/SPI.h" -#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/displayio/Display.h" #include "shared-module/_stage/__init__.h" #include "Layer.h" #include "Text.h" @@ -50,7 +50,7 @@ //| Layer //| Text //| -//| .. function:: render(x0, y0, x1, y1, layers, buffer, spi) +//| .. function:: render(x0, y0, x1, y1, layers, buffer, display) //| //| Render and send to the display a fragment of the screen. //| @@ -60,11 +60,8 @@ //| :param int y1: Bottom edge of the fragment. //| :param list layers: A list of the :py:class:`~_stage.Layer` objects. //| :param bytearray buffer: A buffer to use for rendering. -//| :param ~busio.SPI spi: The SPI bus to use. +//| :param ~displayio.Display display: The display to use. //| -//| Note that this function only sends the raw pixel data. Setting up -//| the display for receiving it and handling the chip-select and -//| data-command pins has to be done outside of it. //| There are also no sanity checks, outside of the basic overflow //| checking. The caller is responsible for making the passed parameters //| valid. @@ -86,18 +83,19 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { uint16_t *buffer = bufinfo.buf; size_t buffer_size = bufinfo.len / 2; // 16-bit indexing - displayio_fourwire_obj_t *bus = MP_OBJ_TO_PTR(args[6]); + if (!MP_OBJ_IS_TYPE(args[6], &displayio_display_type)) { + mp_raise_TypeError(translate("expected displayio.Display")); + } + displayio_display_obj_t *display = MP_OBJ_TO_PTR(args[6]); - while (!common_hal_displayio_fourwire_begin_transaction(bus)) { + while (!displayio_display_begin_transaction(display)) { #ifdef MICROPY_VM_HOOK_LOOP MICROPY_VM_HOOK_LOOP ; #endif } - if (!render_stage(x0, y0, x1, y1, layers, layers_size, - buffer, buffer_size, bus->bus)) { - mp_raise_OSError(MP_EIO); - } - common_hal_displayio_fourwire_end_transaction(bus); + displayio_display_set_region_to_update(display, x0, y0, x1, y1); + render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, display); + displayio_display_end_transaction(display); return mp_const_none; } diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index 86f5ee795..1af279e92 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -31,10 +31,10 @@ #include "shared-bindings/_stage/Text.h" -bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, +void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - busio_spi_obj_t *spi) { + displayio_display_obj_t *display) { size_t index = 0; for (uint16_t y = y0; y < y1; ++y) { @@ -55,19 +55,13 @@ bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, index += 1; // The buffer is full, send it. if (index >= buffer_size) { - if (!common_hal_busio_spi_write(spi, - ((uint8_t*)buffer), buffer_size * 2)) { - return false; - } + display->send(display->bus, false, ((uint8_t*)buffer), buffer_size * 2); index = 0; } } } // Send the remaining data. if (index) { - if (!common_hal_busio_spi_write(spi, ((uint8_t*)buffer), index * 2)) { - return false; - } + display->send(display->bus, false, ((uint8_t*)buffer), index * 2); } - return true; } diff --git a/shared-module/_stage/__init__.h b/shared-module/_stage/__init__.h index d56a26940..d263302b4 100644 --- a/shared-module/_stage/__init__.h +++ b/shared-module/_stage/__init__.h @@ -27,16 +27,16 @@ #ifndef MICROPY_INCLUDED_SHARED_MODULE__STAGE_H #define MICROPY_INCLUDED_SHARED_MODULE__STAGE_H -#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/Display.h" #include #include #include "py/obj.h" #define TRANSPARENT (0x1ff8) -bool render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, +void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - busio_spi_obj_t *spi); + displayio_display_obj_t *display); #endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 95cffc098..f94f19353 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -101,7 +101,7 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile --output_c_file $(BUILD)/autogen_usb_descriptor.c\ --output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h -CIRCUITPY_DISPLAY_FONT = "../../tools/Tecate-bitmap-fonts/bitmap/terminus-font-4.39/ter-u12n.bdf" +CIRCUITPY_DISPLAY_FONT ?= "../../tools/Tecate-bitmap-fonts/bitmap/terminus-font-4.39/ter-u12n.bdf" $(BUILD)/autogen_display_resources.c: ../../tools/gen_display_resources.py $(HEADER_BUILD)/qstrdefs.generated.h Makefile | $(HEADER_BUILD) $(STEPECHO) "GEN $@" -- cgit v1.2.3 From 2011bc3485ea109bd47892b929ff22b4ed07e9d3 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 16 Apr 2019 11:17:02 -0700 Subject: Update stage for GamePadShift --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 069fad835..08d06a916 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 069fad8357623f5ea2ff3c865a5b8ed54608afd7 +Subproject commit 08d06a916cf3a4372ea90c9e20aad2bdd269d0c1 -- cgit v1.2.3 From b5508ed832f731f1058569ddd2517bbb99c206ca Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 23 Apr 2019 09:58:14 -0700 Subject: Update stage with 1.0.0 release --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 08d06a916..340bd688e 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 08d06a916cf3a4372ea90c9e20aad2bdd269d0c1 +Subproject commit 340bd688e4a9684c557e65236f203049d56a4210 -- cgit v1.2.3 From 31e5e6ea984267bc573f2e1a25e358b4ba8f04c4 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 11 May 2019 22:42:09 +0200 Subject: Bump circuitpython-stage to 1.0.1 --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 340bd688e..733cdf591 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 340bd688e4a9684c557e65236f203049d56a4210 +Subproject commit 733cdf591639f9dbb5d9187a21411f759e1ba82f -- cgit v1.2.3 From 9ae3d9217917bae9050bf9153224e62e3de6e410 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Mon, 20 May 2019 22:04:23 +0200 Subject: Bump circuitpython-stage to 1.0.2 This fixes an OverflowError in the read_palette function. (cherry picked from commit 4ebcca865cbda4b08dc917581438473f625e2a12) --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 733cdf591..397badae5 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 733cdf591639f9dbb5d9187a21411f759e1ba82f +Subproject commit 397badae5863a1ce932213ef527e82314ac498a1 -- cgit v1.2.3 From 5803245009f506b83e819b5bb129c430e982ee8d Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Tue, 18 Jun 2019 19:05:51 +0200 Subject: Add support for PyGamer to Stage library --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/pygamer/mpconfigboard.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 397badae5..0dce331e8 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 397badae5863a1ce932213ef527e82314ac498a1 +Subproject commit 0dce331e849a9459dbd1f99b254f6739e35a4ca1 diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk index a1ff90747..69fb14358 100644 --- a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk @@ -20,4 +20,4 @@ CIRCUITPY_STAGE = 1 # No touch on SAMD51 yet CIRCUITPY_TOUCHIO = 0 -FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pygamer -- cgit v1.2.3 From 14d0606fa05537fd089e6e293d8d5d8de4e74215 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 Jun 2019 12:44:10 -0700 Subject: update stage too --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 0dce331e8..6d1ae7291 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 0dce331e849a9459dbd1f99b254f6739e35a4ca1 +Subproject commit 6d1ae72916cf240ea86185c45f844d59f56d8ec3 -- cgit v1.2.3 From fd2299e51a0aec5a44e4ee4fc19859ad51966c41 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 1 Aug 2019 04:19:50 +0200 Subject: Update circuitpython-stage to 1.0.4 for audiocore changes Since some parts of audioio were moved to audiocore, we now have to import them differently. --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 6d1ae7291..0d2d660e8 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 6d1ae72916cf240ea86185c45f844d59f56d8ec3 +Subproject commit 0d2d660e886de8a1b96778c865c7fa48df5f4ea6 -- cgit v1.2.3 From d50ed3b6e78c4f28fd3a38c429986a3e66216a74 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 4 Aug 2019 14:21:32 +0200 Subject: Add support for PewPew M4 board --- .github/workflows/build.yml | 1 + frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/pewpew_m4/board.c | 121 +++++++++++++++++++++ ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h | 51 +++++++++ ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 40 +++++++ ports/atmel-samd/boards/pewpew_m4/pins.c | 45 ++++++++ ports/atmel-samd/boards/ugame10/mpconfigboard.mk | 22 ++-- 7 files changed, 274 insertions(+), 8 deletions(-) create mode 100644 ports/atmel-samd/boards/pewpew_m4/board.c create mode 100644 ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/pewpew_m4/pins.c (limited to 'frozen/circuitpython-stage') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b5915feb..7bd61b70b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,6 +123,7 @@ jobs: - "pca10056" - "pca10059" - "pewpew10" + - "pewpew_m4" - "pirkey_m0" - "pybadge" - "pybadge_airlift" diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 0d2d660e8..c1d8e1d64 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 0d2d660e886de8a1b96778c865c7fa48df5f4ea6 +Subproject commit c1d8e1d645cbc83d857e12cf4ba67549b988a4e7 diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c new file mode 100644 index 000000000..b684f5601 --- /dev/null +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -0,0 +1,121 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "tick.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0xb1, 3, 0x01, 0x2C, 0x2D, // _FRMCTR1 + 0xb2, 3, 0x01, 0x2C, 0x2D, // + 0xb3, 6, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, + 0xb4, 1, 0x07, // _INVCTR line inversion + 0xc0, 3, 0xa2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xc1, 1, 0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xc2, 2, 0x0a, 0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xc3, 2, 0x8a, 0x2a, + 0xc4, 2, 0x8a, 0xee, + 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x2a, 0, // _INVOFF + 0x36, 1, 0xa8, // _MADCTL + // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 cycle osc equalie, + // fix on VTL + 0x3a, 1, 0x05, // COLMOD - 16bit color + 0xe0, 16, 0x02, 0x1c, 0x07, 0x12, // _GMCTRP1 Gamma + 0x37, 0x32, 0x29, 0x2d, + 0x29, 0x25, 0x2B, 0x39, + 0x00, 0x01, 0x03, 0x10, + 0xe1, 16, 0x03, 0x1d, 0x07, 0x06, // _GMCTRN1 + 0x2E, 0x2C, 0x29, 0x2D, + 0x2E, 0x2E, 0x37, 0x3F, + 0x00, 0x00, 0x02, 0x10, + 0x2a, 3, 0x02, 0x00, 0x81, // _CASET XSTART = 2, XEND = 129 + 0x2b, 3, 0x02, 0x00, 0x81, // _RASET XSTART = 2, XEND = 129 + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 100, // _DISPON +}; + +void board_init(void) { + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_PA16, // TFT_DC Command or data + &pin_PA11, // TFT_CS Chip select + &pin_PA17, // TFT_RST Reset + 60000000); + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 160, // Width (after rotation) + 128, // Height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // grayscale + false, // pixels in byte share row. only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + NULL, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + false, // auto_refresh + 20); // native_frames_per_second +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h new file mode 100644 index 000000000..1b3035e12 --- /dev/null +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.h @@ -0,0 +1,51 @@ +#define MICROPY_HW_BOARD_NAME "PewPew M4" +#define MICROPY_HW_MCU_NAME "samd51g19" + +#define CIRCUITPY_MCU_FAMILY samd51 + +// These are pins not to reset. +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) +#define MICROPY_PORT_D (0) + +#define AUTORESET_DELAY_MS 500 + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 8192 + +#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) + +#define DEFAULT_I2C_BUS_SCL (&pin_PA01) +#define DEFAULT_I2C_BUS_SDA (&pin_PA00) + +#define DEFAULT_SPI_BUS_SCK (&pin_PA04) +#define DEFAULT_SPI_BUS_MOSI (&pin_PA05) +#define DEFAULT_SPI_BUS_MISO (&pin_PA00) + +#define DEFAULT_UART_BUS_RX (&pin_PA05) +#define DEFAULT_UART_BUS_TX (&pin_PA00) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + +// Unused pins +#define IGNORE_PIN_PA03 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA08 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA18 1 +#define IGNORE_PIN_PA19 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 + +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 + diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk new file mode 100644 index 000000000..54ec3d1d0 --- /dev/null +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -0,0 +1,40 @@ +LD_FILE = boards/samd51x19-bootloader.ld +USB_VID = 0x1d50 +USB_PID = 0x60e8 +USB_PRODUCT = "PewPew M4" +USB_MANUFACTURER = "Radomir Dopieralski" + +CHIP_VARIANT = SAMD51G19A +CHIP_FAMILY = samd51 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE + +CIRCUITPY_SMALL_BUILD = 1 +CIRCUITPY_PS2IO = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CSLAVE = 0 +CIRCUITPY_NEOPIXEL_WRITE = 0 +CIRCUITPY_PIXELBUF = 0 +CIRCUITPY_RTC = 0 +CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_USB_HID = 0 +CIRCUITPY_USB_MIDI = 0 + +CIRCUITPY_AUDIOIO = 1 +CIRCUITPY_DISPLAYIO = 1 +CIRCUITPY_GAMEPAD = 1 +CIRCUITPY_STAGE = 1 +CIRCUITPY_MATH = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 +CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf + +# Tweak inlining depending on language. +ifeq ($(TRANSLATION), zh_Latn_pinyin) +CFLAGS_INLINE_LIMIT = 45 +else +CFLAGS_INLINE_LIMIT = 70 +endif diff --git a/ports/atmel-samd/boards/pewpew_m4/pins.c b/ports/atmel-samd/boards/pewpew_m4/pins.c new file mode 100644 index 000000000..7654432f5 --- /dev/null +++ b/ports/atmel-samd/boards/pewpew_m4/pins.c @@ -0,0 +1,45 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LEFT), MP_ROM_PTR(&pin_PB23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_RIGHT), MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_PA23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_PA27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_O), MP_ROM_PTR(&pin_PA10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_X), MP_ROM_PTR(&pin_PA09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_Z), MP_ROM_PTR(&pin_PA22) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_P1), MP_ROM_PTR(&pin_PA30) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P2), MP_ROM_PTR(&pin_PA31) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_PA00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_PA01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_PA02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_PA04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_PA05) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_PA17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_PA15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_PA11) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA00) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA00) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk index 6361da2a6..f0310b4aa 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk @@ -10,7 +10,7 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = S25FL216K -LONGINT_IMPL = MPZ +LONGINT_IMPL = NONE CIRCUITPY_STAGE = 1 CIRCUITPY_MATH = 1 @@ -19,16 +19,24 @@ CIRCUITPY_ANALOGIO = 1 CIRCUITPY_GAMEPAD = 1 CIRCUITPY_DISPLAYIO = 1 -CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_I2CSLAVE = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 +CIRCUITPY_PIXELBUF = 0 CIRCUITPY_RTC = 0 -CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 -CIRCUITPY_I2CSLAVE = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_PIXELBUF = 0 +CIRCUITPY_USB_MIDI = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf + +# Tweak inlining depending on language. +ifeq ($(TRANSLATION), zh_Latn_pinyin) +CFLAGS_INLINE_LIMIT = 45 +else +CFLAGS_INLINE_LIMIT = 70 +endif -- cgit v1.2.3 From b06057395baea6987aabfdc4782476f222dc24e8 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Mon, 23 Dec 2019 15:48:11 +0100 Subject: Update PewPew M4 PewPew M4 now has the pew.py added to its frozen libraries. Some features needed to be disabled to make room for that. --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index c1d8e1d64..89850618d 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit c1d8e1d645cbc83d857e12cf4ba67549b988a4e7 +Subproject commit 89850618dc7b30ee9e2dc11c843dfe4e13d90517 diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 990b26ff3..1d1891e8e 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -10,7 +10,6 @@ INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_SMALL_BUILD = 1 -CIRCUITPY_PS2IO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 @@ -23,7 +22,17 @@ CIRCUITPY_RTC = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_BITBANG_APA102 = 0 +CIRCUITPY_BLEIO = 0 +CIRCUITPY_GAMEPADSHIFT = 0 +CIRCUITPY_NETWORK = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_SAMD = 0 +CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_DISPLAYIO = 1 CIRCUITPY_GAMEPAD = 1 @@ -33,6 +42,8 @@ CIRCUITPY_MATH = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf +USB_DEVICES = "CDC,MSC" + # Tweak inlining depending on language. ifeq ($(TRANSLATION), zh_Latn_pinyin) CFLAGS_INLINE_LIMIT = 45 -- cgit v1.2.3 From 6205b55b192991916befc5aba45d1da08d5600ad Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 26 Dec 2019 22:13:52 +0100 Subject: Bump circuitpython-stage version to 1.0.8 --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 89850618d..8d5cc3840 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 89850618dc7b30ee9e2dc11c843dfe4e13d90517 +Subproject commit 8d5cc384058b1cb296aaeab86fb8405042d547ed -- cgit v1.2.3 From 27c36eea2bbadd1e5df1ef4fd9bf54824068f2c2 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 30 Jan 2020 15:24:04 +0100 Subject: circuitpython-stage: allow choosing background color --- frozen/circuitpython-stage | 2 +- shared-bindings/_stage/__init__.c | 11 ++++++++--- shared-module/_stage/__init__.c | 6 +++++- shared-module/_stage/__init__.h | 3 ++- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 8d5cc3840..19a66d79f 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 8d5cc384058b1cb296aaeab86fb8405042d547ed +Subproject commit 19a66d79f0650a15e502464b42e16692365eab36 diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index 1154bbbf1..4bac280bf 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -51,7 +51,7 @@ //| Layer //| Text //| -//| .. function:: render(x0, y0, x1, y1, layers, buffer, display[, scale]) +//| .. function:: render(x0, y0, x1, y1, layers, buffer, display[, scale[, background]]) //| //| Render and send to the display a fragment of the screen. //| @@ -63,6 +63,7 @@ //| :param bytearray buffer: A buffer to use for rendering. //| :param ~displayio.Display display: The display to use. //| :param int scale: How many times should the image be scaled up. +//| :param int background: What color to display when nothing is there. //| //| There are also no sanity checks, outside of the basic overflow //| checking. The caller is responsible for making the passed parameters @@ -92,12 +93,16 @@ STATIC mp_obj_t stage_render(size_t n_args, const mp_obj_t *args) { } displayio_display_obj_t *display = MP_OBJ_TO_PTR(native_display); uint8_t scale = 1; - if (n_args >= 8) { + if (n_args > 7) { scale = mp_obj_get_int(args[7]); } + uint16_t background = 0; + if (n_args > 8) { + background = mp_obj_get_int(args[8]); + } render_stage(x0, y0, x1, y1, layers, layers_size, buffer, buffer_size, - display, scale); + display, scale, background); return mp_const_none; } diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index d5da74272..0323c32cb 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -34,7 +34,8 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - displayio_display_obj_t *display, uint8_t scale) { + displayio_display_obj_t *display, + uint8_t scale, uint16_t background) { displayio_area_t area; @@ -68,6 +69,9 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, break; } } + if (c == TRANSPARENT) { + c = background; + } for (uint8_t xscale = 0; xscale < scale; ++xscale) { buffer[index] = c; index += 1; diff --git a/shared-module/_stage/__init__.h b/shared-module/_stage/__init__.h index 5af2124ae..7a1826200 100644 --- a/shared-module/_stage/__init__.h +++ b/shared-module/_stage/__init__.h @@ -37,6 +37,7 @@ void render_stage(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, mp_obj_t *layers, size_t layers_size, uint16_t *buffer, size_t buffer_size, - displayio_display_obj_t *display, uint8_t scale); + displayio_display_obj_t *display, + uint8_t scale, uint16_t background); #endif // MICROPY_INCLUDED_SHARED_MODULE__STAGE -- cgit v1.2.3 From f39ca6052e4fd33e3ea1d879c80e11f643d0834a Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Wed, 15 Apr 2020 23:41:38 +0200 Subject: Fix RGB/BGR colors in Stage This makes the colors used by the stage library compatible with those used by the displayio library. --- frozen/circuitpython-stage | 2 +- ports/atmel-samd/boards/pewpew_m4/board.c | 2 +- ports/atmel-samd/boards/ugame10/board.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 19a66d79f..e2a318085 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 19a66d79f0650a15e502464b42e16692365eab36 +Subproject commit e2a318085bad99d5eb83e3b04fb15474456b17e4 diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index cf8439cf0..0e28fe4fc 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -79,7 +79,7 @@ uint8_t display_init_sequence[] = { 0xc4, 2, 0x8a, 0xee, 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V 0x2a, 0, // _INVOFF - 0x36, 1, 0xa8, // _MADCTL + 0x36, 1, 0xa0, // _MADCTL // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 cycle osc equalie, // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 38661950f..04a4c7add 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = { 0xc4, 2, 0x8a, 0xee, 0xc5, 1, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V 0x2a, 0, // _INVOFF - 0x36, 1, 0xa0, // _MADCTL bottom to top refresh + 0x36, 1, 0xa8, // _MADCTL bottom to top refresh // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, // fix on VTL 0x3a, 1, 0x05, // COLMOD - 16bit color -- cgit v1.2.3 From f7e89879295ce131e6a36d9ab92890d70566a67d Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Thu, 16 Apr 2020 13:56:03 +0200 Subject: Bump circuitpython-stage to 1.0.11 to fix audio problems Fix #2773 --- frozen/circuitpython-stage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'frozen/circuitpython-stage') diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index e2a318085..0d2c083a2 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit e2a318085bad99d5eb83e3b04fb15474456b17e4 +Subproject commit 0d2c083a2fb57a1562d4806775f45273abbfbfae -- cgit v1.2.3