diff options
author | root <root@lamia.panaceas.james.local> | 2015-06-13 12:18:52 +0100 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-06-13 12:18:52 +0100 |
commit | bc9e93ad20f936c67d6acddb02d426783c32398e (patch) | |
tree | c4c128604c92298174cfcd3c1b07878d0ca35ac6 /app/usart.c | |
parent | 500561f54adabc9aaf5b3548744b5bc8b4381c89 (diff) | |
download | stm32_usb_kvm-bc9e93ad20f936c67d6acddb02d426783c32398e.tar.gz stm32_usb_kvm-bc9e93ad20f936c67d6acddb02d426783c32398e.tar.bz2 stm32_usb_kvm-bc9e93ad20f936c67d6acddb02d426783c32398e.zip |
add usb resume support
Diffstat (limited to 'app/usart.c')
-rw-r--r-- | app/usart.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/app/usart.c b/app/usart.c index 4061076..24b1e9d 100644 --- a/app/usart.c +++ b/app/usart.c @@ -31,7 +31,7 @@ usart1_isr (void) data = usart_recv (USART1); - ring_write_byte(&rx1_ring,data); + ring_write_byte (&rx1_ring, data); } /* Check if we were called because of TXE. */ @@ -65,7 +65,7 @@ usart2_isr (void) /* Retrieve the data from the peripheral. */ data = usart_recv (USART2); - ring_write_byte(&rx2_ring,data); + ring_write_byte (&rx2_ring, data); } /* Check if we were called because of TXE. */ @@ -163,17 +163,23 @@ usart_init (void) nvic_enable_irq (NVIC_USART2_IRQ); nvic_enable_irq (NVIC_USART3_IRQ); - /* Map pins, and set usarts2 and 3 to have pull ups*/ - gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX); - gpio_set_mode (GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX); - - gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX); - gpio_set_mode (GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO_USART2_RX); - gpio_set(GPIOA, GPIO_USART2_RX); - - gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_TX); - gpio_set_mode (GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, GPIO_USART3_RX); - gpio_set(GPIOB, GPIO_USART3_RX); + /* Map pins, and set usarts2 and 3 to have pull ups */ + gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_50_MHZ, + GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX); + gpio_set_mode (GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, + GPIO_USART1_RX); + + gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_50_MHZ, + GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART2_TX); + gpio_set_mode (GPIOA, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, + GPIO_USART2_RX); + gpio_set (GPIOA, GPIO_USART2_RX); + + gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_50_MHZ, + GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_TX); + gpio_set_mode (GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, + GPIO_USART3_RX); + gpio_set (GPIOB, GPIO_USART3_RX); |