Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libraries/USBDevice/inc/usbd_cdc_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ uint8_t CDC_getStopBits(void);
uint8_t CDC_getParity(void);
uint8_t CDC_getDataBits(void);

/* Optional board hook invoked after the host changes the CDC line coding. */
void CDC_LineCodingChanged(uint32_t bitrate);

#ifdef __cplusplus
}
#endif
Expand Down
7 changes: 7 additions & 0 deletions libraries/USBDevice/src/cdc/usbd_cdc_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ USBD_CDC_LineCodingTypeDef linecoding = {
0x08 /* nb. of bits 8*/
};

/* Boards that need a CDC line-coding side effect can override this hook. */
WEAK void CDC_LineCodingChanged(uint32_t bitrate)
{
(void)bitrate;
}

/* Private functions ---------------------------------------------------------*/

/**
Expand Down Expand Up @@ -175,6 +181,7 @@ static int8_t USBD_CDC_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
linecoding.format = pbuf[4];
linecoding.paritytype = pbuf[5];
linecoding.datatype = pbuf[6];
CDC_LineCodingChanged(linecoding.bitrate);
break;

case CDC_GET_LINE_CODING:
Expand Down
Loading