Use stream buffer for CLI
This commit is contained in:
committed by
Raphael Coeffic
parent
ae629c4065
commit
b1b3423844
@@ -252,6 +252,13 @@ set(FIRMWARE_SRC
|
||||
${RTOS_DIR}/timers.c
|
||||
rtos.c)
|
||||
|
||||
if(CLI)
|
||||
set(FIRMWARE_SRC
|
||||
${FIRMWARE_SRC}
|
||||
${RTOS_DIR}/stream_buffer.c)
|
||||
endif()
|
||||
|
||||
|
||||
set(PULSES_SRC
|
||||
${PULSES_SRC}
|
||||
pulses.cpp
|
||||
|
||||
@@ -75,6 +75,7 @@ void USB_OTG_BSP_Deinit(USB_OTG_CORE_HANDLE *pdev)
|
||||
*/
|
||||
void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)
|
||||
{
|
||||
// FreeRTOS syscall prio is 5
|
||||
NVIC_SetPriority(OTG_FS_IRQn, 11); // Lower priority interrupt
|
||||
NVIC_EnableIRQ(OTG_FS_IRQn);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,6 @@ uint16_t charsWritten = 0;
|
||||
|
||||
void usbSerialPutc(uint8_t c)
|
||||
{
|
||||
|
||||
/*
|
||||
Apparently there is no reliable way to tell if the
|
||||
virtual serial port is opened or not.
|
||||
@@ -218,23 +217,30 @@ static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len)
|
||||
// the sender and we will receive the same packet at a later time.
|
||||
|
||||
#if defined(CLI)
|
||||
|
||||
//copy data to the application FIFO
|
||||
for (uint32_t i = 0; i < Len; i++) {
|
||||
cliRxFifo.push(Buf[i]);
|
||||
}
|
||||
#endif
|
||||
#if defined(LUA) && !defined(CLI)
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
xStreamBufferSendFromISR(cliRxBuffer, Buf, Len, &xHigherPriorityTaskWoken);
|
||||
|
||||
// Please note that we don't try to yield to the task that has
|
||||
// potentially been woken up, as this might effect a context switch
|
||||
// in place, whereby the ISR is not done yet handling the USB request
|
||||
|
||||
#elif defined(LUA)
|
||||
// TODO: find a better implementation to allow
|
||||
// run-time selection of the USB CDC receiver
|
||||
// (here either CLI or LUA)
|
||||
|
||||
// copy data to the LUA FIFO
|
||||
if (luaRxFifo) {
|
||||
for (uint32_t i = 0; i < Len; i++) {
|
||||
luaRxFifo->push(Buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
Reference in New Issue
Block a user