[riot-notifications] [RIOT] cpu/stm32f1: optimized baudrate calculation (#3893)

Oleg Hahm notifications at github.com
Fri Sep 18 15:53:18 CEST 2015


> @@ -136,9 +135,9 @@ int uart_init_blocking(uart_t uart, uint32_t baudrate)
>      gpio_init(rx_pin, GPIO_DIR_IN, GPIO_NOPULL);
>  
>      /* configure UART to mode 8N1 with given baudrate */
> -    divider = ((float)bus_freq) / (16 * baudrate);
> -    mantissa = (uint16_t)floorf(divider);
> -    fraction = (uint8_t)floorf((divider - mantissa) * 16);
> +    bus_freq /= baudrate;

Yes, look at the switch-case statement. If no proper UART is given it will return.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3893/files#r39856475
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150918/d61ef48b/attachment.html>


More information about the notifications mailing list