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).
pull/5610/head
Damien George 2020-02-07 12:55:12 +11:00
rodzic 046ae80bdf
commit ce40abcf21
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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);