logging cleanup. remove printfs from example
This commit is contained in:
parent
89eb35d60b
commit
6510e87911
|
@ -31,6 +31,10 @@
|
|||
#include "bsp/board.h"
|
||||
#include "tusb.h"
|
||||
|
||||
// Change this to 1 and event callback will be logged to stdout
|
||||
#define CH341_LOG_EVENTS 0
|
||||
|
||||
#if (CH341_LOG_EVENTS)
|
||||
static const char * _par_str[] =
|
||||
{
|
||||
"N",
|
||||
|
@ -39,6 +43,7 @@ static const char * _par_str[] =
|
|||
"M",
|
||||
"S"
|
||||
};
|
||||
#endif
|
||||
|
||||
//------------- prototypes -------------//
|
||||
static void ch341_task(void);
|
||||
|
@ -91,26 +96,37 @@ static void ch341_task(void)
|
|||
// Invoked when DTR/RTS changes
|
||||
void tud_ch341_line_state_cb(ch341_line_state_t line_state)
|
||||
{
|
||||
#if (CH341_LOG_EVENTS)
|
||||
printf("DTR=%u, RTS=%u\r\n",
|
||||
line_state & CH341_LINE_STATE_DTR_ACTIVE ? 1 : 0,
|
||||
line_state & CH341_LINE_STATE_RTS_ACTIVE ? 1 : 0);
|
||||
#else
|
||||
(void)(line_state);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Invoked when line coding changes
|
||||
void tud_ch341_line_coding_cb(ch341_line_coding_t const* p_line_coding)
|
||||
{
|
||||
#if (CH341_LOG_EVENTS)
|
||||
printf("BITRATE=%lu (%s%u%u) RX:%s TX:%s\r\n",
|
||||
p_line_coding->bit_rate,
|
||||
(unsigned long)p_line_coding->bit_rate,
|
||||
_par_str[p_line_coding->parity],
|
||||
p_line_coding->data_bits,
|
||||
p_line_coding->stop_bits ? 2 : 1,
|
||||
p_line_coding->rx_en ? "ON":"OFF",
|
||||
p_line_coding->tx_en ? "ON":"OFF");
|
||||
|
||||
#else
|
||||
(void)(p_line_coding);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Invoked when a break signal is received
|
||||
void tud_ch341_send_break_cb(bool is_break_active)
|
||||
{
|
||||
printf("RCV BREAK=%u\r\n", is_break_active);
|
||||
#if (CH341_LOG_EVENTS)
|
||||
printf("RCV BREAK=%s\r\n", is_break_active ? "ON" : "OFF");
|
||||
#else
|
||||
(void)(is_break_active);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -655,7 +655,6 @@ uint16_t ch341d_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
|
|||
uint8_t const * p_desc = tu_desc_next( itf_desc );
|
||||
while (p_desc && drv_len < max_len)
|
||||
{
|
||||
TU_LOG1("ch341d_open:drv_len=%u, max_len=%u\r\n", drv_len, max_len);
|
||||
if (TUSB_DESC_ENDPOINT == tu_desc_type(p_desc))
|
||||
{
|
||||
tusb_desc_endpoint_t const *desc_ep = (tusb_desc_endpoint_t const *)p_desc;
|
||||
|
@ -686,7 +685,6 @@ uint16_t ch341d_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uin
|
|||
// Prepare for incoming data
|
||||
_prep_out_transaction(p_ch341);
|
||||
|
||||
TU_LOG1("ch341d_open:end\r\n");
|
||||
return drv_len;
|
||||
}
|
||||
|
||||
|
@ -764,7 +762,6 @@ bool ch341d_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_
|
|||
else if (stage == CONTROL_STAGE_ACK)
|
||||
{
|
||||
p_ch341->line_state = ch341_decode_mcr(p_ch341, request->wValue);
|
||||
TU_LOG1("CH341_REQ_MODEM_CTRL DTR=%u RTS=%u\r\n", (p_ch341->line_state & CH341_LINE_STATE_BIT_DTR) ? 1 : 0, (p_ch341->line_state & CH341_LINE_STATE_BIT_RTS) ? 1 : 0);
|
||||
p_ch341->line_state_changed = true;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue