From 586319c6c2cee268747c8826d93e84b26d1549fd Mon Sep 17 00:00:00 2001 From: Paolo Patruno Date: Mon, 6 Nov 2023 09:30:25 +0100 Subject: [PATCH] chrore(usb): external redefinition of CDC_*_QUEUE_BUFFER_PACKET_NUMBER (#2165) * admit external definition of CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER --- cores/arduino/stm32/usb/cdc/cdc_queue.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cores/arduino/stm32/usb/cdc/cdc_queue.h b/cores/arduino/stm32/usb/cdc/cdc_queue.h index cd10ac2bc5..1ec58d02f0 100644 --- a/cores/arduino/stm32/usb/cdc/cdc_queue.h +++ b/cores/arduino/stm32/usb/cdc/cdc_queue.h @@ -53,8 +53,14 @@ extern "C" { #else #define CDC_QUEUE_MAX_PACKET_SIZE USB_FS_MAX_PACKET_SIZE #endif -#define CDC_TRANSMIT_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * 2)) -#define CDC_RECEIVE_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * 3)) +#ifndef CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER +#define CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER 2 +#endif +#ifndef CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER +#define CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER 3 +#endif +#define CDC_TRANSMIT_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * CDC_TRANSMIT_QUEUE_BUFFER_PACKET_NUMBER)) +#define CDC_RECEIVE_QUEUE_BUFFER_SIZE ((uint16_t)(CDC_QUEUE_MAX_PACKET_SIZE * CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER)) typedef struct { uint8_t buffer[CDC_TRANSMIT_QUEUE_BUFFER_SIZE]; @@ -91,4 +97,4 @@ void CDC_ReceiveQueue_CommitBlock(CDC_ReceiveQueue_TypeDef *queue, uint16_t size } #endif -#endif // __CDC_QUEUE_H \ No newline at end of file +#endif // __CDC_QUEUE_H