Merge branch 'adafruit:main' into efr32-doc-fixes

This commit is contained in:
applecuckoo 2023-06-06 08:56:40 +12:00 committed by GitHub
commit 2d78cf3428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 7 deletions

View File

@ -544,7 +544,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
} }
} else if (agg_type == PTR) { } else if (agg_type == PTR) {
byte *p = *(void **)self->addr; byte *p = *(void **)(void *)self->addr;
if (mp_obj_is_small_int(t->items[1])) { if (mp_obj_is_small_int(t->items[1])) {
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS); uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
return get_aligned(val_type, p, index); return get_aligned(val_type, p, index);
@ -574,7 +574,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]); mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS); uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
if (agg_type == PTR) { if (agg_type == PTR) {
byte *p = *(void **)self->addr; byte *p = *(void **)(void *)self->addr;
return mp_obj_new_int((mp_int_t)(uintptr_t)p); return mp_obj_new_int((mp_int_t)(uintptr_t)p);
} }
} }

View File

@ -6,8 +6,8 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2023-05-21 00:49+0000\n" "PO-Revision-Date: 2023-06-02 20:48+0000\n"
"Last-Translator: Scott Shawcroft <scott@tannewt.org>\n" "Last-Translator: Ettore Atalan <atalanttore@googlemail.com>\n"
"Language: de_DE\n" "Language: de_DE\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -1318,7 +1318,7 @@ msgstr "Ungültige format chunk size"
#: shared-bindings/wifi/Radio.c #: shared-bindings/wifi/Radio.c
msgid "Invalid hex password" msgid "Invalid hex password"
msgstr "" msgstr "Ungültiges Hex-Passwort"
#: ports/espressif/common-hal/wifi/Radio.c #: ports/espressif/common-hal/wifi/Radio.c
msgid "Invalid multicast MAC address" msgid "Invalid multicast MAC address"
@ -2544,7 +2544,7 @@ msgstr "Die Annotation muss ein Bezeichner sein"
#: extmod/ulab/code/numpy/create.c #: extmod/ulab/code/numpy/create.c
msgid "arange: cannot compute length" msgid "arange: cannot compute length"
msgstr "" msgstr "arange: kann Länge nicht berechnen"
#: py/modbuiltins.c #: py/modbuiltins.c
msgid "arg is an empty sequence" msgid "arg is an empty sequence"

View File

@ -7,7 +7,7 @@ CHIP_VARIANT = SAME54P20A
CHIP_FAMILY = same54 CHIP_FAMILY = same54
QSPI_FLASH_FILESYSTEM = 1 QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "N25Q256A" EXTERNAL_FLASH_DEVICES = "N25Q256A,SST26VF064B"
LONGINT_IMPL = MPZ LONGINT_IMPL = MPZ
CIRCUITPY_SDIOIO = 1 CIRCUITPY_SDIOIO = 1

View File

@ -25,6 +25,39 @@
*/ */
#include "supervisor/board.h" #include "supervisor/board.h"
#include "supervisor/shared/board.h"
#include "mpconfigboard.h"
static void power_on(void) {
// turn on internal battery
nrf_gpio_cfg(POWER_SWITCH_PIN->number,
NRF_GPIO_PIN_DIR_OUTPUT,
NRF_GPIO_PIN_INPUT_DISCONNECT,
NRF_GPIO_PIN_NOPULL,
NRF_GPIO_PIN_S0S1,
NRF_GPIO_PIN_NOSENSE);
nrf_gpio_pin_write(POWER_SWITCH_PIN->number, true);
}
static void preserve_and_release_battery_pin(void) {
// Preserve the battery state. The battery is enabled by default in factory bootloader.
// Reset claimed_pins so user can control pin's state in the vm.
// The code below doesn't actually reset the pin's state, but only set the flags.
reset_pin_number(POWER_SWITCH_PIN->number); // clear claimed_pins and never_reset_pins
never_reset_pin_number(POWER_SWITCH_PIN->number); // set never_reset_pins
}
void board_init(void) {
// As of cpy 8.1.0, board_init() runs after reset_ports() on first run. That means
// never_reset_pins won't be set at boot, the battery pin is reset, causing system
// shutdown.
// So if we need to run on battery, we must enable the battery here.
power_on();
preserve_and_release_battery_pin();
}
void reset_board(void) {
preserve_and_release_battery_pin();
}
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -49,3 +49,5 @@
#define DEFAULT_I2C_BUS_SCL (&pin_P1_06) #define DEFAULT_I2C_BUS_SCL (&pin_P1_06)
#define DEFAULT_I2C_BUS_SDA (&pin_P1_05) #define DEFAULT_I2C_BUS_SDA (&pin_P1_05)
#define POWER_SWITCH_PIN (&pin_P0_28)

View File

@ -39,6 +39,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_CHARGING), MP_ROM_PTR(&pin_P0_03) }, { MP_ROM_QSTR(MP_QSTR_CHARGING), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_02) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_02) }, { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY_ENABLE), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_RGB_POWER), MP_ROM_PTR(&pin_P1_04) }, { MP_ROM_QSTR(MP_QSTR_RGB_POWER), MP_ROM_PTR(&pin_P1_04) },