stm32f0: eliminate outdated comments
Fixes: https://github.com/libopencm3/libopencm3-examples/pull/229
This commit is contained in:
@@ -28,13 +28,13 @@ static void clock_setup(void)
|
|||||||
rcc_periph_clock_enable(RCC_GPIOC);
|
rcc_periph_clock_enable(RCC_GPIOC);
|
||||||
rcc_periph_clock_enable(RCC_GPIOA);
|
rcc_periph_clock_enable(RCC_GPIOA);
|
||||||
|
|
||||||
/* Enable clocks for USART2. */
|
/* Enable clocks for USART. */
|
||||||
rcc_periph_clock_enable(RCC_USART1);
|
rcc_periph_clock_enable(RCC_USART1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usart_setup(void)
|
static void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART parameters. */
|
||||||
usart_set_baudrate(USART1, 115200);
|
usart_set_baudrate(USART1, 115200);
|
||||||
usart_set_databits(USART1, 8);
|
usart_set_databits(USART1, 8);
|
||||||
usart_set_parity(USART1, USART_PARITY_NONE);
|
usart_set_parity(USART1, USART_PARITY_NONE);
|
||||||
@@ -51,10 +51,10 @@ static void gpio_setup(void)
|
|||||||
/* Setup GPIO pin GPIO8/9 on GPIO port C for LEDs. */
|
/* Setup GPIO pin GPIO8/9 on GPIO port C for LEDs. */
|
||||||
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8 | GPIO9);
|
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8 | GPIO9);
|
||||||
|
|
||||||
/* Setup GPIO pins for USART2 transmit. */
|
/* Setup GPIO pins for USART transmit. */
|
||||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
|
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
|
||||||
|
|
||||||
/* Setup USART1 TX pin as alternate function. */
|
/* Setup USART TX pin as alternate function. */
|
||||||
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ int main(void)
|
|||||||
gpio_setup();
|
gpio_setup();
|
||||||
usart_setup();
|
usart_setup();
|
||||||
|
|
||||||
/* Blink the LED (PD12) on the board with every transmitted byte. */
|
/* Blink the LED on the board with every transmitted byte. */
|
||||||
while (1) {
|
while (1) {
|
||||||
gpio_toggle(GPIOC, GPIO8); /* LED on/off */
|
gpio_toggle(GPIOC, GPIO8); /* LED on/off */
|
||||||
usart_send_blocking(USART1, c + '0'); /* USART1: Send byte. */
|
usart_send_blocking(USART1, c + '0'); /* USART1: Send byte. */
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ static ssize_t _iowr(void *_cookie, const char *_buf, size_t _n)
|
|||||||
|
|
||||||
static FILE *usart_setup(uint32_t dev)
|
static FILE *usart_setup(uint32_t dev)
|
||||||
{
|
{
|
||||||
/* Setup USART2 parameters. */
|
/* Setup USART parameters. */
|
||||||
usart_set_baudrate(dev, 115200);
|
usart_set_baudrate(dev, 115200);
|
||||||
usart_set_databits(dev, 8);
|
usart_set_databits(dev, 8);
|
||||||
usart_set_parity(dev, USART_PARITY_NONE);
|
usart_set_parity(dev, USART_PARITY_NONE);
|
||||||
@@ -79,7 +79,7 @@ static void clock_setup(void)
|
|||||||
rcc_periph_clock_enable(RCC_GPIOC);
|
rcc_periph_clock_enable(RCC_GPIOC);
|
||||||
rcc_periph_clock_enable(RCC_GPIOA);
|
rcc_periph_clock_enable(RCC_GPIOA);
|
||||||
|
|
||||||
/* Enable clocks for USART2. */
|
/* Enable clocks for USART. */
|
||||||
rcc_periph_clock_enable(RCC_USART1);
|
rcc_periph_clock_enable(RCC_USART1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,10 +88,10 @@ static void gpio_setup(void)
|
|||||||
/* Setup GPIO pin GPIO8/9 on GPIO port C for LEDs. */
|
/* Setup GPIO pin GPIO8/9 on GPIO port C for LEDs. */
|
||||||
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8 | GPIO9);
|
gpio_mode_setup(GPIOC, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO8 | GPIO9);
|
||||||
|
|
||||||
/* Setup GPIO pins for USART2 transmit. */
|
/* Setup GPIO pins for USART transmit. */
|
||||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
|
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9);
|
||||||
|
|
||||||
/* Setup USART1 TX pin as alternate function. */
|
/* Setup USART TX pin as alternate function. */
|
||||||
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
gpio_set_af(GPIOA, GPIO_AF1, GPIO9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ int main(void)
|
|||||||
gpio_setup();
|
gpio_setup();
|
||||||
fp = usart_setup(USART1);
|
fp = usart_setup(USART1);
|
||||||
|
|
||||||
/* Blink the LED (PD12) on the board with every transmitted byte. */
|
/* Blink the LED on the board with every transmitted byte. */
|
||||||
while (1) {
|
while (1) {
|
||||||
gpio_toggle(GPIOC, GPIO8); /* LED on/off */
|
gpio_toggle(GPIOC, GPIO8); /* LED on/off */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user