Merge branch 'adafruit:main' into adcdma

This commit is contained in:
Lee Atkinson 2022-08-24 21:07:12 -04:00 committed by GitHub
commit 55c0404d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -14,14 +14,12 @@ CIRCUITPY_LTO_PARTITION = one
CIRCUITPY_AESIO = 0
CIRCUITPY_FLOPPYIO = 0
CIRCUITPY_GIFIO = 0
CIRCUITPY_ONEWIREIO = 0
CIRCUITPY_PARALLELDISPLAY = 0
CIRCUITPY_SDCARDIO = 0
CIRCUITPY_SHARPDISPLAY = 0
CIRCUITPY_ZLIB=0
CIRCUITPY_ULAB = 0
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel

View File

@ -39,12 +39,13 @@
//| digest_size: int
//| """Digest size in bytes"""
//|
STATIC mp_obj_t hashlib_hash_get_digest_size(mp_obj_t self_in) {
STATIC mp_obj_t hashlib_hash_digest_size_get(mp_obj_t self_in) {
mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type));
hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_hashlib_hash_get_digest_size(self));
}
MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, hashlib_hash_get_digest_size);
MP_DEFINE_CONST_FUN_OBJ_1(hashlib_hash_digest_size_get_obj, hashlib_hash_digest_size_get);
MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_size_get_obj);
//| def update(self, data: ReadableBuffer) -> None:
//| """Update the hash with the given bytes.

View File

@ -24,6 +24,7 @@
* THE SOFTWARE.
*/
#include <stdbool.h>
#include <string.h>
#include "py/gc.h"
@ -241,6 +242,10 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t *
mp_obj_t common_hal_usb_hid_device_get_last_received_report(usb_hid_device_obj_t *self, uint8_t report_id) {
// report_id has already been validated for this device.
size_t id_idx = get_report_id_idx(self, report_id);
if (!self->out_report_buffers_updated[id_idx]) {
return mp_const_none;
}
self->out_report_buffers_updated[id_idx] = false;
return mp_obj_new_bytes(self->out_report_buffers[id_idx], self->out_report_lengths[id_idx]);
}
@ -258,6 +263,7 @@ void usb_hid_device_create_report_buffers(usb_hid_device_obj_t *self) {
? gc_alloc(self->out_report_lengths[i], false, true /*long-lived*/)
: NULL;
}
memset(self->out_report_buffers_updated, 0, sizeof(self->out_report_buffers_updated));
}
@ -304,6 +310,7 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t rep
hid_device->out_report_buffers[id_idx] &&
hid_device->out_report_lengths[id_idx] >= bufsize) {
memcpy(hid_device->out_report_buffers[id_idx], buffer, bufsize);
hid_device->out_report_buffers_updated[id_idx] = true;
}
}
}

View File

@ -38,6 +38,7 @@ typedef struct {
const uint8_t *report_descriptor;
uint8_t *in_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
uint8_t *out_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
uint8_t out_report_buffers_updated[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR];
uint16_t report_descriptor_length;
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];