Initial move of USART code to common, still needs some work.
This commit is contained in:
parent
551d069ed3
commit
508e18b26b
@ -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);
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user