Merge branch 'master' into gamepad-shift

This commit is contained in:
Radomir Dopieralski 2019-04-13 11:54:25 +02:00
commit eeef5359f9
30 changed files with 28188 additions and 51 deletions

View File

@ -24,7 +24,7 @@ env:
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0" TRAVIS_SDK=arm
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip" TRAVIS_SDK=arm
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10" TRAVIS_SDK=arm
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite" TRAVIS_SDK=arm
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev pybadge" TRAVIS_SDK=arm
addons:

@ -1 +1 @@
Subproject commit d8a9d8c1d73041e4cc5669c5441f531ecba517fc
Subproject commit 069fad8357623f5ea2ff3c865a5b8ed54608afd7

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-04-13 11:50+0200\n"
"POT-Creation-Date: 2019-04-12 13:44-0700\n"
"PO-Revision-Date: 2018-12-23 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"

2637
locale/zh_Latn_pinyin.po Normal file

File diff suppressed because it is too large Load Diff

View File

@ -25,5 +25,9 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
#Adding per @danh to reduce memory usage and get the latest changes in
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 35
else
CFLAGS_INLINE_LIMIT = 55
endif

View File

@ -18,7 +18,12 @@ CIRCUITPY_I2CSLAVE = 0
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 35
else
CFLAGS_INLINE_LIMIT = 55
endif
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice

View File

@ -11,3 +11,8 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 60
endif

View File

@ -32,3 +32,11 @@
#define DEFAULT_UART_BUS_RX (&pin_PA11)
#define DEFAULT_UART_BUS_TX (&pin_PA10)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
// Not connected
#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1

View File

@ -10,6 +10,7 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
LONGINT_IMPL = MPZ
# Make space for frozen libs
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_DISPLAYIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CSLAVE = 0

View File

@ -12,4 +12,9 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 45
else
CFLAGS_INLINE_LIMIT = 70
endif

View File

@ -0,0 +1,41 @@
/*
* 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 <string.h>
#include "boards/board.h"
#include "py/mpconfig.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,30 @@
#define MICROPY_HW_BOARD_NAME "Sprite_v2b"
#define MICROPY_HW_MCU_NAME "samd51G19"
#define CIRCUITPY_MCU_FAMILY samd51
#define MICROPY_HW_LED_STATUS (&pin_PB03)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define CALIBRATE_CRYSTALLESS 1
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - 0x010000)
#define DEFAULT_I2C_BUS_SCL (&pin_PA17)
#define DEFAULT_I2C_BUS_SDA (&pin_PA16)
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA07)
#define DEFAULT_SPI_BUS_MISO (&pin_PA04)
#define DEFAULT_UART_BUS_TX (&pin_PB09)
#define DEFAULT_UART_BUS_RX (&pin_PB08)
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,17 @@
LD_FILE = boards/samd51x19-bootloader.ld
USB_VID = 0x04D8
USB_PID = 0xED94
USB_PRODUCT = "kicksat-sprite"
USB_MANUFACTURER = "maholli"
QSPI_FLASH_FILESYSTEM = 0
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# No touch on SAMD51 yet
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_DISPLAYIO = 0
CHIP_VARIANT = SAMD51G19A
CHIP_FAMILY = samd51

View File

@ -0,0 +1,38 @@
#include "shared-bindings/board/__init__.h"
#include "boards/board.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_radioCS), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_WAKE), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_SHDWN), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_PWDWN), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_TST), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_VCLK), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_FSYNC), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_MD), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_MC), MP_ROM_PTR(&pin_PA19) },
{ MP_ROM_QSTR(MP_QSTR_PA08), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_PA09), MP_ROM_PTR(&pin_PA09) },
{ MP_ROM_QSTR(MP_QSTR_PA06), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ 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_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -12,3 +12,8 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
endif

View File

@ -21,3 +21,8 @@ CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_SMALL_BUILD = 1
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 40
endif

View File

@ -1,8 +1,6 @@
#define MICROPY_HW_BOARD_NAME "SparkFun LUMIDrive"
#define MICROPY_HW_MCU_NAME "samd21g18"
//#define MICROPY_HW_NEOPIXEL (&pin_PA06)
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
#define SPI_FLASH_BAUDRATE (8000000)
@ -30,10 +28,28 @@
#define DEFAULT_SPI_BUS_MOSI (&pin_PA18)
#define DEFAULT_SPI_BUS_MISO (&pin_PA21)
//UART
#define DEFAULT_UART_BUS_RX (&pin_PA11)
#define DEFAULT_UART_BUS_TX (&pin_PA10)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PA02 1
#define IGNORE_PIN_PA03 1
#define IGNORE_PIN_PA10 1
#define IGNORE_PIN_PA11 1
#define IGNORE_PIN_PA12 1
#define IGNORE_PIN_PA15 1
#define IGNORE_PIN_PA16 1
#define IGNORE_PIN_PA21 1
#define IGNORE_PIN_PA22 1
#define IGNORE_PIN_PA23 1
#define IGNORE_PIN_PA27 1
#define IGNORE_PIN_PA28 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
#define IGNORE_PIN_PB22 1
#define IGNORE_PIN_PB23 1

View File

@ -10,8 +10,8 @@ LONGINT_IMPL = MPZ
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
# Make room for frozen libraries.
CFLAGS_INLINE_LIMIT = 55
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q32FV"

View File

@ -5,15 +5,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA19) }, //
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA18) }, //
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, //
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, //
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, //
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, //
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, //
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -12,3 +12,8 @@ CHIP_FAMILY = samd21
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q32FV"
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
CFLAGS_INLINE_LIMIT = 50
endif

View File

@ -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, 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
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) {

View File

@ -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

View File

@ -17,13 +17,18 @@ 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
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame10
CIRCUITPY_DISPLAY_FONT = "../../tools/Tecate-bitmap-fonts/bitmap/phallus/lemon.bdf"

View File

@ -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);

View File

@ -28,6 +28,7 @@
#include "py/mperrno.h"
#include "py/runtime.h"
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/displayio/Display.h"
#include "shared-module/_stage/__init__.h"
#include "Layer.h"
#include "Text.h"
@ -49,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.
//|
@ -59,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.
@ -85,12 +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
busio_spi_obj_t *spi = MP_OBJ_TO_PTR(args[6]);
if (!render_stage(x0, y0, x1, y1, layers, layers_size,
buffer, buffer_size, spi)) {
mp_raise_OSError(MP_EIO);
if (!MP_OBJ_IS_TYPE(args[6], &displayio_display_type)) {
mp_raise_TypeError(translate("argument num/types mismatch"));
}
displayio_display_obj_t *display = MP_OBJ_TO_PTR(args[6]);
while (!displayio_display_begin_transaction(display)) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP ;
#endif
}
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;
}

View File

@ -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;
}

View File

@ -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 <stdint.h>
#include <stdbool.h>
#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

View File

@ -70,7 +70,9 @@ void usb_init(void) {
tud_cdc_set_wanted_char(CHAR_CTRL_C);
#endif
#if CIRCUITPY_USB_MIDI
usb_midi_init();
#endif
}
void usb_background(void) {

View File

@ -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/fonts/ter-u12n.bdf"
$(BUILD)/autogen_display_resources.c: ../../tools/gen_display_resources.py $(HEADER_BUILD)/qstrdefs.generated.h Makefile | $(HEADER_BUILD)
$(STEPECHO) "GEN $@"

25240
tools/fonts/ter-u12n.bdf Normal file

File diff suppressed because it is too large Load Diff