From cb69ff1110acbc04f2836cff68a357a6cd2afa81 Mon Sep 17 00:00:00 2001 From: Heiko Kuester Date: Sat, 2 Mar 2024 11:16:31 +0100 Subject: [PATCH] fixed compiler warnings --- src/class/cdc/cdc_host.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c index 6c6c0d3570..ebf8ac6d34 100644 --- a/src/class/cdc/cdc_host.c +++ b/src/class/cdc/cdc_host.c @@ -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, @@ -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); }