Merge remote-tracking branch 'origin/main' into stm32-sdioio

This commit is contained in:
Jeff Epler 2020-08-03 21:01:53 -05:00
commit 0e2d231445
22 changed files with 235 additions and 19 deletions

View File

@ -172,6 +172,7 @@ jobs:
- "bast_pro_mini_m0"
- "bdmicro_vina_m0"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "capablerobot_usbhub"
- "catwan_usbstick"
- "circuitbrains_basic_m0"
@ -420,7 +421,7 @@ jobs:
id: idf-cache
with:
path: ${{ github.workspace }}/.idf_tools
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200523
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801
- name: Install IDF tools
run: |
$IDF_PATH/tools/idf_tools.py --non-interactive install required

@ -1 +1 @@
Subproject commit eb4b21e216efd8ec0c4862a938e81b56be961724
Subproject commit e9411c4244984b69ec6928370ede40cec014c10b

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-30 07:18-0500\n"
"POT-Creation-Date: 2020-08-03 21:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -865,6 +865,10 @@ msgstr ""
msgid "I2C Init Error"
msgstr ""
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
msgstr ""
#: shared-bindings/aesio/aes.c
#, c-format
msgid "IV must be %d bytes long"

View File

@ -0,0 +1,39 @@
/*
* 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 "supervisor/shared/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
board_reset_user_neopixels();
}

View File

@ -0,0 +1,37 @@
#define MICROPY_HW_BOARD_NAME "Adafruit BLM Badge"
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_LED_STATUS (&pin_PA03)
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define DEFAULT_I2C_BUS_SCL (&pin_PA01)
#define DEFAULT_I2C_BUS_SDA (&pin_PA00)
#define DEFAULT_UART_BUS_RX (&pin_PA01)
#define DEFAULT_UART_BUS_TX (&pin_PA00)
#define USER_NEOPIXELS_PIN (&pin_PA05)
#define IGNORE_PIN_PA09 1
#define IGNORE_PIN_PA12 1
#define IGNORE_PIN_PA13 1
#define IGNORE_PIN_PA14 1
#define IGNORE_PIN_PA15 1
#define IGNORE_PIN_PA16 1
#define IGNORE_PIN_PA17 1
#define IGNORE_PIN_PA18 1
#define IGNORE_PIN_PA19 1
#define IGNORE_PIN_PA20 1
#define IGNORE_PIN_PA21 1
#define IGNORE_PIN_PA22 1
#define IGNORE_PIN_PA23 1
// USB is always used.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
#define IGNORE_PIN_PA27 1
#define IGNORE_PIN_PA28 1
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1

View File

@ -0,0 +1,24 @@
USB_VID = 0x239A
USB_PID = 0x80C0
USB_PRODUCT = "BLM Badge"
USB_MANUFACTURER = "Adafruit Industries LLC"
CHIP_VARIANT = SAMD21E18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_AUDIOIO = 1
CIRCUITPY_AUDIOBUSIO = 1
# Pins for I2SOut are not available.
CIRCUITPY_AUDIOBUSIO_I2SOUT = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0
CIRCUITPY_USB_HID = 1
CIRCUITPY_USB_MIDI = 0
SUPEROPT_GC = 0

View File

@ -0,0 +1,43 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA01) }, // pad 1
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA00) }, // pad 0
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_CAP1), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_CAP2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_CAP3), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_CAP4), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA07) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_MICROPHONE_CLOCK), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_MICROPHONE_DATA), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA08) },
{ MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA11) },
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA03) },
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA03) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -14,5 +14,6 @@ SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif

View File

@ -11,3 +11,13 @@ LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif

View File

@ -76,13 +76,13 @@ void board_init(void) {
sizeof(start_sequence),
stop_sequence,
sizeof(stop_sequence),
400, // width
300, // height
400, // RAM width
300, // RAM height
300, // width
400, // height
300, // RAM width
400, // RAM height
0, // colstart
0, // rowstart
0, // rotation
270, // rotation
NO_COMMAND, // set_column_window_command
NO_COMMAND, // set_row_window_command
NO_COMMAND, // set_current_column_command

View File

@ -53,6 +53,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_EBSY), MP_ROM_PTR(&pin_PA01) },
// Special named pins
{ MP_OBJ_NEW_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_USB), MP_ROM_PTR(&pin_PB00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICIN), MP_ROM_PTR(&pin_PB04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_MICOUT), MP_ROM_PTR(&pin_PA07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LOCK_BUTTON), MP_ROM_PTR(&pin_PA27) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_LATCH), MP_ROM_PTR(&pin_PB12) },

View File

@ -42,6 +42,7 @@ CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 45
else
CFLAGS_INLINE_LIMIT = 70

View File

@ -15,5 +15,6 @@ SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif

View File

@ -14,5 +14,11 @@ SUPEROPT_GC = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
endif

View File

@ -35,6 +35,7 @@ CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf
# Tweak inlining depending on language.
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 45
else
CFLAGS_INLINE_LIMIT = 70

View File

@ -27,6 +27,11 @@
#include <stdint.h>
#include <string.h>
#include "mpconfigport.h"
// Some boards don't implement I2SOut, so suppress any routines from here.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
#include "extmod/vfs_fat.h"
#include "py/gc.h"
#include "py/mperrno.h"
@ -382,3 +387,5 @@ bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) {
}
return still_playing;
}
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT

View File

@ -32,6 +32,9 @@
#include "audio_dma.h"
#include "py/obj.h"
// Some boards don't implement I2SOut, so suppress any routines from here.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
// We don't bit pack because we'll only have two at most. Its better to save code size instead.
typedef struct {
mp_obj_base_t base;
@ -48,4 +51,6 @@ typedef struct {
void i2sout_reset(void);
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_AUDIOBUSIO_I2SOUT_H

View File

@ -84,12 +84,12 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
self->clock_pin = clock_pin; // PA10, PA20 -> SCK0, PB11 -> SCK1
#ifdef SAMD21
if (clock_pin == &pin_PA10
#ifdef PIN_PA20
#if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20)
|| clock_pin == &pin_PA20
#endif
) {
self->clock_unit = 0;
#ifdef PIN_PB11
#if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11)
} else if (clock_pin == &pin_PB11) {
self->clock_unit = 1;
#endif
@ -98,7 +98,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) {
self->clock_unit = 0;
} else if (clock_pin == &pin_PB12
#ifdef PIN_PB28
#if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28)
|| data_pin == &pin_PB28) {
#else
) {
@ -112,14 +112,24 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1
#ifdef SAMD21
if (data_pin == &pin_PA07 || data_pin == &pin_PA19) {
self->serializer = 0;
} else if (data_pin == &pin_PA08
#ifdef PIN_PB16
|| data_pin == &pin_PB16) {
#else
) {
if (false
#if defined(PIN_PA07) && !defined(IGNORE_PIN_PA07)
|| data_pin == &pin_PA07
#endif
#if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19)
|| data_pin == &pin_PA19
#endif
) {
self->serializer = 0;
}
else if (false
#if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08)
|| data_pin == &pin_PA08
#endif
#if defined (PIN_PB16) && !defined(IGNORE_PIN_PB16)
|| data_pin == &pin_PB16
#endif
) {
self->serializer = 1;
#endif
#ifdef SAM_D5X_E5X

View File

@ -322,9 +322,11 @@ void reset_port(void) {
audioout_reset();
#endif
#if CIRCUITPY_AUDIOBUSIO
i2sout_reset();
//pdmin_reset();
#endif
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
i2sout_reset();
#endif
#if CIRCUITPY_TOUCHIO && CIRCUITPY_TOUCHIO_USE_NATIVE
touchin_reset();

View File

@ -42,6 +42,10 @@ CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO)
CIRCUITPY_AUDIOBUSIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO)
# Some boards have PDMIn but do not implement I2SOut.
CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO)
CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT)
CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)

View File

@ -91,6 +91,10 @@
//| ...
//|
STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
#if !CIRCUITPY_AUDIOBUSIO_I2SOUT
mp_raise_NotImplementedError(translate("I2SOut not available"));
return NULL; // Not reachable.
#else
enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_left_justified };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bit_clock, MP_ARG_OBJ | MP_ARG_REQUIRED },
@ -110,8 +114,11 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a
common_hal_audiobusio_i2sout_construct(self, bit_clock, word_select, data, args[ARG_left_justified].u_bool);
return MP_OBJ_FROM_PTR(self);
#endif
}
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
//| def deinit(self) -> None:
//| """Deinitialises the I2SOut and releases any hardware resources for reuse."""
//| ...
@ -120,6 +127,7 @@ STATIC mp_obj_t audiobusio_i2sout_deinit(mp_obj_t self_in) {
audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in);
common_hal_audiobusio_i2sout_deinit(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_deinit_obj, audiobusio_i2sout_deinit);
@ -251,9 +259,11 @@ const mp_obj_property_t audiobusio_i2sout_paused_obj = {
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
STATIC const mp_rom_map_elem_t audiobusio_i2sout_locals_dict_table[] = {
// Methods
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiobusio_i2sout_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
@ -266,6 +276,7 @@ STATIC const mp_rom_map_elem_t audiobusio_i2sout_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_playing), MP_ROM_PTR(&audiobusio_i2sout_playing_obj) },
{ MP_ROM_QSTR(MP_QSTR_paused), MP_ROM_PTR(&audiobusio_i2sout_paused_obj) },
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
};
STATIC MP_DEFINE_CONST_DICT(audiobusio_i2sout_locals_dict, audiobusio_i2sout_locals_dict_table);

View File

@ -32,6 +32,9 @@
extern const mp_obj_type_t audiobusio_i2sout_type;
// Some boards don't have the I2SOut pins available.
#if CIRCUITPY_AUDIOBUSIO_I2SOUT
void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select, const mcu_pin_obj_t* data,
bool left_justified);
@ -45,4 +48,6 @@ void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self);
void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self);
bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self);
#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOBUSIO_I2SOUT_H