obldc examples: Fix comments and coding-style.
This commit is contained in:
parent
f3f1123d07
commit
4cf395d3c9
@ -66,7 +66,7 @@ void gpio_setup(void)
|
|||||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO7);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO7);
|
||||||
|
|
||||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
/* Set GPIO0/1 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO0);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO0);
|
||||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
#include <libopencm3/stm32/f1/rcc.h>
|
#include <libopencm3/stm32/f1/rcc.h>
|
||||||
#include <libopencm3/stm32/f1/gpio.h>
|
#include <libopencm3/stm32/f1/gpio.h>
|
||||||
|
|
||||||
/* Set STM32 to 72 MHz. */
|
|
||||||
void clock_setup(void)
|
void clock_setup(void)
|
||||||
{
|
{
|
||||||
|
/* Set STM32 to 72 MHz. */
|
||||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||||
|
|
||||||
/* Enable GPIOA clock. */
|
/* Enable GPIOA clock. */
|
||||||
|
@ -156,7 +156,7 @@ static const u16 gamma_table_2_2[] = {
|
|||||||
49275, 49761, 50249, 50739, 51232, 51728, 52226, 52727,
|
49275, 49761, 50249, 50739, 51232, 51728, 52226, 52727,
|
||||||
53230, 53736, 54245, 54756, 55270, 55787, 56306, 56828,
|
53230, 53736, 54245, 54756, 55270, 55787, 56306, 56828,
|
||||||
57352, 57879, 58409, 58941, 59476, 60014, 60554, 61097,
|
57352, 57879, 58409, 58941, 59476, 60014, 60554, 61097,
|
||||||
61642, 62190, 62741, 63295, 63851, 64410, 64971, 65535
|
61642, 62190, 62741, 63295, 63851, 64410, 64971, 65535,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void gpio_setup(void)
|
|||||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO7);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO7);
|
||||||
|
|
||||||
/* Set GPIO6/7 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
/* Set GPIO0/1 (in GPIO port B) to 'output push-pull' for the LEDs. */
|
||||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO0);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO0);
|
||||||
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
|
@ -60,7 +60,7 @@ void usart_setup(void)
|
|||||||
|
|
||||||
void gpio_setup(void)
|
void gpio_setup(void)
|
||||||
{
|
{
|
||||||
/* Set GPIO12 (in GPIO port C) to 'output push-pull'. */
|
/* Set GPIO6 (in GPIO port A) to 'output push-pull'. */
|
||||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO6);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO6);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ int main(void)
|
|||||||
gpio_setup();
|
gpio_setup();
|
||||||
usart_setup();
|
usart_setup();
|
||||||
|
|
||||||
/* Blink the LED (PC12) on the board with every transmitted byte. */
|
/* Blink the LED (PA6) on the board with every transmitted byte. */
|
||||||
while (1) {
|
while (1) {
|
||||||
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
|
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
|
||||||
usart_send_blocking(USART1, c + '0'); /* Send a byte. */
|
usart_send_blocking(USART1, c + '0'); /* Send a byte. */
|
||||||
|
@ -40,7 +40,7 @@ void usart_setup(void)
|
|||||||
/* Enable the USART1 interrupt. */
|
/* Enable the USART1 interrupt. */
|
||||||
nvic_enable_irq(NVIC_USART1_IRQ);
|
nvic_enable_irq(NVIC_USART1_IRQ);
|
||||||
|
|
||||||
/* enable USART1 pin software remapping */
|
/* Enable USART1 pin software remapping. */
|
||||||
AFIO_MAPR |= AFIO_MAPR_USART1_REMAP;
|
AFIO_MAPR |= AFIO_MAPR_USART1_REMAP;
|
||||||
|
|
||||||
/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port B for transmit. */
|
/* Setup GPIO pin GPIO_USART1_RE_TX on GPIO port B for transmit. */
|
||||||
@ -70,7 +70,7 @@ void gpio_setup(void)
|
|||||||
{
|
{
|
||||||
gpio_set(GPIOA, GPIO6 | GPIO7);
|
gpio_set(GPIOA, GPIO6 | GPIO7);
|
||||||
|
|
||||||
/* Setup GPIO6 and 7 (in GPIO port A) for led use. */
|
/* Setup GPIO6 and 7 (in GPIO port A) for LED use. */
|
||||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7);
|
GPIO_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user