sam3x: Add convenince functions for setting clocks and usart baudrate.

This commit is contained in:
Gareth McMullin
2013-05-03 14:08:18 -07:00
committed by Piotr Esden-Tempski
parent 8265953b35
commit e2eadfddb8
4 changed files with 30 additions and 0 deletions

View File

@@ -18,6 +18,12 @@
*/
#include <libopencm3/sam3x/usart.h>
#include <libopencm3/sam3x/pmc.h>
void usart_set_baudrate(u32 usart, u32 baud)
{
USART_BRGR(usart) = pmc_mck_frequency / (16 * baud);
}
void usart_set_databits(u32 usart, int bits)
{