uncrustify with newer version of uncrustify
This commit is contained in:
parent
cc95b71d64
commit
be7b2b00a8
|
@ -65,7 +65,7 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
|
|||
{ MP_QSTR_report_descriptor, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_usage_page, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_usage, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_in_report_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT } ,
|
||||
{ MP_QSTR_in_report_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
|
||||
{ MP_QSTR_out_report_length, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } },
|
||||
{ MP_QSTR_report_id_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } },
|
||||
};
|
||||
|
@ -98,10 +98,9 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
|
|||
const mp_obj_t out_report_length_arg = args[ARG_out_report_length].u_obj;
|
||||
if (out_report_length_arg == mp_const_none) {
|
||||
self->out_report_length = 0;
|
||||
}
|
||||
else if (!mp_obj_is_small_int(out_report_length_arg) ||
|
||||
MP_OBJ_SMALL_INT_VALUE(out_report_length_arg) <= 0 ||
|
||||
MP_OBJ_SMALL_INT_VALUE(out_report_length_arg) > 255) {
|
||||
} else if (!mp_obj_is_small_int(out_report_length_arg) ||
|
||||
MP_OBJ_SMALL_INT_VALUE(out_report_length_arg) <= 0 ||
|
||||
MP_OBJ_SMALL_INT_VALUE(out_report_length_arg) > 255) {
|
||||
mp_raise_ValueError_varg(translate("%q must be None or 1-255"), MP_QSTR_out_report_length);
|
||||
}
|
||||
uint8_t out_report_length = MP_OBJ_SMALL_INT_VALUE(out_report_length_arg);
|
||||
|
@ -109,10 +108,9 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
|
|||
const mp_obj_t report_id_index_arg = args[ARG_report_id_index].u_obj;
|
||||
if (report_id_index_arg == mp_const_none) {
|
||||
self->report_id_index = 0;
|
||||
}
|
||||
else if (!mp_obj_is_small_int(report_id_index_arg) ||
|
||||
MP_OBJ_SMALL_INT_VALUE(report_id_index_arg) <= 0 ||
|
||||
MP_OBJ_SMALL_INT_VALUE(report_id_index_arg) > 255 ) {
|
||||
} else if (!mp_obj_is_small_int(report_id_index_arg) ||
|
||||
MP_OBJ_SMALL_INT_VALUE(report_id_index_arg) <= 0 ||
|
||||
MP_OBJ_SMALL_INT_VALUE(report_id_index_arg) > 255) {
|
||||
mp_raise_ValueError_varg(translate("%q must be None or 1-255"), MP_QSTR_report_id_index);
|
||||
}
|
||||
uint8_t report_id_index = MP_OBJ_SMALL_INT_VALUE(report_id_index_arg);
|
||||
|
|
|
@ -91,9 +91,9 @@ size_t storage_usb_descriptor_length(void) {
|
|||
return sizeof(usb_msc_descriptor_template);
|
||||
}
|
||||
|
||||
static const char storage_interface_name[] = USB_INTERFACE_NAME " Mass Storage";
|
||||
static const char storage_interface_name[] = USB_INTERFACE_NAME " Mass Storage";
|
||||
|
||||
size_t storage_usb_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string) {
|
||||
size_t storage_usb_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string) {
|
||||
memcpy(descriptor_buf, usb_msc_descriptor_template, sizeof(usb_msc_descriptor_template));
|
||||
descriptor_buf[MSC_INTERFACE_INDEX] = *current_interface;
|
||||
(*current_interface)++;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
bool storage_usb_enabled(void);
|
||||
void storage_usb_set_defaults(void);
|
||||
size_t storage_usb_descriptor_length(void);
|
||||
size_t storage_usb_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string);
|
||||
size_t storage_usb_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string);
|
||||
#endif
|
||||
|
||||
#endif // SHARED_MODULE_STORAGE___INIT___H
|
||||
|
|
|
@ -173,7 +173,7 @@ size_t usb_cdc_descriptor_length(void) {
|
|||
return sizeof(usb_cdc_descriptor_template);
|
||||
}
|
||||
|
||||
size_t usb_cdc_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string, bool repl) {
|
||||
size_t usb_cdc_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string, bool repl) {
|
||||
memcpy(descriptor_buf, usb_cdc_descriptor_template, sizeof(usb_cdc_descriptor_template));
|
||||
|
||||
// Store comm interface number.
|
||||
|
@ -206,12 +206,12 @@ size_t usb_cdc_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interfac
|
|||
(*current_endpoint)++;
|
||||
|
||||
usb_add_interface_string(*current_interface_string,
|
||||
repl ? repl_cdc_comm_interface_name : data_cdc_comm_interface_name);
|
||||
repl ? repl_cdc_comm_interface_name : data_cdc_comm_interface_name);
|
||||
descriptor_buf[CDC_COMM_INTERFACE_STRING_INDEX] = *current_interface_string;
|
||||
(*current_interface_string)++;
|
||||
|
||||
usb_add_interface_string(*current_interface_string,
|
||||
repl ? repl_cdc_data_interface_name : data_cdc_data_interface_name);
|
||||
repl ? repl_cdc_data_interface_name : data_cdc_data_interface_name);
|
||||
descriptor_buf[CDC_DATA_INTERFACE_STRING_INDEX] = *current_interface_string;
|
||||
(*current_interface_string)++;
|
||||
|
||||
|
|
|
@ -36,6 +36,6 @@ bool usb_cdc_data_enabled(void);
|
|||
void usb_cdc_set_defaults(void);
|
||||
|
||||
size_t usb_cdc_descriptor_length(void);
|
||||
size_t usb_cdc_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string, bool repl);
|
||||
size_t usb_cdc_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string, bool repl);
|
||||
|
||||
#endif /* SHARED_MODULE_USB_CDC___INIT___H */
|
||||
|
|
|
@ -36,38 +36,38 @@
|
|||
#include "tusb.h"
|
||||
|
||||
static const uint8_t keyboard_report_descriptor[] = {
|
||||
0x05, 0x01, // 0,1 Usage Page (Generic Desktop Ctrls)
|
||||
0x09, 0x06, // 2,3 Usage (Keyboard)
|
||||
0xA1, 0x01, // 4,5 Collection (Application)
|
||||
0x85, 0xFF, // 6,7 Report ID [SET AT RUNTIME]
|
||||
0x05, 0x01, // 0,1 Usage Page (Generic Desktop Ctrls)
|
||||
0x09, 0x06, // 2,3 Usage (Keyboard)
|
||||
0xA1, 0x01, // 4,5 Collection (Application)
|
||||
0x85, 0xFF, // 6,7 Report ID [SET AT RUNTIME]
|
||||
#define KEYBOARD_REPORT_ID_INDEX (7)
|
||||
0x05, 0x07, // Usage Page (Kbrd/Keypad)
|
||||
0x19, 0xE0, // Usage Minimum (0xE0)
|
||||
0x29, 0xE7, // Usage Maximum (0xE7)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0x01, // Logical Maximum (1)
|
||||
0x75, 0x01, // Report Size (1)
|
||||
0x95, 0x08, // Report Count (8)
|
||||
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x19, 0x00, // Usage Minimum (0x00)
|
||||
0x29, 0xDD, // Usage Maximum (0xDD)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0xDD, // Logical Maximum (-35)
|
||||
0x75, 0x08, // Report Size (8)
|
||||
0x95, 0x06, // Report Count (6)
|
||||
0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x05, 0x08, // Usage Page (LEDs)
|
||||
0x19, 0x01, // Usage Minimum (Num Lock)
|
||||
0x29, 0x05, // Usage Maximum (Kana)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0x01, // Logical Maximum (1)
|
||||
0x75, 0x01, // Report Size (1)
|
||||
0x95, 0x05, // Report Count (5)
|
||||
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
|
||||
0x95, 0x03, // Report Count (3)
|
||||
0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
|
||||
0xC0, // End Collection
|
||||
0x05, 0x07, // Usage Page (Kbrd/Keypad)
|
||||
0x19, 0xE0, // Usage Minimum (0xE0)
|
||||
0x29, 0xE7, // Usage Maximum (0xE7)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0x01, // Logical Maximum (1)
|
||||
0x75, 0x01, // Report Size (1)
|
||||
0x95, 0x08, // Report Count (8)
|
||||
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x19, 0x00, // Usage Minimum (0x00)
|
||||
0x29, 0xDD, // Usage Maximum (0xDD)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0xDD, // Logical Maximum (-35)
|
||||
0x75, 0x08, // Report Size (8)
|
||||
0x95, 0x06, // Report Count (6)
|
||||
0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
|
||||
0x05, 0x08, // Usage Page (LEDs)
|
||||
0x19, 0x01, // Usage Minimum (Num Lock)
|
||||
0x29, 0x05, // Usage Maximum (Kana)
|
||||
0x15, 0x00, // Logical Minimum (0)
|
||||
0x25, 0x01, // Logical Maximum (1)
|
||||
0x75, 0x01, // Report Size (1)
|
||||
0x95, 0x05, // Report Count (5)
|
||||
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
|
||||
0x95, 0x03, // Report Count (3)
|
||||
0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
|
||||
0xC0, // End Collection
|
||||
};
|
||||
|
||||
const usb_hid_device_obj_t usb_hid_device_keyboard_obj = {
|
||||
|
|
|
@ -112,10 +112,10 @@ size_t usb_hid_descriptor_length(void) {
|
|||
return sizeof(usb_hid_descriptor_template);
|
||||
}
|
||||
|
||||
static const char usb_hid_interface_name[] = USB_INTERFACE_NAME " HID";
|
||||
static const char usb_hid_interface_name[] = USB_INTERFACE_NAME " HID";
|
||||
|
||||
// This is the interface descriptor, not the report descriptor.
|
||||
size_t usb_hid_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string, uint16_t report_descriptor_length) {
|
||||
size_t usb_hid_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string, uint16_t report_descriptor_length) {
|
||||
memcpy(descriptor_buf, usb_hid_descriptor_template, sizeof(usb_hid_descriptor_template));
|
||||
|
||||
descriptor_buf[HID_DESCRIPTOR_INTERFACE_INDEX] = *current_interface;
|
||||
|
@ -176,7 +176,7 @@ bool common_hal_usb_hid_configure_usb(const mp_obj_t devices) {
|
|||
void usb_hid_setup_devices(void) {
|
||||
usb_hid_set_devices_from_hid_devices();
|
||||
|
||||
// Create report buffers on the heap.
|
||||
// Create report buffers on the heap.
|
||||
for (mp_int_t i = 0; i < hid_devices_num; i++) {
|
||||
usb_hid_device_create_report_buffers(&hid_devices[i]);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ size_t usb_hid_report_descriptor_length(void) {
|
|||
}
|
||||
|
||||
// Build the combined HID report descriptor in the given space.
|
||||
void usb_hid_build_report_descriptor(uint8_t* report_descriptor_space, size_t report_descriptor_length) {
|
||||
void usb_hid_build_report_descriptor(uint8_t *report_descriptor_space, size_t report_descriptor_length) {
|
||||
uint8_t *report_descriptor_start = report_descriptor_space;
|
||||
|
||||
for (mp_int_t i = 0; i < hid_devices_num; i++) {
|
||||
|
@ -209,7 +209,7 @@ void usb_hid_build_report_descriptor(uint8_t* report_descriptor_space, size_t re
|
|||
memcpy(report_descriptor_start, device->report_descriptor, device->report_id_index - 1);
|
||||
report_descriptor_start += device->report_id_index - 1;
|
||||
memcpy(report_descriptor_start, device->report_descriptor + device->report_id_index + 1,
|
||||
device->report_descriptor_length - device->report_id_index - 1);
|
||||
device->report_descriptor_length - device->report_id_index - 1);
|
||||
} else {
|
||||
// Copy the whole descriptor and fill in the report id.
|
||||
memcpy(report_descriptor_start, device->report_descriptor, device->report_descriptor_length);
|
||||
|
@ -236,8 +236,8 @@ void usb_hid_save_report_descriptor(uint8_t *report_descriptor_space, size_t rep
|
|||
// will leave between VM instantiations.
|
||||
hid_report_descriptor_allocation =
|
||||
allocate_memory(align32_size(report_descriptor_length),
|
||||
/*high_address*/ false, /*movable*/ false);
|
||||
memcpy((uint8_t *) hid_report_descriptor_allocation->ptr, report_descriptor_space, report_descriptor_length);
|
||||
/*high_address*/ false, /*movable*/ false);
|
||||
memcpy((uint8_t *)hid_report_descriptor_allocation->ptr, report_descriptor_space, report_descriptor_length);
|
||||
}
|
||||
|
||||
void usb_hid_gc_collect(void) {
|
||||
|
@ -263,5 +263,5 @@ usb_hid_device_obj_t *usb_hid_get_device_with_report_id(uint8_t report_id) {
|
|||
// Application return pointer to descriptor
|
||||
// Descriptor contents must exist long enough for transfer to complete
|
||||
uint8_t const *tud_hid_descriptor_report_cb(uint8_t itf) {
|
||||
return (uint8_t *) hid_report_descriptor_allocation->ptr;
|
||||
return (uint8_t *)hid_report_descriptor_allocation->ptr;
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ extern usb_hid_device_obj_t usb_hid_devices[];
|
|||
bool usb_hid_enabled(void);
|
||||
void usb_hid_set_defaults(void);
|
||||
|
||||
size_t usb_hid_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string, uint16_t report_descriptor_length);
|
||||
size_t usb_hid_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string, uint16_t report_descriptor_length);
|
||||
size_t usb_hid_descriptor_length(void);
|
||||
size_t usb_hid_report_descriptor_length(void);
|
||||
|
||||
void usb_hid_setup_devices(void);
|
||||
size_t usb_hid_report_descriptor_length(void);
|
||||
void usb_hid_build_report_descriptor(uint8_t* report_descriptor_space, size_t report_descriptor_length);
|
||||
void usb_hid_build_report_descriptor(uint8_t *report_descriptor_space, size_t report_descriptor_length);
|
||||
void usb_hid_save_report_descriptor(uint8_t *report_descriptor_space, size_t report_descriptor_length);
|
||||
|
||||
usb_hid_device_obj_t *usb_hid_get_device_with_report_id(uint8_t report_id);
|
||||
|
|
|
@ -170,12 +170,12 @@ size_t usb_midi_descriptor_length(void) {
|
|||
return sizeof(usb_midi_descriptor_template);
|
||||
}
|
||||
|
||||
static const char midi_streaming_interface_name[] = USB_INTERFACE_NAME " MIDI";
|
||||
static const char midi_streaming_interface_name[] = USB_INTERFACE_NAME " MIDI";
|
||||
static const char midi_audio_control_interface_name[] = USB_INTERFACE_NAME " Audio";
|
||||
static const char midi_in_jack_name[] = USB_INTERFACE_NAME " usb_midi.ports[0]";
|
||||
static const char midi_out_jack_name[] = USB_INTERFACE_NAME " usb_midi.ports[0]";
|
||||
static const char midi_in_jack_name[] = USB_INTERFACE_NAME " usb_midi.ports[0]";
|
||||
static const char midi_out_jack_name[] = USB_INTERFACE_NAME " usb_midi.ports[0]";
|
||||
|
||||
size_t usb_midi_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string) {
|
||||
size_t usb_midi_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string) {
|
||||
memcpy(descriptor_buf, usb_midi_descriptor_template, sizeof(usb_midi_descriptor_template));
|
||||
|
||||
descriptor_buf[MIDI_AUDIO_CONTROL_INTERFACE_NUMBER_INDEX] = *current_interface;
|
||||
|
|
|
@ -32,6 +32,6 @@ void usb_midi_set_defaults(void);
|
|||
void usb_midi_setup_ports(void);
|
||||
|
||||
size_t usb_midi_descriptor_length(void);
|
||||
size_t usb_midi_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t* current_interface_string);
|
||||
size_t usb_midi_add_descriptor(uint8_t *descriptor_buf, uint8_t *current_interface, uint8_t *current_endpoint, uint8_t *current_interface_string);
|
||||
|
||||
#endif /* SHARED_MODULE_USB_MIDI___INIT___H */
|
||||
|
|
|
@ -34,42 +34,42 @@
|
|||
|
||||
enum {
|
||||
CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT =
|
||||
// stack + heap
|
||||
2
|
||||
// stack + heap
|
||||
2
|
||||
|
||||
#if INTERNAL_FLASH_FILESYSTEM == 0
|
||||
+ 1
|
||||
#endif
|
||||
#if INTERNAL_FLASH_FILESYSTEM == 0
|
||||
+ 1
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_USB
|
||||
+1 // device_descriptor_allocation
|
||||
+1 // configuration_descriptor_allocation
|
||||
+1 // string_descriptors_allocation
|
||||
#endif
|
||||
#if CIRCUITPY_USB
|
||||
+ 1 // device_descriptor_allocation
|
||||
+ 1 // configuration_descriptor_allocation
|
||||
+ 1 // string_descriptors_allocation
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_USB_HID
|
||||
+ 1 // hid_report_descriptor_allocation
|
||||
+ 1 // hid_devices_allocation
|
||||
#endif
|
||||
#if CIRCUITPY_USB_HID
|
||||
+ 1 // hid_report_descriptor_allocation
|
||||
+ 1 // hid_devices_allocation
|
||||
#endif
|
||||
,
|
||||
|
||||
CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT =
|
||||
0
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
+ 1
|
||||
#endif
|
||||
+ CIRCUITPY_DISPLAY_LIMIT * (
|
||||
// Maximum needs of one display: max(4 if RGBMATRIX, 1 if SHARPDISPLAY, 0)
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
4
|
||||
#elif CIRCUITPY_SHARPDISPLAY
|
||||
1
|
||||
#else
|
||||
0
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#if CIRCUITPY_TERMINALIO
|
||||
+ 1
|
||||
#endif
|
||||
+ CIRCUITPY_DISPLAY_LIMIT * (
|
||||
// Maximum needs of one display: max(4 if RGBMATRIX, 1 if SHARPDISPLAY, 0)
|
||||
#if CIRCUITPY_RGBMATRIX
|
||||
4
|
||||
#elif CIRCUITPY_SHARPDISPLAY
|
||||
1
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
)
|
||||
#endif
|
||||
,
|
||||
|
||||
CIRCUITPY_SUPERVISOR_ALLOC_COUNT = CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT + CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT
|
||||
|
|
Loading…
Reference in New Issue