Skip to content

Commit

Permalink
fixed compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiko Kuester committed Mar 2, 2024
1 parent 243108b commit cb69ff1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/class/cdc/cdc_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,9 +1170,9 @@ static bool ftdi_change_speed(cdch_interface_t * p_cdc, tuh_xfer_cb_t complete_c

static bool ftdi_set_data_request(cdch_interface_t * p_cdc, tuh_xfer_cb_t complete_cb, uintptr_t user_data) {
TU_VERIFY(p_cdc->requested_line_coding.data_bits >= 7 && p_cdc->requested_line_coding.data_bits <= 8, 0);
uint16_t value = (p_cdc->requested_line_coding.data_bits & 0xfu) | // data bit quantity is stored in bits 0-3
(p_cdc->requested_line_coding.parity & 0x7u) << 8 | // parity is stored in bits 8-10, same coding
(p_cdc->requested_line_coding.stop_bits & 0x3u) << 11; // stop bits quantity is stored in bits 11-12, same coding
uint16_t value = (p_cdc->requested_line_coding.data_bits & (uint16_t) 0xfu) | // data bit quantity is stored in bits 0-3
(p_cdc->requested_line_coding.parity & (uint16_t) 0x7u) << 8 | // parity is stored in bits 8-10, same coding
(p_cdc->requested_line_coding.stop_bits & (uint16_t) 0x3u) << 11; // stop bits quantity is stored in bits 11-12, same coding
// not each FTDI supports 1.5 stop bits

return ftdi_set_request(p_cdc, FTDI_SIO_SET_DATA_REQUEST, FTDI_SIO_SET_DATA_REQUEST_TYPE,
Expand Down Expand Up @@ -1703,9 +1703,9 @@ static bool cp210x_set_baudrate_request(cdch_interface_t * p_cdc, tuh_xfer_cb_t

static bool cp210x_set_line_ctl(cdch_interface_t * p_cdc, tuh_xfer_cb_t complete_cb, uintptr_t user_data) {
TU_VERIFY(p_cdc->requested_line_coding.data_bits >= 5 && p_cdc->requested_line_coding.data_bits <= 9, 0);
uint16_t lcr = (p_cdc->requested_line_coding.data_bits & 0xfu) << 8 | // data bit quantity is stored in bits 8-11
(p_cdc->requested_line_coding.parity & 0xfu) << 4 | // parity is stored in bits 4-7, same coding
(p_cdc->requested_line_coding.stop_bits & 0xfu); // parity is stored in bits 0-3, same coding
uint16_t lcr = (p_cdc->requested_line_coding.data_bits & (uint16_t) 0xfu) << 8 | // data bit quantity is stored in bits 8-11
(p_cdc->requested_line_coding.parity & (uint16_t) 0xfu) << 4 | // parity is stored in bits 4-7, same coding
(p_cdc->requested_line_coding.stop_bits & (uint16_t) 0xfu); // parity is stored in bits 0-3, same coding

return cp210x_set_request(p_cdc, CP210X_SET_LINE_CTL, lcr, NULL, 0, complete_cb, user_data);
}
Expand Down

0 comments on commit cb69ff1

Please sign in to comment.