Initial move of USART code to common, still needs some work.

This commit is contained in:
Fergus Noble 2011-09-22 13:52:43 -07:00 committed by Stephen Caudle
parent 7133e79239
commit d1272acaad
2 changed files with 6 additions and 8 deletions

View File

@ -294,7 +294,7 @@
/* --- Function prototypes ------------------------------------------------- */
void usart_set_baudrate(u32 usart, u32 baud);
void usart_set_baudrate(u32 usart, u32 baud, u32 clock);
void usart_set_databits(u32 usart, u32 bits);
void usart_set_stopbits(u32 usart, u32 stopbits);
void usart_set_parity(u32 usart, u32 parity);

View File

@ -17,17 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libopencm3/stm32/f1/rcc.h>
#include <libopencm3/stm32/usart.h>
void usart_set_baudrate(u32 usart, u32 baud)
void usart_set_baudrate(u32 usart, u32 baud, u32 clock)
{
u32 clock = rcc_ppre1_frequency;
//u32 clock = rcc_ppre1_frequency;
if (usart == USART1) {
clock = rcc_ppre2_frequency;
}
//if (usart == USART1) {
// clock = rcc_ppre2_frequency;
//}
/* yes it is as simple as that. The reference manual is
* talking about factional calculation but it seems to be only