added tud_cdc_write_str, tu_fifo only use mutex for RTOS config
This commit is contained in:
@@ -32,12 +32,6 @@
|
||||
target_reset_script="Reset();"
|
||||
target_script_file="$(ProjectDir)/nRF_Target.js"
|
||||
target_trace_initialize_script="EnableTrace("$(TraceInterfaceType)")" />
|
||||
<folder Name="RTT Files">
|
||||
<file file_name="SEGGER_RTT.c" />
|
||||
<file file_name="SEGGER_RTT.h" />
|
||||
<file file_name="SEGGER_RTT_Conf.h" />
|
||||
<file file_name="SEGGER_RTT_SES.c" />
|
||||
</folder>
|
||||
<folder Name="Script Files">
|
||||
<file file_name="nRF_Target.js">
|
||||
<configuration Name="Common" file_type="Reset Script" />
|
||||
@@ -60,6 +54,12 @@
|
||||
<file file_name="../src/msc_flash_qspi.c" />
|
||||
<file file_name="../src/msc_app.c" />
|
||||
<file file_name="../src/msc_app.h" />
|
||||
<folder Name="segger_rtt">
|
||||
<file file_name="../src/segger_rtt/SEGGER_RTT.c" />
|
||||
<file file_name="../src/segger_rtt/SEGGER_RTT_Conf.h" />
|
||||
<file file_name="../src/segger_rtt/SEGGER_RTT.h" />
|
||||
<file file_name="../src/segger_rtt/SEGGER_RTT_SES.c" />
|
||||
</folder>
|
||||
</folder>
|
||||
<folder Name="hw">
|
||||
<folder Name="bsp">
|
||||
|
||||
@@ -101,18 +101,32 @@ void cdc_task(void* params)
|
||||
while ( 1 )
|
||||
{
|
||||
// connected and there are data available
|
||||
if ( tud_mounted() && tud_cdc_available() )
|
||||
if ( tud_cdc_connected() )
|
||||
{
|
||||
uint8_t buf[64];
|
||||
if ( tud_cdc_available() )
|
||||
{
|
||||
uint8_t buf[64];
|
||||
|
||||
// read and echo back
|
||||
uint32_t count = tud_cdc_read(buf, sizeof(buf));
|
||||
// read and echo back
|
||||
uint32_t count = tud_cdc_read(buf, sizeof(buf));
|
||||
|
||||
tud_cdc_write(buf, count);
|
||||
}
|
||||
|
||||
tud_cdc_write(buf, count);
|
||||
tud_cdc_write_flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
taskYIELD();
|
||||
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
||||
{
|
||||
(void) itf;
|
||||
|
||||
// connected
|
||||
if ( dtr && rts )
|
||||
{
|
||||
// print greeting
|
||||
tud_cdc_write_str("tinyusb usb cdc\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
/*------------- RTOS -------------*/
|
||||
#define CFG_TUSB_OS OPT_OS_FREERTOS
|
||||
#define CFG_TUD_TASK_PRIO (configMAX_PRIORITIES-3)
|
||||
#define CFG_TUD_TASK_PRIO (configMAX_PRIORITIES-1)
|
||||
//#define CFG_TUD_TASK_QUEUE_SZ 16
|
||||
//#define CFG_TUD_TASK_STACK_SZ 150
|
||||
|
||||
|
||||
Reference in New Issue
Block a user