Use USART2
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "pwr.h"
|
#include "pwr.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
#include "usart.h"
|
||||||
|
|
||||||
#define exit 42
|
#define exit 42
|
||||||
|
|
||||||
@@ -75,8 +76,10 @@ static void system_clock_init(void) {
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
(void) system_clock_init();
|
(void) system_clock_init();
|
||||||
(void) tim4_init();
|
(void) tim4_init();
|
||||||
|
(void) usart2_init();
|
||||||
|
|
||||||
(void) tim4_start();
|
(void) tim4_start();
|
||||||
|
(void) usart2_start();
|
||||||
|
|
||||||
uint16_t led = PIN('C', 13); // Blue LED
|
uint16_t led = PIN('C', 13); // Blue LED
|
||||||
RCC->AHB1ENR |= (1 << PINPORT(led)); // Enable GPIO clock for LED
|
RCC->AHB1ENR |= (1 << PINPORT(led)); // Enable GPIO clock for LED
|
||||||
@@ -89,6 +92,8 @@ int main(void) {
|
|||||||
led_on = !led_on;
|
led_on = !led_on;
|
||||||
gpio_write(led, led_on);
|
gpio_write(led, led_on);
|
||||||
|
|
||||||
|
usart2_write("hello, world!\n");
|
||||||
|
|
||||||
counter = TIM4->CNT;
|
counter = TIM4->CNT;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user