stm32/usbd_cdc_interface: Remove "interrupt_char != -1" check.
It's not needed. The C integer implicit promotion rules mean that the uint8_t of the incoming character is promoted to a (signed) int, matching the type of interrupt_char. Thus the uint8_t incoming character can never be equal to -1 (the value of interrupt_char that indicate that interruption is disabled).
This commit is contained in:
parent
046ae80bdf
commit
ce40abcf21
|
@ -267,7 +267,7 @@ int8_t usbd_cdc_receive(usbd_cdc_state_t *cdc_in, size_t len) {
|
|||
|
||||
// copy the incoming data into the circular buffer
|
||||
for (const uint8_t *src = cdc->rx_packet_buf, *top = cdc->rx_packet_buf + len; src < top; ++src) {
|
||||
if (cdc->attached_to_repl && mp_interrupt_char != -1 && *src == mp_interrupt_char) {
|
||||
if (cdc->attached_to_repl && *src == mp_interrupt_char) {
|
||||
pendsv_kbd_intr();
|
||||
} else {
|
||||
uint16_t next_put = (cdc->rx_buf_put + 1) & (USBD_CDC_RX_DATA_SIZE - 1);
|
||||
|
|
Loading…
Reference in New Issue