diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-12-04 15:02:49 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-12-04 15:02:49 +0000 |
commit | d65e5e6b0d687a87abfad5f92a27e5920314f0fa (patch) | |
tree | 34546c2c049abf7609b4d94ff0396cb2bc188a98 /os/hal/platforms/STM32/USARTv2/serial_lld.c | |
parent | 1374037cdcc0ec26be0507aa0886624746ed52ae (diff) | |
download | ChibiOS-d65e5e6b0d687a87abfad5f92a27e5920314f0fa.tar.gz ChibiOS-d65e5e6b0d687a87abfad5f92a27e5920314f0fa.tar.bz2 ChibiOS-d65e5e6b0d687a87abfad5f92a27e5920314f0fa.zip |
Serial support for STM32F3xx.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4871 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32/USARTv2/serial_lld.c')
-rw-r--r-- | os/hal/platforms/STM32/USARTv2/serial_lld.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/os/hal/platforms/STM32/USARTv2/serial_lld.c b/os/hal/platforms/STM32/USARTv2/serial_lld.c index 3c6bb272a..40195319b 100644 --- a/os/hal/platforms/STM32/USARTv2/serial_lld.c +++ b/os/hal/platforms/STM32/USARTv2/serial_lld.c @@ -93,10 +93,7 @@ static void usart_init(SerialDriver *sdp, const SerialConfig *config) { USART_TypeDef *u = sdp->usart;
/* Baud rate setting.*/
- if (sdp->usart == USART1)
- u->BRR = STM32_USART1CLK / config->sc_speed;
- else
- u->BRR = STM32_PCLK / config->sc_speed;
+ u->BRR = sdp->clock / config->sc_speed;
/* Note that some bits are enforced.*/
u->CR2 = config->sc_cr2 | USART_CR2_LBDIE;
@@ -373,26 +370,31 @@ void sd_lld_init(void) { #if STM32_SERIAL_USE_USART1
sdObjectInit(&SD1, NULL, notify1);
SD1.usart = USART1;
+ SD1.clock = STM32_USART1CLK;
#endif
#if STM32_SERIAL_USE_USART2
sdObjectInit(&SD2, NULL, notify2);
SD2.usart = USART2;
+ SD1.clock = STM32_USART2CLK;
#endif
#if STM32_SERIAL_USE_USART3
sdObjectInit(&SD3, NULL, notify3);
SD3.usart = USART3;
+ SD1.clock = STM32_USART3CLK;
#endif
#if STM32_SERIAL_USE_UART4
sdObjectInit(&SD4, NULL, notify4);
SD4.usart = UART4;
+ SD1.clock = STM32_UART4CLK;
#endif
#if STM32_SERIAL_USE_UART5
sdObjectInit(&SD5, NULL, notify5);
SD5.usart = UART5;
+ SD1.clock = STM32_UART5CLK;
#endif
#if STM32_SERIAL_USE_USART6
|