Change .report to .last_received_report

This commit is contained in:
Dan Halbert 2020-09-10 13:26:51 -04:00 committed by GitHub
parent 9aca580195
commit 40f3cd3615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,21 +58,21 @@ STATIC mp_obj_t usb_hid_device_send_report(mp_obj_t self_in, mp_obj_t buffer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(usb_hid_device_send_report_obj, usb_hid_device_send_report);
//| report: bytes
//| """The HID OUT report as a `bytes`. (read-only)"""
//| last_received_report: bytes
//| """The HID OUT report as a `bytes`. (read-only). `None` if nothing received."""
//|
STATIC mp_obj_t usb_hid_device_obj_get_report(mp_obj_t self_in) {
STATIC mp_obj_t usb_hid_device_obj_get_last_received_report(mp_obj_t self_in) {
usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
if (self->out_report_buffer == 0) {
return mp_const_none;
}
return mp_obj_new_bytes(self->out_report_buffer, self->out_report_length);
}
MP_DEFINE_CONST_FUN_OBJ_1(usb_hid_device_get_report_obj, usb_hid_device_obj_get_report);
MP_DEFINE_CONST_FUN_OBJ_1(usb_hid_device_get_last_received_report_obj, usb_hid_device_obj_get_last_received_report);
const mp_obj_property_t usb_hid_device_report_obj = {
const mp_obj_property_t usb_hid_device_last_received_report_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&usb_hid_device_get_report_obj,
.proxy = {(mp_obj_t)&usb_hid_device_get_last_received_report_obj,
(mp_obj_t)&mp_const_none_obj,
(mp_obj_t)&mp_const_none_obj},
};
@ -114,10 +114,10 @@ const mp_obj_property_t usb_hid_device_usage_obj = {
};
STATIC const mp_rom_map_elem_t usb_hid_device_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_send_report), MP_ROM_PTR(&usb_hid_device_send_report_obj) },
{ MP_ROM_QSTR(MP_QSTR_report), MP_ROM_PTR(&usb_hid_device_report_obj) },
{ MP_ROM_QSTR(MP_QSTR_usage_page), MP_ROM_PTR(&usb_hid_device_usage_page_obj)},
{ MP_ROM_QSTR(MP_QSTR_usage), MP_ROM_PTR(&usb_hid_device_usage_obj)},
{ MP_ROM_QSTR(MP_QSTR_send_report), MP_ROM_PTR(&usb_hid_device_send_report_obj) },
{ MP_ROM_QSTR(MP_QSTR_last_received_report), MP_ROM_PTR(&usb_hid_device_report_obj) },
{ MP_ROM_QSTR(MP_QSTR_usage_page), MP_ROM_PTR(&usb_hid_device_usage_page_obj)},
{ MP_ROM_QSTR(MP_QSTR_usage), MP_ROM_PTR(&usb_hid_device_usage_obj)},
};
STATIC MP_DEFINE_CONST_DICT(usb_hid_device_locals_dict, usb_hid_device_locals_dict_table);