Skip to content

Commit 8ebc4be

Browse files
committed
Using memset instead of for-loop in UDD_Init
1 parent e01018b commit 8ebc4be

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cores/arduino/USB/samd21_device.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,11 @@ void UDD_Init(void)
143143
/* Set the configuration */
144144
udd_force_device_mode();
145145
udd_device_run_in_standby();
146-
// Set address of USB SRAM
146+
// Set address of USB SRAM
147147
USB->DEVICE.DESCADD.reg = (uint32_t)(&usb_endpoint_table[0]);
148148
// For USB_SPEED_FULL
149149
udd_force_full_speed();
150-
for (i = 0; i < sizeof(usb_endpoint_table); i++) {
151-
(*(uint32_t *)(&usb_endpoint_table[0]+i)) = 0;
152-
}
150+
memset(&usb_endpoint_table[0], 0, sizeof(usb_endpoint_table));
153151

154152
// Configure interrupts
155153
NVIC_SetPriority((IRQn_Type) USB_IRQn, 0UL);

0 commit comments

Comments
 (0)