lisa-m/fancyblink: Fix copy-pasted code comments.

This commit is contained in:
Uwe Hermann 2011-11-12 10:10:32 +01:00
parent 99f4ca3b22
commit f23d9d07b7

View File

@ -26,26 +26,27 @@ void clock_setup(void)
{ {
rcc_clock_setup_in_hse_12mhz_out_72mhz(); rcc_clock_setup_in_hse_12mhz_out_72mhz();
/* Enable GPIOC clock. */ /* Enable GPIOB, GPIOC, and AFIO clocks. */
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPBEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN);
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
} }
void gpio_setup(void) void gpio_setup(void)
{ {
/* Set GPIO12 (in GPIO port C) to 'output push-pull'. */ /* Set GPIO13 (in GPIO port C) to 'output push-pull'. */
gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO13); GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
/* Set GPIO4 (in GPIO port B) to 'output push-pull'. */
gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ, gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_50_MHZ,
GPIO_CNF_OUTPUT_PUSHPULL, GPIO4); GPIO_CNF_OUTPUT_PUSHPULL, GPIO4);
AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST; AFIO_MAPR |= AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST;
/* preconfigure the led's */ /* Preconfigure the LEDs. */
gpio_set(GPIOB, GPIO4); /* switch off led */ gpio_set(GPIOB, GPIO4); /* Switch off LED. */
gpio_clear(GPIOC, GPIO13); /* switch on led */ gpio_clear(GPIOC, GPIO13); /* Switch on LED. */
} }
int main(void) int main(void)
@ -55,7 +56,7 @@ int main(void)
clock_setup(); clock_setup();
gpio_setup(); gpio_setup();
/* Blink the LED (PC12) on the board. */ /* Blink the LEDs (PC13 and PB4) on the board. */
while (1) { while (1) {
gpio_toggle(GPIOC, GPIO13); /* LED on/off */ gpio_toggle(GPIOC, GPIO13); /* LED on/off */
gpio_toggle(GPIOB, GPIO4); /* LED on/off */ gpio_toggle(GPIOB, GPIO4); /* LED on/off */