aboutsummaryrefslogtreecommitdiff
path: root/src/stm32/cdcacm.c
diff options
context:
space:
mode:
authorGareth McMullin2012-05-23 20:25:45 +1200
committerGareth McMullin2012-05-23 20:25:45 +1200
commit40bb74cc8122c2d9067b2d9d722e0e4a09c148f7 (patch)
tree8d84b074ac905c744e2f800b9093fcbb7f0aa031 /src/stm32/cdcacm.c
parent700f9e6ad146de5ce3eead0169acb4b9ca5e163b (diff)
Detect hardware version. Disable UART on mini h/w under debug.
Diffstat (limited to 'src/stm32/cdcacm.c')
-rw-r--r--src/stm32/cdcacm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stm32/cdcacm.c b/src/stm32/cdcacm.c
index f704a27..232ce78 100644
--- a/src/stm32/cdcacm.c
+++ b/src/stm32/cdcacm.c
@@ -499,6 +499,13 @@ static void cdcacm_data_rx_cb(u8 ep)
char buf[CDCACM_PACKET_SIZE];
int len = usbd_ep_read_packet(0x03, buf, CDCACM_PACKET_SIZE);
+
+ /* Don't bother if uart is disabled.
+ * This will be the case on mini while we're being debugged.
+ */
+ if(!(RCC_APB2ENR & RCC_APB2ENR_USART1EN))
+ return;
+
for(int i = 0; i < len; i++)
usart_send_blocking(USART1, buf[i]);
}