more update to host serial API
This commit is contained in:
@@ -443,7 +443,7 @@ bool tuh_cdc_set_control_line_state(uint8_t idx, uint16_t line_state, tuh_xfer_c
|
|||||||
return driver->set_control_line_state(p_cdc, line_state, complete_cb, user_data);
|
return driver->set_control_line_state(p_cdc, line_state, complete_cb, user_data);
|
||||||
}else {
|
}else {
|
||||||
// blocking
|
// blocking
|
||||||
xfer_result_t result;
|
xfer_result_t result = XFER_RESULT_INVALID;
|
||||||
bool ret = driver->set_control_line_state(p_cdc, line_state, complete_cb, (uintptr_t) &result);
|
bool ret = driver->set_control_line_state(p_cdc, line_state, complete_cb, (uintptr_t) &result);
|
||||||
|
|
||||||
if (user_data) {
|
if (user_data) {
|
||||||
@@ -451,11 +451,10 @@ bool tuh_cdc_set_control_line_state(uint8_t idx, uint16_t line_state, tuh_xfer_c
|
|||||||
*((xfer_result_t*) user_data) = result;
|
*((xfer_result_t*) user_data) = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == XFER_RESULT_SUCCESS) {
|
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
|
||||||
p_cdc->line_state = (uint8_t) line_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
p_cdc->line_state = (uint8_t) line_state;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,7 +467,7 @@ bool tuh_cdc_set_baudrate(uint8_t idx, uint32_t baudrate, tuh_xfer_cb_t complete
|
|||||||
return driver->set_baudrate(p_cdc, baudrate, complete_cb, user_data);
|
return driver->set_baudrate(p_cdc, baudrate, complete_cb, user_data);
|
||||||
}else {
|
}else {
|
||||||
// blocking
|
// blocking
|
||||||
xfer_result_t result;
|
xfer_result_t result = XFER_RESULT_INVALID;
|
||||||
bool ret = driver->set_baudrate(p_cdc, baudrate, complete_cb, (uintptr_t) &result);
|
bool ret = driver->set_baudrate(p_cdc, baudrate, complete_cb, (uintptr_t) &result);
|
||||||
|
|
||||||
if (user_data) {
|
if (user_data) {
|
||||||
@@ -476,11 +475,10 @@ bool tuh_cdc_set_baudrate(uint8_t idx, uint32_t baudrate, tuh_xfer_cb_t complete
|
|||||||
*((xfer_result_t*) user_data) = result;
|
*((xfer_result_t*) user_data) = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == XFER_RESULT_SUCCESS) {
|
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
|
||||||
p_cdc->line_coding.bit_rate = baudrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
p_cdc->line_coding.bit_rate = baudrate;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,7 +493,7 @@ bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding,
|
|||||||
return acm_set_line_coding(p_cdc, line_coding, complete_cb, user_data);
|
return acm_set_line_coding(p_cdc, line_coding, complete_cb, user_data);
|
||||||
}else {
|
}else {
|
||||||
// blocking
|
// blocking
|
||||||
xfer_result_t result;
|
xfer_result_t result = XFER_RESULT_INVALID;
|
||||||
bool ret = acm_set_line_coding(p_cdc, line_coding, complete_cb, (uintptr_t) &result);
|
bool ret = acm_set_line_coding(p_cdc, line_coding, complete_cb, (uintptr_t) &result);
|
||||||
|
|
||||||
if (user_data) {
|
if (user_data) {
|
||||||
@@ -503,11 +501,10 @@ bool tuh_cdc_set_line_coding(uint8_t idx, cdc_line_coding_t const* line_coding,
|
|||||||
*((xfer_result_t*) user_data) = result;
|
*((xfer_result_t*) user_data) = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == XFER_RESULT_SUCCESS) {
|
TU_VERIFY(ret && result == XFER_RESULT_SUCCESS);
|
||||||
p_cdc->line_coding = *line_coding;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
p_cdc->line_coding = *line_coding;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -138,7 +138,8 @@ bool tuh_cdc_read_clear (uint8_t idx);
|
|||||||
// - If complete_cb is provided, the function will return immediately and invoke
|
// - If complete_cb is provided, the function will return immediately and invoke
|
||||||
// the callback when request is complete.
|
// the callback when request is complete.
|
||||||
// - If complete_cb is NULL, the function will block until request is complete.
|
// - If complete_cb is NULL, the function will block until request is complete.
|
||||||
// In this case, user_data should be pointed to xfer_result_t to hold the transfer result.
|
// - In this case, user_data should be pointed to xfer_result_t to hold the transfer result.
|
||||||
|
// - The function will return true if transfer is successful, false otherwise.
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
// Request to Set Control Line State: DTR (bit 0), RTS (bit 1)
|
// Request to Set Control Line State: DTR (bit 0), RTS (bit 1)
|
||||||
|
Reference in New Issue
Block a user