8000 stm32/usbd_cdc_interface: Remove "interrupt_char != -1" check. · jeremyherbert/micropython@ce40abc · GitHub
[go: up one dir, main page]

Skip to content

Commit ce40abc

Browse files
committed
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).
1 parent 046ae80 commit ce40abc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/stm32/usbd_cdc_interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ int8_t usbd_cdc_receive(usbd_cdc_state_t *cdc_in, size_t len) {
267267

268268
// copy the incoming data into the circular buffer
269269
for (const uint8_t *src = cdc->rx_packet_buf, *top = cdc->rx_packet_buf + len; src < top; ++src) {
270-
if (cdc->attached_to_repl && mp_interrupt_char != -1 && *src == mp_interrupt_char) {
270+
if (cdc->attached_to_repl && *src == mp_interrupt_char) {
271271
pendsv_kbd_intr();
272272
} else {
273273
uint16_t next_put = (cdc->rx_buf_put + 1) & (USBD_CDC_RX_DATA_SIZE - 1);

0 commit comments

Comments
 (0)
0