aboutsummaryrefslogtreecommitdiff
path: root/src/platforms
diff options
context:
space:
mode:
authorGareth McMullin2013-04-27 13:14:22 -0700
committerGareth McMullin2013-04-27 13:14:22 -0700
commite3f3171a33f12064b876b98b537f2c6347761f42 (patch)
tree5e8635ca0d7db806210a890a4d6ab5ce8f00be35 /src/platforms
parent43f7e7a3cf384e880bfefa6257f15c8915b02e3b (diff)
usbuart: Fix build error and clean up whitespace.
Diffstat (limited to 'src/platforms')
-rw-r--r--src/platforms/stm32/usbuart.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/platforms/stm32/usbuart.c b/src/platforms/stm32/usbuart.c
index 6694d90..7f5ebde 100644
--- a/src/platforms/stm32/usbuart.c
+++ b/src/platforms/stm32/usbuart.c
@@ -75,9 +75,12 @@ void usbuart_init(void)
/* Setup timer for running deferred FIFO processing */
USBUSART_TIM_CLK_EN();
timer_reset(USBUSART_TIM);
- timer_set_mode(USBUSART_TIM, TIM_CR1_CKD_CK_INT, TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP);
- timer_set_prescaler(USBUSART_TIM, rcc_ppre2_frequency/TIMER_FREQ_HZ*2 - 1);
- timer_set_period(USBUSART_TIM, TIMER_FREQ_HZ/USBUART_RUN_FREQ_HZ - 1);
+ timer_set_mode(USBUSART_TIM, TIM_CR1_CKD_CK_INT,
+ TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP);
+ timer_set_prescaler(USBUSART_TIM,
+ rcc_ppre2_frequency / USBUART_TIMER_FREQ_HZ * 2 - 1);
+ timer_set_period(USBUSART_TIM,
+ USBUART_TIMER_FREQ_HZ / USBUART_RUN_FREQ_HZ - 1);
/* Setup update interrupt in NVIC */
nvic_set_priority(USBUSART_TIM_IRQ, IRQ_PRI_USBUSART_TIM);
@@ -88,8 +91,9 @@ void usbuart_init(void)
}
/*
- * Runs deferred processing for usb uart rx, draining RX FIFO by sending characters to host PC via CDCACM.
- * Allowed to read from FIFO in pointer, but not write to it. Allowed to write to FIFO out pointer.
+ * Runs deferred processing for usb uart rx, draining RX FIFO by sending
+ * characters to host PC via CDCACM. Allowed to read from FIFO in pointer,
+ * but not write to it. Allowed to write to FIFO out pointer.
*/
static void usbuart_run(void)
{
@@ -125,7 +129,9 @@ static void usbuart_run(void)
}
/* advance fifo out pointer by amount written */
- buf_rx_out = (buf_rx_out + usbd_ep_write_packet(usbdev, CDCACM_UART_ENDPOINT, packet_buf, packet_size)) % FIFO_SIZE;
+ buf_rx_out += usbd_ep_write_packet(usbdev,
+ CDCACM_UART_ENDPOINT, packet_buf, packet_size);
+ buf_rx_out %= FIFO_SIZE;
}
}
@@ -188,7 +194,8 @@ void usbuart_usb_in_cb(usbd_device *dev, uint8_t ep)
/*
* Read a character from the UART RX and stuff it in a software FIFO.
- * Allowed to read from FIFO out pointer, but not write to it. Allowed to write to FIFO in pointer.
+ * Allowed to read from FIFO out pointer, but not write to it.
+ * Allowed to write to FIFO in pointer.
*/
void USBUSART_ISR(void)
{
@@ -224,3 +231,4 @@ void USBUSART_TIM_ISR(void)
/* process FIFO */
usbuart_run();
}
+