obldc examples: Fix comments and coding-style.

This commit is contained in:
Uwe Hermann 2011-11-12 17:49:22 +01:00
parent f3f1123d07
commit 4cf395d3c9
6 changed files with 32 additions and 32 deletions

View File

@ -55,10 +55,10 @@ void gpio_setup(void)
/* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
gpio_set(GPIOA, GPIO6); /* LED0 off */
gpio_set(GPIOA, GPIO7); /* LED1 off */
gpio_set(GPIOB, GPIO0); /* LED2 off */
gpio_set(GPIOB, GPIO1); /* LED3 off */
gpio_set(GPIOA, GPIO6); /* LED0 off */
gpio_set(GPIOA, GPIO7); /* LED1 off */
gpio_set(GPIOB, GPIO0); /* LED2 off */
gpio_set(GPIOB, GPIO1); /* LED3 off */
/* Set GPIO6/7 (in GPIO port A) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
@ -66,7 +66,7 @@ void gpio_setup(void)
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
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_CNF_OUTPUT_PUSHPULL, GPIO0);
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,

View File

@ -21,9 +21,9 @@
#include <libopencm3/stm32/f1/rcc.h>
#include <libopencm3/stm32/f1/gpio.h>
/* Set STM32 to 72 MHz. */
void clock_setup(void)
{
/* Set STM32 to 72 MHz. */
rcc_clock_setup_in_hse_8mhz_out_72mhz();
/* Enable GPIOA clock. */

View File

@ -156,7 +156,7 @@ static const u16 gamma_table_2_2[] = {
49275, 49761, 50249, 50739, 51232, 51728, 52226, 52727,
53230, 53736, 54245, 54756, 55270, 55787, 56306, 56828,
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
@ -245,9 +245,9 @@ void clock_setup(void)
/* Enable GPIOC, Alternate Function clocks. */
rcc_peripheral_enable_clock(&RCC_APB2ENR,
RCC_APB2ENR_IOPAEN |
RCC_APB2ENR_IOPBEN |
RCC_APB2ENR_AFIOEN);
RCC_APB2ENR_IOPAEN |
RCC_APB2ENR_IOPBEN |
RCC_APB2ENR_AFIOEN);
}
void gpio_setup(void)
@ -460,18 +460,18 @@ int main(void)
if (j == 100) {
j = 0;
switch (k += kd) {
case 0:
j0 = 255;
break;
case 1:
j1 = 255;
break;
case 2:
j2 = 255;
break;
case 3:
j3 = 255;
break;
case 0:
j0 = 255;
break;
case 1:
j1 = 255;
break;
case 2:
j2 = 255;
break;
case 3:
j3 = 255;
break;
}
if (k == 3)
kd =- 1;

View File

@ -34,10 +34,10 @@ void gpio_setup(void)
/* Enable GPIOB clock. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
gpio_set(GPIOA, GPIO6); /* LED0 off */
gpio_set(GPIOA, GPIO7); /* LED1 off */
gpio_set(GPIOB, GPIO0); /* LED2 off */
gpio_set(GPIOB, GPIO1); /* LED3 off */
gpio_set(GPIOA, GPIO6); /* LED0 off */
gpio_set(GPIOA, GPIO7); /* LED1 off */
gpio_set(GPIOB, GPIO0); /* LED2 off */
gpio_set(GPIOB, GPIO1); /* LED3 off */
/* Set GPIO6/7 (in GPIO port A) to 'output push-pull' for the LEDs. */
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
@ -45,7 +45,7 @@ void gpio_setup(void)
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
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_CNF_OUTPUT_PUSHPULL, GPIO0);
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
@ -74,7 +74,7 @@ int main(void)
temp32 = 0;
/* 72MHz / 8 => 9000000 counts per second */
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
/* 9000000/9000 = 1000 overflows per second - every 1ms one interrupt */
systick_set_reload(9000);

View File

@ -60,7 +60,7 @@ void usart_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_CNF_OUTPUT_PUSHPULL, GPIO6);
}
@ -73,7 +73,7 @@ int main(void)
gpio_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) {
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
usart_send_blocking(USART1, c + '0'); /* Send a byte. */

View File

@ -40,7 +40,7 @@ void usart_setup(void)
/* Enable the USART1 interrupt. */
nvic_enable_irq(NVIC_USART1_IRQ);
/* enable USART1 pin software remapping */
/* Enable USART1 pin software remapping. */
AFIO_MAPR |= AFIO_MAPR_USART1_REMAP;
/* 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);
/* 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_CNF_OUTPUT_PUSHPULL, GPIO6 | GPIO7);
}