- static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)
- {
- /* USER CODE BEGIN 6 */
- extern TaskHandle_t xConsoleHandle;
- uint32_t count = 0x00;
- BaseType_t xHigherPriorityTaskWoken;
-
- USBD_CDC_SetRxBuffer(&hUsbDeviceFS, &Buf[0]);
- USBD_CDC_ReceivePacket(&hUsbDeviceFS);
-
- count = kfifo_put(&cdcRxFifo, Buf, *Len);
-
- if( count != *Len)
- {
- CDC_Transmit_FS((uint8_t*) "cdc rx buffer full!!!", strlen("cd rx buffer full!!!"));
- }
-
- if(NULL != xConsoleHandle)
- {
- vTaskNotifyGiveFromISR(xConsoleHandle, &xHigherPriorityTaskWoken);
-
- if(xHigherPriorityTaskWoken)
- {
- taskYIELD();
- }
- }
-
- return (USBD_OK);
- /* USER CODE END 6 */
- }
- int xSerialGetChar(xComPortHandle xPort, signed char *cRxedChar, int timeout)
- {
- static uint32_t i = 0x00;
- xPort = xPort;
- if(i == 0x00)
- {
- ulTaskNotifyTake(pdTRUE, timeout);
- i = kfifo_len(&cdcRxFifo);
- }
- if(0x01 == kfifo_get(&cdcRxFifo, cRxedChar, 0x01))
- {
- i--;
- }
- return pdPASS;
- }
|