From b26f8a781583c41b5f0452b8e22b4d093bf0c9e3 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Sat, 14 Dec 2019 14:34:26 -0500 Subject: Add a BUILDING.md - #2370 --- BUILDING.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 BUILDING.md diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 000000000..6594ce4d0 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,83 @@ + +# Building CircuitPython + +Welcome to CircuitPython! + +This document is a quick-start guide only. + +Detailed guides on how to build CircuitPython can be found in the Adafruit Learn system at +https://learn.adafruit.com/building-circuitpython/. + +## Setup + +Please ensure you setup your build environment appropriately, as per the guide. You will need: + +* Linux: https://learn.adafruit.com/building-circuitpython/linux +* MacOS: https://learn.adafruit.com/building-circuitpython/macos +* Windows Subsystem for Linux (WSL): https://learn.adafruit.com/building-circuitpython/windows-subsystem-for-linux + +### Submodules + +This project has a bunch of git submodules. You will need to update them regularly. + + git submodule sync + git submodule update --init --recursive + +### mpy-cross + +As part of the build process, mpy-cross is needed to compile .py files into .mpy files. +To compile (or recompile) mpy-cross: + + make -C mpy-cross + +# Building + +There a number of ports of CircuitPython! To build for your board, change to the appropriate ports directory and build. + +Examples: + + cd ports/atmel-samd + make BOARD=circuitplayground_express + + cd ports/nrf + make BOARD=circuitplayground_bluefruit + +If you aren't sure what boards exist, have a peek in the boards subdirectory of your port. + +Useful make arguments or targets: + + make BOARD=circuitplayground_express clean + +# Testing + +If you are working on changes to the core language, you might find it useful to run the test suite. +The test suite in the top level `tests` directory. It needs the unix port to run. + + cd ports/unix + make axtls + make micropython + +Then you can run the test suite: + + cd ../../tests + ./run-tests + +A successful run will say something like + + 676 tests performed (19129 individual testcases) + 676 tests passed + 30 tests skipped: buffered_writer builtin_help builtin_range_binop class_delattr_setattr cmd_parsetree extra_coverage framebuf1 framebuf16 framebuf2 framebuf4 framebuf8 framebuf_subclass mpy_invalid namedtuple_asdict non_compliant resource_stream schedule sys_getsizeof urandom_extra ure_groups ure_span ure_sub ure_sub_unmatched vfs_basic vfs_fat_fileio1 vfs_fat_fileio2 vfs_fat_more vfs_fat_oldproto vfs_fat_ramdisk vfs_userfs + +# Debugging + +The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and `gcc-arm-embedded`. +Instructions can be found at https://learn.adafruit.com/debugging-the-samd21-with-gdb + +If using JLink, you'll need both the `JLinkGDBServer` and `arm-non-eabi-gdb-py` running. + +Example: + + JLinkGDBServer -if SWD -device ATSAMD51J19 + arm-none-eabi-gdb-py build-metro_m4_express/firmware.elf -iex "target extended-remote :2331" + + \ No newline at end of file -- cgit v1.2.3 From cca42e94d719c9005d09df543596324fca2af2ae Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Sat, 14 Dec 2019 15:00:42 -0500 Subject: Add to BUILDING to table of contents. --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index a85772fdc..6dadddfc1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -43,6 +43,7 @@ Full Table of Contents ../README ../CONTRIBUTING + ../BUILDING ../CODE_OF_CONDUCT ../license.rst -- cgit v1.2.3 From a63da7a6c0e0537cbefaafb724d722f9587b82a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 16 Dec 2019 15:23:41 -0600 Subject: displayio: make 'rotation' property settable --- shared-bindings/displayio/Display.c | 9 ++++++++- shared-bindings/displayio/Display.h | 1 + shared-module/displayio/Display.c | 17 +++++++++++++++++ shared-module/displayio/display_core.c | 9 +++++++++ shared-module/displayio/display_core.h | 2 ++ supervisor/shared/display.c | 1 + 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 5ce7b3581..5759e8ad2 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -394,11 +394,18 @@ STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) { return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_rotation(self)); } MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_rotation_obj, displayio_display_obj_get_rotation); +STATIC mp_obj_t displayio_display_obj_set_rotation(mp_obj_t self_in, mp_obj_t value) { + displayio_display_obj_t *self = native_display(self_in); + common_hal_displayio_display_set_rotation(self, mp_obj_get_int(value)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_rotation_obj, displayio_display_obj_set_rotation); + const mp_obj_property_t displayio_display_rotation_obj = { .base.type = &mp_type_property, .proxy = {(mp_obj_t)&displayio_display_get_rotation_obj, - (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&displayio_display_set_rotation_obj, (mp_obj_t)&mp_const_none_obj}, }; diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index ca2b2d476..b82a68ebe 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -58,6 +58,7 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t* self uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t* self); uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t* self); uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self); +void common_hal_displayio_display_set_rotation(displayio_display_obj_t* self, int rotation); bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t* self); void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t* self, bool auto_brightness); diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 11db0f8ff..299c8ad35 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -308,10 +308,27 @@ STATIC void _refresh_display(displayio_display_obj_t* self) { displayio_display_core_finish_refresh(&self->core); } +void common_hal_displayio_display_set_rotation(displayio_display_obj_t* self, int rotation){ + bool transposed = (self->core.rotation == 90 || self->core.rotation == 270); + bool will_transposed = (rotation == 90 || rotation == 270); + if(transposed != will_transposed) { + int tmp = self->core.width; + self->core.width = self->core.height; + self->core.height = tmp; + } + displayio_display_core_set_rotation(&self->core, rotation); + supervisor_stop_terminal(); + supervisor_start_terminal(self->core.width, self->core.height); + if (self->core.current_group != NULL) { + displayio_group_update_transform(self->core.current_group, &self->core.transform); + } +} + uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t* self){ return self->core.rotation; } + bool common_hal_displayio_display_refresh(displayio_display_obj_t* self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame) { if (!self->auto_refresh && !self->first_manual_refresh) { uint64_t current_time = supervisor_ticks_ms64(); diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 658daa8d6..120b70f76 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -86,6 +86,15 @@ void displayio_display_core_construct(displayio_display_core_t* self, self->height = height; self->ram_width = ram_width; self->ram_height = ram_height; + + displayio_display_core_set_rotation(self, rotation); +} + +void displayio_display_core_set_rotation( displayio_display_core_t* self, + int rotation) { + int height = self->height; + int width = self->width; + rotation = rotation % 360; self->rotation = rotation; self->transform.x = 0; diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index 3a69cd40a..1c3d0f09c 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -68,6 +68,8 @@ uint16_t displayio_display_core_get_height(displayio_display_core_t* self); void displayio_display_core_set_dither(displayio_display_core_t* self, bool dither); bool displayio_display_core_get_dither(displayio_display_core_t* self); +void displayio_display_core_set_rotation(displayio_display_core_t* self, int rotation); + bool displayio_display_core_bus_free(displayio_display_core_t *self); bool displayio_display_core_begin_transaction(displayio_display_core_t* self); void displayio_display_core_end_transaction(displayio_display_core_t* self); diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index c6fda0f16..855432d64 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -81,6 +81,7 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { grid->pixel_width = width_in_tiles * grid->tile_width; grid->pixel_height = height_in_tiles * grid->tile_height; grid->tiles = tiles; + grid->full_change = true; common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font); } -- cgit v1.2.3 From a46adb6175d479870960a38b47f9bf27e0e5ccc3 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Mon, 16 Dec 2019 20:15:53 -0500 Subject: remove . from end of url --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 6594ce4d0..794d5409a 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -6,7 +6,7 @@ Welcome to CircuitPython! This document is a quick-start guide only. Detailed guides on how to build CircuitPython can be found in the Adafruit Learn system at -https://learn.adafruit.com/building-circuitpython/. +https://learn.adafruit.com/building-circuitpython/ ## Setup -- cgit v1.2.3 From 894cad2e177cf1af5258ce07a78acb386c34ef68 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 17 Dec 2019 21:39:52 +0700 Subject: upgrade nrfx API to v2 --- ports/nrf/Makefile | 2 +- ports/nrf/common-hal/analogio/AnalogIn.c | 51 ++++++++++++------------ ports/nrf/common-hal/busio/I2C.c | 12 +++--- ports/nrf/common-hal/busio/SPI.c | 3 +- ports/nrf/common-hal/busio/UART.c | 8 ++-- ports/nrf/common-hal/microcontroller/Processor.c | 39 +++++++++--------- ports/nrf/common-hal/os/__init__.c | 12 +++--- ports/nrf/common-hal/pulseio/PulseIn.c | 2 +- ports/nrf/common-hal/rtc/RTC.c | 4 +- ports/nrf/nrfx | 2 +- ports/nrf/nrfx_config.h | 5 ++- ports/nrf/peripherals/nrf/nrf52840/power.c | 4 +- ports/nrf/peripherals/nrf/nvm.c | 6 +-- 13 files changed, 78 insertions(+), 72 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index e6070fc32..f38b9f684 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -138,6 +138,7 @@ SRC_NRFX = $(addprefix nrfx/,\ drivers/src/nrfx_uarte.c \ drivers/src/nrfx_gpiote.c \ drivers/src/nrfx_rtc.c \ + drivers/src/nrfx_nvmc.c \ ) ifdef EXTERNAL_FLASH_DEVICES @@ -167,7 +168,6 @@ SRC_C += \ lib/utils/pyexec.c \ lib/utils/stdout_helpers.c \ lib/utils/sys_stdio_mphal.c \ - nrfx/hal/nrf_nvmc.c \ nrfx/mdk/system_$(MCU_SUB_VARIANT).c \ peripherals/nrf/cache.c \ peripherals/nrf/clocks.c \ diff --git a/ports/nrf/common-hal/analogio/AnalogIn.c b/ports/nrf/common-hal/analogio/AnalogIn.c index 44ebe9b4d..3bc097019 100644 --- a/ports/nrf/common-hal/analogio/AnalogIn.c +++ b/ports/nrf/common-hal/analogio/AnalogIn.c @@ -36,12 +36,12 @@ void analogin_init(void) { // Calibrate the ADC once, on startup. - nrf_saadc_enable(); - nrf_saadc_event_clear(NRF_SAADC_EVENT_CALIBRATEDONE); - nrf_saadc_task_trigger(NRF_SAADC_TASK_CALIBRATEOFFSET); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_CALIBRATEDONE) == 0) { } - nrf_saadc_event_clear(NRF_SAADC_EVENT_CALIBRATEDONE); - nrf_saadc_disable(); + nrf_saadc_enable(NRF_SAADC); + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_CALIBRATEOFFSET); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE) == 0) { } + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_CALIBRATEDONE); + nrf_saadc_disable(NRF_SAADC); } void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { @@ -81,34 +81,33 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { .reference = NRF_SAADC_REFERENCE_VDD4, .acq_time = NRF_SAADC_ACQTIME_3US, .mode = NRF_SAADC_MODE_SINGLE_ENDED, - .burst = NRF_SAADC_BURST_DISABLED, - .pin_p = self->pin->adc_channel, - .pin_n = self->pin->adc_channel, + .burst = NRF_SAADC_BURST_DISABLED }; - nrf_saadc_resolution_set(NRF_SAADC_RESOLUTION_14BIT); - nrf_saadc_oversample_set(NRF_SAADC_OVERSAMPLE_DISABLED); - nrf_saadc_enable(); + nrf_saadc_resolution_set(NRF_SAADC, NRF_SAADC_RESOLUTION_14BIT); + nrf_saadc_oversample_set(NRF_SAADC, NRF_SAADC_OVERSAMPLE_DISABLED); + nrf_saadc_enable(NRF_SAADC); - for (uint32_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; i++) - nrf_saadc_channel_input_set(i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); + for (uint32_t i = 0; i < SAADC_CH_NUM; i++) + nrf_saadc_channel_input_set(NRF_SAADC, i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); - nrf_saadc_channel_init(CHANNEL_NO, &config); - nrf_saadc_buffer_init(&value, 1); + nrf_saadc_channel_init(NRF_SAADC, CHANNEL_NO, &config); + nrf_saadc_channel_input_set(NRF_SAADC, CHANNEL_NO, self->pin->adc_channel, self->pin->adc_channel); + nrf_saadc_buffer_init(NRF_SAADC, &value, 1); - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0); - nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_STARTED) == 0); + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_STARTED); - nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_END) == 0); - nrf_saadc_event_clear(NRF_SAADC_EVENT_END); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_END) == 0); + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); - nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0); - nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_STOPPED) == 0); + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_STOPPED); - nrf_saadc_disable(); + nrf_saadc_disable(NRF_SAADC); if (value < 0) value = 0; diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index 8a2ebde3b..7a079ff7f 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -133,9 +133,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t * mp_raise_RuntimeError(translate("SDA or SCL needs a pull up")); } - nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG; - config.scl = scl->number; - config.sda = sda->number; + nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG(scl->number, sda->number); + // change freq. only if it's less than the default 400K if (frequency < 100000) { config.frequency = NRF_TWIM_FREQ_100K; @@ -248,8 +247,10 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, const u // break into MAX_XFER_LEN transaction while ( len ) { const size_t xact_len = MIN(len, I2C_MAX_XFER_LEN); + nrfx_twim_xfer_desc_t xfer_desc = NRFX_TWIM_XFER_DESC_TX(addr, (uint8_t*) data, xact_len); + uint32_t const flags = (stopBit ? 0 : NRFX_TWIM_FLAG_TX_NO_STOP); - if ( NRFX_SUCCESS != (err = nrfx_twim_tx(&self->twim_peripheral->twim, addr, data, xact_len, !stopBit)) ) { + if ( NRFX_SUCCESS != (err = nrfx_twim_xfer(&self->twim_peripheral->twim, &xfer_desc, flags)) ) { break; } @@ -274,8 +275,9 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t // break into MAX_XFER_LEN transaction while ( len ) { const size_t xact_len = MIN(len, I2C_MAX_XFER_LEN); + nrfx_twim_xfer_desc_t xfer_desc = NRFX_TWIM_XFER_DESC_RX(addr, data, xact_len); - if ( NRFX_SUCCESS != (err = nrfx_twim_rx(&self->twim_peripheral->twim, addr, data, xact_len)) ) { + if ( NRFX_SUCCESS != (err = nrfx_twim_xfer(&self->twim_peripheral->twim, &xfer_desc, 0)) ) { break; } diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c index 5f1aac193..d2977909e 100644 --- a/ports/nrf/common-hal/busio/SPI.c +++ b/ports/nrf/common-hal/busio/SPI.c @@ -135,7 +135,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * mp_raise_ValueError(translate("All SPI peripherals are in use")); } - nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG; + nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG(NRFX_SPIM_PIN_NOT_USED, NRFX_SPIM_PIN_NOT_USED, + NRFX_SPIM_PIN_NOT_USED, NRFX_SPIM_PIN_NOT_USED); config.frequency = NRF_SPIM_FREQ_8M; config.sck_pin = clock->number; diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 9cdc197e7..0579db414 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -163,10 +163,12 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self, .pselcts = NRF_UARTE_PSEL_DISCONNECTED, .pselrts = NRF_UARTE_PSEL_DISCONNECTED, .p_context = self, - .hwfc = NRF_UARTE_HWFC_DISABLED, - .parity = (parity == PARITY_NONE) ? NRF_UARTE_PARITY_EXCLUDED : NRF_UARTE_PARITY_INCLUDED, .baudrate = get_nrf_baud(baudrate), - .interrupt_priority = 7 + .interrupt_priority = 7, + .hal_cfg = { + .hwfc = NRF_UARTE_HWFC_DISABLED, + .parity = (parity == PARITY_NONE) ? NRF_UARTE_PARITY_EXCLUDED : NRF_UARTE_PARITY_INCLUDED + } }; nrfx_uarte_uninit(self->uarte); diff --git a/ports/nrf/common-hal/microcontroller/Processor.c b/ports/nrf/common-hal/microcontroller/Processor.c index abfd5b865..03d9c4d3f 100644 --- a/ports/nrf/common-hal/microcontroller/Processor.c +++ b/ports/nrf/common-hal/microcontroller/Processor.c @@ -75,35 +75,34 @@ float common_hal_mcu_processor_get_voltage(void) { .reference = NRF_SAADC_REFERENCE_INTERNAL, .acq_time = NRF_SAADC_ACQTIME_10US, .mode = NRF_SAADC_MODE_SINGLE_ENDED, - .burst = NRF_SAADC_BURST_DISABLED, - .pin_p = NRF_SAADC_INPUT_VDD, - .pin_n = NRF_SAADC_INPUT_VDD, + .burst = NRF_SAADC_BURST_DISABLED }; - nrf_saadc_resolution_set(NRF_SAADC_RESOLUTION_14BIT); - nrf_saadc_oversample_set(NRF_SAADC_OVERSAMPLE_DISABLED); - nrf_saadc_enable(); + nrf_saadc_resolution_set(NRF_SAADC, NRF_SAADC_RESOLUTION_14BIT); + nrf_saadc_oversample_set(NRF_SAADC, NRF_SAADC_OVERSAMPLE_DISABLED); + nrf_saadc_enable(NRF_SAADC); - for (uint32_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; i++) { - nrf_saadc_channel_input_set(i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); + for (uint32_t i = 0; i < SAADC_CH_NUM; i++) { + nrf_saadc_channel_input_set(NRF_SAADC, i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED); } - nrf_saadc_channel_init(0, &config); - nrf_saadc_buffer_init(&value, 1); + nrf_saadc_channel_init(NRF_SAADC, 0, &config); + nrf_saadc_channel_input_set(NRF_SAADC, 0, NRF_SAADC_INPUT_VDD, NRF_SAADC_INPUT_VDD); + nrf_saadc_buffer_init(NRF_SAADC, &value, 1); - nrf_saadc_task_trigger(NRF_SAADC_TASK_START); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0) { } - nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_START); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_STARTED) == 0) { } + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_STARTED); - nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_END) == 0) { } - nrf_saadc_event_clear(NRF_SAADC_EVENT_END); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_SAMPLE); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_END) == 0) { } + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_END); - nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); - while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0) { } - nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED); + nrf_saadc_task_trigger(NRF_SAADC, NRF_SAADC_TASK_STOP); + while (nrf_saadc_event_check(NRF_SAADC, NRF_SAADC_EVENT_STOPPED) == 0) { } + nrf_saadc_event_clear(NRF_SAADC, NRF_SAADC_EVENT_STOPPED); - nrf_saadc_disable(); + nrf_saadc_disable(NRF_SAADC); if (value < 0) { value = 0; diff --git a/ports/nrf/common-hal/os/__init__.c b/ports/nrf/common-hal/os/__init__.c index 7671cc2a5..e38226f94 100644 --- a/ports/nrf/common-hal/os/__init__.c +++ b/ports/nrf/common-hal/os/__init__.c @@ -70,17 +70,17 @@ bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { return NRF_SUCCESS == sd_rand_application_vector_get(buffer, length); #endif - nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY); - nrf_rng_task_trigger(NRF_RNG_TASK_START); + nrf_rng_event_clear(NRF_RNG, NRF_RNG_EVENT_VALRDY); + nrf_rng_task_trigger(NRF_RNG, NRF_RNG_TASK_START); for (uint32_t i = 0; i < length; i++) { - while (nrf_rng_event_get(NRF_RNG_EVENT_VALRDY) == 0); - nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY); + while (nrf_rng_event_check(NRF_RNG, NRF_RNG_EVENT_VALRDY) == 0); + nrf_rng_event_clear(NRF_RNG, NRF_RNG_EVENT_VALRDY); - buffer[i] = nrf_rng_random_value_get(); + buffer[i] = nrf_rng_random_value_get(NRF_RNG); } - nrf_rng_task_trigger(NRF_RNG_TASK_STOP); + nrf_rng_task_trigger(NRF_RNG, NRF_RNG_TASK_STOP); return true; } diff --git a/ports/nrf/common-hal/pulseio/PulseIn.c b/ports/nrf/common-hal/pulseio/PulseIn.c index 383966831..b47cc6273 100644 --- a/ports/nrf/common-hal/pulseio/PulseIn.c +++ b/ports/nrf/common-hal/pulseio/PulseIn.c @@ -112,7 +112,7 @@ void pulsein_reset(void) { if ( nrfx_gpiote_is_init() ) { nrfx_gpiote_uninit(); } - nrfx_gpiote_init(); + nrfx_gpiote_init(NRFX_GPIOTE_CONFIG_IRQ_PRIORITY); memset(_objs, 0, sizeof(_objs)); } diff --git a/ports/nrf/common-hal/rtc/RTC.c b/ports/nrf/common-hal/rtc/RTC.c index 57138350c..a8ea36688 100644 --- a/ports/nrf/common-hal/rtc/RTC.c +++ b/ports/nrf/common-hal/rtc/RTC.c @@ -59,8 +59,8 @@ void rtc_handler(nrfx_rtc_int_type_t int_type) { } void rtc_init(void) { - if (!nrf_clock_lf_is_running()) { - nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART); + if (!nrf_clock_lf_is_running(NRF_CLOCK)) { + nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_LFCLKSTART); } nrfx_rtc_counter_clear(&rtc_instance); nrfx_rtc_init(&rtc_instance, &rtc_config, rtc_handler); diff --git a/ports/nrf/nrfx b/ports/nrf/nrfx index 3d268263b..8efb27e97 160000 --- a/ports/nrf/nrfx +++ b/ports/nrf/nrfx @@ -1 +1 @@ -Subproject commit 3d268263be2390ab760f75a3da72689ef13031a4 +Subproject commit 8efb27e97abe8e2a1d2b63908f510c8dca304a5d diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h index cafec6aa1..82f6514df 100644 --- a/ports/nrf/nrfx_config.h +++ b/ports/nrf/nrfx_config.h @@ -3,7 +3,7 @@ // Power #define NRFX_POWER_ENABLED 1 -#define NRFX_POWER_CONFIG_IRQ_PRIORITY 7 +#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY 7 // NOTE: THIS WORKAROUND CAUSES BLE CODE TO CRASH. // It doesn't work with the SoftDevice. @@ -116,4 +116,7 @@ #define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1 #define NRFX_GPIOTE_CONFIG_IRQ_PRIORITY 7 +// NVM controller +#define NRFX_NVMC_ENABLED 1 + #endif // NRFX_CONFIG_H__ diff --git a/ports/nrf/peripherals/nrf/nrf52840/power.c b/ports/nrf/peripherals/nrf/nrf52840/power.c index 9f7a9fa17..794872c5d 100644 --- a/ports/nrf/peripherals/nrf/nrf52840/power.c +++ b/ports/nrf/peripherals/nrf/nrf52840/power.c @@ -25,7 +25,7 @@ */ #include "nrfx.h" -#include "nrf_nvmc.h" +#include "nrfx_nvmc.h" void nrf_peripherals_power_init(void) { // Set GPIO reference voltage to 3.3V if it isn't already. REGOUT0 will get reset to 0xfffffff @@ -33,7 +33,7 @@ void nrf_peripherals_power_init(void) { // This matters only when "high voltage mode" is enabled, which is true on the PCA10059, // and might be true on other boards. if (NRF_UICR->REGOUT0 == 0xffffffff) { - nrf_nvmc_write_word((uint32_t) &NRF_UICR->REGOUT0, UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos); + nrfx_nvmc_word_write((uint32_t) &NRF_UICR->REGOUT0, UICR_REGOUT0_VOUT_3V3 << UICR_REGOUT0_VOUT_Pos); // Must reset to make enable change. NVIC_SystemReset(); } diff --git a/ports/nrf/peripherals/nrf/nvm.c b/ports/nrf/peripherals/nrf/nvm.c index 7118b9c87..1501ccfc9 100644 --- a/ports/nrf/peripherals/nrf/nvm.c +++ b/ports/nrf/peripherals/nrf/nvm.c @@ -30,7 +30,7 @@ #include #include -#include "nrf_nvmc.h" +#include "nrfx_nvmc.h" #define FLASH_PAGE_SIZE (4096) @@ -90,7 +90,7 @@ bool nrf_nvm_safe_flash_page_write(uint32_t page_addr, uint8_t *data) { } #endif - nrf_nvmc_page_erase(page_addr); - nrf_nvmc_write_bytes(page_addr, data, FLASH_PAGE_SIZE); + nrfx_nvmc_page_erase(page_addr); + nrfx_nvmc_bytes_write(page_addr, data, FLASH_PAGE_SIZE); return true; } -- cgit v1.2.3 From a7f8a0afd7239a51062ebff12d239b80de358cec Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 17 Dec 2019 09:48:55 -0500 Subject: Address code review feedback. --- BUILDING.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 794d5409a..9513f7145 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -44,10 +44,6 @@ Examples: If you aren't sure what boards exist, have a peek in the boards subdirectory of your port. -Useful make arguments or targets: - - make BOARD=circuitplayground_express clean - # Testing If you are working on changes to the core language, you might find it useful to run the test suite. @@ -70,14 +66,14 @@ A successful run will say something like # Debugging -The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and `gcc-arm-embedded`. +The easiest way to debug CircuitPython on hardware is with a JLink device, JLinkGDBServer, and an appropriate GDB. Instructions can be found at https://learn.adafruit.com/debugging-the-samd21-with-gdb -If using JLink, you'll need both the `JLinkGDBServer` and `arm-non-eabi-gdb-py` running. +If using JLink, you'll need both the `JLinkGDBServer` and `arm-none-eabi-gdb` running. Example: JLinkGDBServer -if SWD -device ATSAMD51J19 - arm-none-eabi-gdb-py build-metro_m4_express/firmware.elf -iex "target extended-remote :2331" + arm-none-eabi-gdb build-metro_m4_express/firmware.elf -iex "target extended-remote :2331" \ No newline at end of file -- cgit v1.2.3 From 554373fdd92b1df198b8329be5663c23d4f73f99 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 17 Dec 2019 22:26:08 +0700 Subject: bump tinyusb lib submodule --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index e413c9efa..7a05b177a 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit e413c9efa303d70de019a91aa415384fe80ca78f +Subproject commit 7a05b177a43b368fea1d60ca344fe4ae9902a432 -- cgit v1.2.3 From c7a2228b1baac4d35efa465a0ea815b0f5d51012 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 17 Dec 2019 14:30:44 -0800 Subject: Switch to fetching GCC from AWS Fixes #2388 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01335ccfc..e87190c72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,7 +174,7 @@ jobs: run: | sudo apt-get install -y gettext pip install requests sh click setuptools awscli - wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + wget https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | -- cgit v1.2.3 From d267dac4ac14d1fa7dcf3fe80b67886cd33a75d3 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 17 Dec 2019 18:59:54 -0500 Subject: Address review feedback. --- BUILDING.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 9513f7145..2e9fb4f30 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -43,6 +43,8 @@ Examples: make BOARD=circuitplayground_bluefruit If you aren't sure what boards exist, have a peek in the boards subdirectory of your port. +If you have a fast computer with many cores, consider adding `-j` to your build flags, such as `-j17` on +a 6-core 12-thread machine. # Testing @@ -75,5 +77,6 @@ Example: JLinkGDBServer -if SWD -device ATSAMD51J19 arm-none-eabi-gdb build-metro_m4_express/firmware.elf -iex "target extended-remote :2331" - - \ No newline at end of file + +If your port/build includes `arm-none-eabi-gdb-py`, consider using it instead, as it can be used for better register +debugging with https://github.com/bnahill/PyCortexMDebug -- cgit v1.2.3 From 7571f9790b233d508b426c8e2faa69514bea89d5 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Tue, 17 Dec 2019 19:17:46 -0500 Subject: remove --recursive --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 2e9fb4f30..73499d65d 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -21,7 +21,7 @@ Please ensure you setup your build environment appropriately, as per the guide. This project has a bunch of git submodules. You will need to update them regularly. git submodule sync - git submodule update --init --recursive + git submodule update --init ### mpy-cross -- cgit v1.2.3 From 561fdfb279c45f7a9ff69a2b2e71ac272cb6aaef Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 17 Dec 2019 19:01:03 -0800 Subject: Improve USB eject by resetting on replug --- supervisor/shared/usb/usb.c | 2 ++ supervisor/shared/usb/usb_msc_flash.c | 41 +++++++++++++++++++++++++++++------ supervisor/usb.h | 4 ++++ 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index c1d70c5b0..a0178528d 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -87,10 +87,12 @@ void usb_background(void) { // Invoked when device is mounted void tud_mount_cb(void) { + usb_msc_mount(); } // Invoked when device is unmounted void tud_umount_cb(void) { + usb_msc_umount(); } // Invoked when usb bus is suspended diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index 205cb7b50..0376cfc1d 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -41,6 +41,18 @@ static bool ejected[1]; +void usb_msc_mount(void) { + // Reset the ejection tracking every time we're plugged into USB. This allows for us to battery + // power the device, eject, unplug and plug it back in to get the drive. + for (uint8_t i = 0; i < sizeof(ejected); i++) { + ejected[i] = false; + } +} + +void usb_msc_umount(void) { + +} + // The root FS is always at the end of the list. static fs_user_mount_t* get_vfs(int lun) { // TODO(tannewt): Return the mount which matches the lun where 0 is the end @@ -198,19 +210,34 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun) { // - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage // - Start = 1 : active mode, if load_eject = 1 : load disk storage bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) { + if (lun > 1) { + return false; + } + fs_user_mount_t* current_mount = get_vfs(lun); + if (current_mount == NULL) { + return false; + } if (load_eject) { - if (lun > 1) { - return false; - } else { - fs_user_mount_t* current_mount = get_vfs(lun); - if (current_mount == NULL) { - return false; - } + if (!start) { + // Eject but first flush. if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) { return false; } else { ejected[lun] = true; } + } else { + // We can only load if it hasn't been ejected. + return !ejected[lun]; + } + } else { + if (!start) { + // Stop the unit but don't eject. + if (disk_ioctl(current_mount, CTRL_SYNC, NULL) != RES_OK) { + return false; + } + } else { + // Start the unit, but only if not ejected. + return !ejected[lun]; } } diff --git a/supervisor/usb.h b/supervisor/usb.h index c87540d40..0cc361619 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -41,4 +41,8 @@ void init_usb_hardware(void); bool usb_enabled(void); void usb_init(void); +// Propagate plug/unplug events to the MSC logic. +void usb_msc_mount(void); +void usb_msc_umount(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_USB_H -- cgit v1.2.3 From dad2663337e3473a8405d2e70164c3bfc0380ca6 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 18 Dec 2019 15:39:11 +0700 Subject: update nrfx submodule to v2 --- ports/nrf/nrfx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/nrfx b/ports/nrf/nrfx index 8efb27e97..3f55e49eb 160000 --- a/ports/nrf/nrfx +++ b/ports/nrf/nrfx @@ -1 +1 @@ -Subproject commit 8efb27e97abe8e2a1d2b63908f510c8dca304a5d +Subproject commit 3f55e49eb11e6db0da1da09e189bb094222702c9 -- cgit v1.2.3 From 5c42ae1e13a786052155e0c4746fb97af4dd019b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 08:13:00 -0600 Subject: mp3: update to upstream release 1.1.1 --- lib/mp3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mp3 b/lib/mp3 index 2a3cc7873..c3c664bf4 160000 --- a/lib/mp3 +++ b/lib/mp3 @@ -1 +1 @@ -Subproject commit 2a3cc7873b5c642d4bb60043dc14d2555e3377a5 +Subproject commit c3c664bf4db6a36d11808dfcbb5dbf7cff1715b8 -- cgit v1.2.3 From 51af8aadb7d9b1a22fbff9bbb978878fc959b5a8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 10:27:56 -0600 Subject: nrf: PWMAudioOut: 62500Hz limitation is not needed .. and it gets in the way of some example programs, due to the way circuitplayground library generates different frequency sine waves --- ports/nrf/common-hal/audiopwmio/PWMAudioOut.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c index d9226628f..cdb57bbe1 100644 --- a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c @@ -225,10 +225,6 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t* self, self->loop = loop; uint32_t sample_rate = audiosample_sample_rate(sample); - uint32_t max_sample_rate = 62500; - if (sample_rate > max_sample_rate) { - mp_raise_ValueError_varg(translate("Sample rate too high. It must be less than %d"), max_sample_rate); - } self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; uint32_t max_buffer_length; -- cgit v1.2.3 From 4700f7cf23954cd21212fd5a4f7760826237e194 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 10:35:57 -0600 Subject: frozen: Update Adafruit_CircuitPython_CircuitPlayground submodule --- frozen/Adafruit_CircuitPython_CircuitPlayground | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index d87ea261c..82ba9e40d 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit d87ea261c40ecbc6d893d72d337beefbea1cf932 +Subproject commit 82ba9e40dfff41fdc0541636afde4936c930d86c -- cgit v1.2.3 From 516d930e6c0aaf718fea258c2b6850fe8f43eaf8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 16:06:17 -0600 Subject: frozen: Update all submodules to latest tagged release --- frozen/Adafruit_CircuitPython_BusDevice | 2 +- frozen/Adafruit_CircuitPython_CircuitPlayground | 2 +- frozen/Adafruit_CircuitPython_Crickit | 2 +- frozen/Adafruit_CircuitPython_DotStar | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_SD | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index 52d87bd7e..2000ae3a7 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit 52d87bd7e571af66ecb57ee32b5af92531134150 +Subproject commit 2000ae3a7c5d60b850c9546a16425aee279e2a36 diff --git a/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index d87ea261c..82ba9e40d 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit d87ea261c40ecbc6d893d72d337beefbea1cf932 +Subproject commit 82ba9e40dfff41fdc0541636afde4936c930d86c diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index a6100fb5d..553466290 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit a6100fb5d867c7f4980f071119bfa7e0a76e1d47 +Subproject commit 5534662902a223ac8562e6f999d6359e4c17dab1 diff --git a/frozen/Adafruit_CircuitPython_DotStar b/frozen/Adafruit_CircuitPython_DotStar index 409e90902..01e89a843 160000 --- a/frozen/Adafruit_CircuitPython_DotStar +++ b/frozen/Adafruit_CircuitPython_DotStar @@ -1 +1 @@ -Subproject commit 409e90902ac49720c4add985e8e1a1660bbe63a0 +Subproject commit 01e89a8437c78b62d4d655c745ded57e26dc747a diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 89faee0eb..a23b80569 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 89faee0eb08a6855e14f117c514fecf2dd90769d +Subproject commit a23b80569f23ef109667dd8c595d319e8a30d620 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index ddc748449..f69fc9b47 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit ddc74844983b35b027bd45091c7b8bb3c8d7a2d1 +Subproject commit f69fc9b47fa25ba1414eb3d5c82f05013280c0d2 diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index c0bdd8b10..ff99d5511 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit c0bdd8b10383725ee9293f5d88fb8d47eb1272bd +Subproject commit ff99d55115f81899902c2c4a84fdfbea9ae83823 diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index 5ad33e4ca..dd0fe8530 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit 5ad33e4ca219f0e216beab439cfa259cde32016c +Subproject commit dd0fe8530a2dcc64ac95bb3e116af2158dcd7cd2 -- cgit v1.2.3 From d31a387ace9488d161534a61f20a31d12cb01a4e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 16:11:29 -0600 Subject: circuitplayground_express_displayio: reduce inlining to make .ko translation fit --- .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index b5a7c2424..cf3d11d12 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -20,7 +20,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RTC = 0 SUPEROPT_GC = 0 -CFLAGS_INLINE_LIMIT = 55 +CFLAGS_INLINE_LIMIT = 35 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -- cgit v1.2.3 From 5f0af7788026bdae10224dc6570ff79aba394fb7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 08:13:00 -0600 Subject: mp3: update to upstream release 1.1.1 --- lib/mp3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mp3 b/lib/mp3 index 2a3cc7873..c3c664bf4 160000 --- a/lib/mp3 +++ b/lib/mp3 @@ -1 +1 @@ -Subproject commit 2a3cc7873b5c642d4bb60043dc14d2555e3377a5 +Subproject commit c3c664bf4db6a36d11808dfcbb5dbf7cff1715b8 -- cgit v1.2.3 From cc3ef2d5e647c9814a3a25c4df23e3764ec5fdb8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 16:06:17 -0600 Subject: frozen: Update all submodules to latest tagged release --- frozen/Adafruit_CircuitPython_BusDevice | 2 +- frozen/Adafruit_CircuitPython_Crickit | 2 +- frozen/Adafruit_CircuitPython_DotStar | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_SD | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index 52d87bd7e..2000ae3a7 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit 52d87bd7e571af66ecb57ee32b5af92531134150 +Subproject commit 2000ae3a7c5d60b850c9546a16425aee279e2a36 diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index a6100fb5d..553466290 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit a6100fb5d867c7f4980f071119bfa7e0a76e1d47 +Subproject commit 5534662902a223ac8562e6f999d6359e4c17dab1 diff --git a/frozen/Adafruit_CircuitPython_DotStar b/frozen/Adafruit_CircuitPython_DotStar index 409e90902..01e89a843 160000 --- a/frozen/Adafruit_CircuitPython_DotStar +++ b/frozen/Adafruit_CircuitPython_DotStar @@ -1 +1 @@ -Subproject commit 409e90902ac49720c4add985e8e1a1660bbe63a0 +Subproject commit 01e89a8437c78b62d4d655c745ded57e26dc747a diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 89faee0eb..a23b80569 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 89faee0eb08a6855e14f117c514fecf2dd90769d +Subproject commit a23b80569f23ef109667dd8c595d319e8a30d620 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index ddc748449..f69fc9b47 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit ddc74844983b35b027bd45091c7b8bb3c8d7a2d1 +Subproject commit f69fc9b47fa25ba1414eb3d5c82f05013280c0d2 diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index c0bdd8b10..ff99d5511 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit c0bdd8b10383725ee9293f5d88fb8d47eb1272bd +Subproject commit ff99d55115f81899902c2c4a84fdfbea9ae83823 diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index 5ad33e4ca..dd0fe8530 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit 5ad33e4ca219f0e216beab439cfa259cde32016c +Subproject commit dd0fe8530a2dcc64ac95bb3e116af2158dcd7cd2 -- cgit v1.2.3 From 8d2a3e94d72298a111dfae7f616d9abbab87cb1b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 16:11:29 -0600 Subject: circuitplayground_express_displayio: reduce inlining to make .ko translation fit --- .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index b5a7c2424..cf3d11d12 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -20,7 +20,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RTC = 0 SUPEROPT_GC = 0 -CFLAGS_INLINE_LIMIT = 55 +CFLAGS_INLINE_LIMIT = 35 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -- cgit v1.2.3 From 00c226738d404a0664a73d0ca2dabfcad75798ac Mon Sep 17 00:00:00 2001 From: albang Date: Thu, 19 Dec 2019 23:16:51 +0100 Subject: Typo in doc --- shared-bindings/random/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 83698eac5..de4c90910 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -33,11 +33,11 @@ #include "shared-bindings/random/__init__.h" #include "supervisor/shared/translate.h" -//| :mod:`random` --- psuedo-random numbers and choices +//| :mod:`random` --- pseudo-random numbers and choices //| ======================================================== //| //| .. module:: random -//| :synopsis: psuedo-random numbers and choices +//| :synopsis: pseudo-random numbers and choices //| :platform: SAMD21, ESP8266 //| //| The `random` module is a strict subset of the CPython `cpython:random` -- cgit v1.2.3 From a93475707e18c110afdff23ac965e2e0c393fa40 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 19 Dec 2019 16:26:01 -0600 Subject: gen_display_resources: speed it up It was intended that the `f.load_glyphs` line was fast and did most of the work. However, it actually didn't, because it's necessary to pass in a code point by number, not by string. Additionally, a little light layer violation is needed to make the check for missing characters fast. This used to be less important, as no fonts had missing characters. However, it would take an appreciable length of time on the Korean translation when failing to find hundreds of different code points. Testing performed: built build-circuitplayground_express_displayio/autogen_display_resources.c with ko translation before and after change. verified the file content was identical. Time went from about 7s on my machine to way under 1 second. --- tools/gen_display_resources.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index 781b5e69b..c08daf477 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -48,18 +48,19 @@ for c in sample_characters: all_characters += c if args.extra_characters: all_characters.extend(args.extra_characters) +all_characters = "".join(sorted(set(all_characters))) filtered_characters = all_characters # Try to pre-load all of the glyphs. Misses will still be slow later. -f.load_glyphs(set(all_characters)) +f.load_glyphs(set(ord(c) for c in all_characters)) # Get each glyph. -for c in all_characters: - g = f.get_glyph(ord(c)) - if not g: +for c in set(all_characters): + if ord(c) not in f._glyphs: print("Font missing character:", c, ord(c)) filtered_characters = filtered_characters.replace(c, "") continue + g = f.get_glyph(ord(c)) if g["shift"][1] != 0: raise RuntimeError("y shift") -- cgit v1.2.3 From b859e2b71013f603bb91539a62ada4e0eee15d48 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 20 Dec 2019 11:42:32 -0800 Subject: Remove `re` from CPX Displayio build to make space. --- .../boards/circuitplayground_express_displayio/mpconfigboard.h | 2 ++ .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 2 +- py/circuitpy_mpconfig.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index 4486e8a6d..c9a7ce040 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -43,3 +43,5 @@ // USB is always used internally so skip the pin objects for it. #define IGNORE_PIN_PA24 1 #define IGNORE_PIN_PA25 1 + +#define MICROPY_PY_URE 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index cf3d11d12..b5a7c2424 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -20,7 +20,7 @@ CIRCUITPY_GAMEPAD = 0 CIRCUITPY_RTC = 0 SUPEROPT_GC = 0 -CFLAGS_INLINE_LIMIT = 35 +CFLAGS_INLINE_LIMIT = 55 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 3161938c4..932d4f855 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -193,7 +193,9 @@ typedef long mp_off_t; #define MICROPY_PY_UERRNO (CIRCUITPY_FULL_BUILD) // Opposite setting is deliberate. #define MICROPY_PY_UERRNO_ERRORCODE (!CIRCUITPY_FULL_BUILD) +#ifndef MICROPY_PY_URE #define MICROPY_PY_URE (CIRCUITPY_FULL_BUILD) +#endif #define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_FULL_BUILD) #define MICROPY_PY_URE_SUB (CIRCUITPY_FULL_BUILD) -- cgit v1.2.3 From f60b6481e090b2748dc84100502deda660466805 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 20 Dec 2019 12:14:27 -0800 Subject: Turn off `gamepad` on cpx crickit --- .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index a6ed28aa7..04b4b7792 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -13,9 +13,10 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C" # Turn off features and optimizations for Crickit build to make room for additional frozen libs. LONGINT_IMPL = NONE CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_PIXELBUF = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CSLAVE = 0 +CIRCUITPY_PIXELBUF = 0 SUPEROPT_GC = 0 CFLAGS_INLINE_LIMIT = 55 -- cgit v1.2.3