Merge remote-tracking branch 'origin/main' into fs_stub_build_fix
This commit is contained in:
commit
b8d0aadf54
|
@ -400,7 +400,7 @@ jobs:
|
|||
id: idf-cache
|
||||
with:
|
||||
path: ${{ github.workspace }}/.idf_tools
|
||||
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20210923
|
||||
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20220404
|
||||
- name: Clone IDF submodules
|
||||
run: |
|
||||
(cd $IDF_PATH && git submodule update --init)
|
||||
|
|
|
@ -66,8 +66,7 @@ jobs:
|
|||
pip install wheel
|
||||
# requirements_dev.txt doesn't install on windows. (with msys2 python)
|
||||
# instead, pick a subset for what we want to do
|
||||
# Undo the pin of typer & click when undoing it in requirements-dev.txt
|
||||
pip install cascadetoml jinja2 typer==0.4.0 click==8.0.4 intelhex
|
||||
pip install cascadetoml jinja2 typer click intelhex
|
||||
# check that installed packages work....?
|
||||
which python; python --version; python -c "import cascadetoml"
|
||||
which python3; python3 --version; python3 -c "import cascadetoml"
|
||||
|
|
|
@ -247,7 +247,6 @@ static void rtc_init(void) {
|
|||
RTC_MODE0_CTRLA_COUNTSYNC;
|
||||
#endif
|
||||
|
||||
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_OVF;
|
||||
|
||||
// Set all peripheral interrupt priorities to the lowest priority by default.
|
||||
for (uint16_t i = 0; i < PERIPH_COUNT_IRQn; i++) {
|
||||
|
@ -501,45 +500,34 @@ uint32_t port_get_saved_word(void) {
|
|||
// TODO: Move this to an RTC backup register so we can preserve it when only the BACKUP power domain
|
||||
// is enabled.
|
||||
static volatile uint64_t overflowed_ticks = 0;
|
||||
static uint32_t rtc_old_count;
|
||||
|
||||
static uint32_t _get_count(uint64_t *overflow_count) {
|
||||
while (1) {
|
||||
// Disable interrupts so we can grab the count and the overflow atomically.
|
||||
common_hal_mcu_disable_interrupts();
|
||||
|
||||
#ifdef SAM_D5X_E5X
|
||||
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {
|
||||
}
|
||||
#endif
|
||||
// SAMD21 does continuous sync so we don't need to wait here.
|
||||
|
||||
uint32_t count = RTC->MODE0.COUNT.reg;
|
||||
if (overflow_count != NULL) {
|
||||
*overflow_count = overflowed_ticks;
|
||||
}
|
||||
|
||||
bool overflow_pending = RTC->MODE0.INTFLAG.bit.OVF;
|
||||
|
||||
common_hal_mcu_enable_interrupts();
|
||||
|
||||
if (!overflow_pending) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// Try again if overflow hasn't been processed yet.
|
||||
#ifdef SAM_D5X_E5X
|
||||
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {
|
||||
}
|
||||
#endif
|
||||
// SAMD21 does continuous sync so we don't need to wait here.
|
||||
|
||||
uint32_t count = RTC->MODE0.COUNT.reg;
|
||||
if (count < rtc_old_count) {
|
||||
// Our RTC is 32 bits and we're clocking it at 16.384khz which is 16 (2 ** 4) subticks per
|
||||
// tick.
|
||||
overflowed_ticks += (1L << (32 - 4));
|
||||
}
|
||||
rtc_old_count = count;
|
||||
|
||||
if (overflow_count != NULL) {
|
||||
*overflow_count = overflowed_ticks;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
volatile bool _woken_up;
|
||||
|
||||
void RTC_Handler(void) {
|
||||
uint32_t intflag = RTC->MODE0.INTFLAG.reg;
|
||||
if (intflag & RTC_MODE0_INTFLAG_OVF) {
|
||||
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_OVF;
|
||||
// Our RTC is 32 bits and we're clocking it at 16.384khz which is 16 (2 ** 4) subticks per
|
||||
// tick.
|
||||
overflowed_ticks += (1L << (32 - 4));
|
||||
}
|
||||
#ifdef SAM_D5X_E5X
|
||||
if (intflag & RTC_MODE0_INTFLAG_PER2) {
|
||||
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_PER2;
|
||||
|
|
|
@ -108,6 +108,7 @@ STATIC void reset_single_pwmout(uint8_t i) {
|
|||
|
||||
for (int ch = 0; ch < CHANNELS_PER_PWM; ch++) {
|
||||
pwm_seq[i][ch] = (1 << 15); // polarity = 0
|
||||
pwm->PSEL.OUT[ch] = 0xFFFFFFFF; // disconnnect from I/O
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static void shared_callback(busio_uart_obj_t *self) {
|
|||
_copy_into_ringbuf(&self->ringbuf, self->uart);
|
||||
// We always clear the interrupt so it doesn't continue to fire because we
|
||||
// may not have read everything available.
|
||||
uart_get_hw(self->uart)->icr = UART_UARTICR_RXIC_BITS;
|
||||
uart_get_hw(self->uart)->icr = UART_UARTICR_RXIC_BITS | UART_UARTICR_RTIC_BITS;
|
||||
}
|
||||
|
||||
static void uart0_callback(void) {
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "ringbuf.h"
|
||||
|
||||
bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity) {
|
||||
r->heap = false;
|
||||
r->buf = buf;
|
||||
r->size = capacity;
|
||||
r->iget = r->iput = 0;
|
||||
|
@ -40,7 +39,6 @@ bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity) {
|
|||
// size of the buffer is one greater than that, due to how the buffer
|
||||
// handles empty and full statuses.
|
||||
bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) {
|
||||
r->heap = true;
|
||||
r->buf = gc_alloc(capacity + 1, false, long_lived);
|
||||
r->size = capacity + 1;
|
||||
r->iget = r->iput = 0;
|
||||
|
@ -48,9 +46,8 @@ bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) {
|
|||
}
|
||||
|
||||
void ringbuf_free(ringbuf_t *r) {
|
||||
if (r->heap) {
|
||||
gc_free(r->buf);
|
||||
}
|
||||
// Free buf by letting gc take care of it. If the VM has finished already,
|
||||
// this will be safe.
|
||||
r->buf = (uint8_t *)NULL;
|
||||
r->size = 0;
|
||||
ringbuf_clear(r);
|
||||
|
|
|
@ -37,7 +37,6 @@ typedef struct _ringbuf_t {
|
|||
uint32_t size;
|
||||
uint32_t iget;
|
||||
uint32_t iput;
|
||||
bool heap;
|
||||
} ringbuf_t;
|
||||
|
||||
// Note that the capacity of the buffer is N-1!
|
||||
|
|
8
py/vm.c
8
py/vm.c
|
@ -739,8 +739,8 @@ unwind_jump:;
|
|||
obj = mp_getiter(obj, iter_buf);
|
||||
if (obj != MP_OBJ_FROM_PTR(iter_buf)) {
|
||||
// Iterator didn't use the stack so indicate that with MP_OBJ_NULL.
|
||||
sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL;
|
||||
sp[-MP_OBJ_ITER_BUF_NSLOTS + 2] = obj;
|
||||
*(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) = MP_OBJ_NULL;
|
||||
*(sp - MP_OBJ_ITER_BUF_NSLOTS + 2) = obj;
|
||||
}
|
||||
DISPATCH();
|
||||
}
|
||||
|
@ -751,8 +751,8 @@ unwind_jump:;
|
|||
DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward
|
||||
code_state->sp = sp;
|
||||
mp_obj_t obj;
|
||||
if (sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] == MP_OBJ_NULL) {
|
||||
obj = sp[-MP_OBJ_ITER_BUF_NSLOTS + 2];
|
||||
if (*(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) == MP_OBJ_NULL) {
|
||||
obj = *(sp - MP_OBJ_ITER_BUF_NSLOTS + 2);
|
||||
} else {
|
||||
obj = MP_OBJ_FROM_PTR(&sp[-MP_OBJ_ITER_BUF_NSLOTS + 1]);
|
||||
}
|
||||
|
|
|
@ -103,12 +103,12 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
|
|||
mp_obj_t descriptor = mp_obj_new_bytearray(descriptor_bufinfo.len, descriptor_bufinfo.buf);
|
||||
|
||||
const mp_int_t usage_page_arg = args[ARG_usage_page].u_int;
|
||||
mp_arg_validate_int_range(usage_page_arg, 1, 255, MP_QSTR_usage_page);
|
||||
const uint8_t usage_page = usage_page_arg;
|
||||
mp_arg_validate_int_range(usage_page_arg, 1, 0xFFFF, MP_QSTR_usage_page);
|
||||
const uint16_t usage_page = usage_page_arg;
|
||||
|
||||
const mp_int_t usage_arg = args[ARG_usage].u_int;
|
||||
mp_arg_validate_int_range(usage_arg, 1, 255, MP_QSTR_usage_page);
|
||||
const uint8_t usage = usage_arg;
|
||||
mp_arg_validate_int_range(usage_arg, 1, 0xFFFF, MP_QSTR_usage_page);
|
||||
const uint16_t usage = usage_arg;
|
||||
|
||||
mp_obj_t report_ids = args[ARG_report_ids].u_obj;
|
||||
mp_obj_t in_report_lengths = args[ARG_in_report_lengths].u_obj;
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
|
||||
extern const mp_obj_type_t usb_hid_device_type;
|
||||
|
||||
void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint8_t usage_page, uint8_t usage, size_t report_ids_count,uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths);
|
||||
void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint16_t usage_page, uint16_t usage, size_t report_ids_count,uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths);
|
||||
void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t *report, uint8_t len, uint8_t report_id);
|
||||
mp_obj_t common_hal_usb_hid_device_get_last_received_report(usb_hid_device_obj_t *self, uint8_t report_id);
|
||||
uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self);
|
||||
uint8_t common_hal_usb_hid_device_get_usage(usb_hid_device_obj_t *self);
|
||||
uint16_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self);
|
||||
uint16_t common_hal_usb_hid_device_get_usage(usb_hid_device_obj_t *self);
|
||||
uint8_t common_hal_usb_hid_device_validate_report_id(usb_hid_device_obj_t *self, mp_int_t report_id);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_USB_HID_DEVICE_H
|
||||
|
|
|
@ -364,7 +364,7 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t *
|
|||
}
|
||||
|
||||
self->samples_decoded += *buffer_length / sizeof(int16_t);
|
||||
return GET_BUFFER_MORE_DATA;
|
||||
return mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE;
|
||||
}
|
||||
|
||||
void audiomp3_mp3file_get_buffer_structure(audiomp3_mp3file_obj_t *self, bool single_channel_output,
|
||||
|
|
|
@ -186,7 +186,7 @@ uint8_t common_hal_usb_hid_device_validate_report_id(usb_hid_device_obj_t *self,
|
|||
return (uint8_t)report_id_arg;
|
||||
}
|
||||
|
||||
void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint8_t usage_page, uint8_t usage, size_t num_report_ids, uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths) {
|
||||
void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint16_t usage_page, uint16_t usage, size_t num_report_ids, uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths) {
|
||||
if (num_report_ids > CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR) {
|
||||
mp_raise_ValueError_varg(translate("More than %d report ids not supported"),
|
||||
CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR);
|
||||
|
@ -211,11 +211,11 @@ void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t re
|
|||
memcpy(self->out_report_lengths, out_report_lengths, num_report_ids);
|
||||
}
|
||||
|
||||
uint8_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self) {
|
||||
uint16_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self) {
|
||||
return self->usage_page;
|
||||
}
|
||||
|
||||
uint8_t common_hal_usb_hid_device_get_usage(usb_hid_device_obj_t *self) {
|
||||
uint16_t common_hal_usb_hid_device_get_usage(usb_hid_device_obj_t *self) {
|
||||
return self->usage;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ typedef struct {
|
|||
uint8_t report_ids[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t in_report_lengths[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t out_report_lengths[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
|
||||
uint8_t usage_page;
|
||||
uint8_t usage;
|
||||
uint16_t usage_page;
|
||||
uint16_t usage;
|
||||
uint8_t num_report_ids;
|
||||
} usb_hid_device_obj_t;
|
||||
|
||||
|
|
Loading…
Reference in New Issue