summaryrefslogtreecommitdiff
path: root/stm/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm/usb.c')
-rw-r--r--stm/usb.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/stm/usb.c b/stm/usb.c
index 6ac2392a1..0b88e7bf7 100644
--- a/stm/usb.c
+++ b/stm/usb.c
@@ -26,15 +26,17 @@ void usb_init() {
}
void usb_vcp_receive(const char *buf, uint32_t len) {
- for (int i = 0; i < len; i++) {
- rx_buf[rx_buf_in++] = buf[i];
- if (rx_buf_in >= sizeof(rx_buf)) {
- rx_buf_in = 0;
- }
- if (rx_buf_in == rx_buf_out) {
- rx_buf_out = rx_buf_in + 1;
- if (rx_buf_out >= sizeof(rx_buf)) {
- rx_buf_out = 0;
+ if (is_enabled) {
+ for (int i = 0; i < len; i++) {
+ rx_buf[rx_buf_in++] = buf[i];
+ if (rx_buf_in >= sizeof(rx_buf)) {
+ rx_buf_in = 0;
+ }
+ if (rx_buf_in == rx_buf_out) {
+ rx_buf_out = rx_buf_in + 1;
+ if (rx_buf_out >= sizeof(rx_buf)) {
+ rx_buf_out = 0;
+ }
}
}
}