[Stylecheck] F0, F1, F4

There are remaining C99 comments.
This commit is contained in:
Frantisek Burian
2014-01-23 19:06:13 +01:00
parent 022cc475bf
commit 3f47411e24
22 changed files with 203 additions and 159 deletions

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com>
* Modified by Fernando Cortes <fermando.corcam@gmail.com>
* modified by Guillermo Rivera <memogrg@gmail.com>
* modified by Frantisek Burian <BuFran@seznam.cz>
* modified by Frantisek Burian <BuFran@seznam.cz>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -52,8 +52,9 @@ static void adc_setup(void)
/* Wait for ADC starting up. */
int i;
for (i = 0; i < 800000; i++) /* Wait a bit. */
for (i = 0; i < 800000; i++) { /* Wait a bit. */
__asm__("nop");
}
}
@@ -120,10 +121,11 @@ int main(void)
temp = adc_read_regular(ADC1);
my_usart_print_int(USART1, temp);
int i;
for (i = 0; i < 800000; i++) /* Wait a bit. */
for (i = 0; i < 800000; i++) { /* Wait a bit. */
__asm__("nop");
}
}
return 0;

View File

@@ -62,13 +62,15 @@ int main(void)
gpio_toggle(GPIOC, GPIO8);
/* Upon button press, blink more slowly. */
if (gpio_get(GPIOA,GPIO0)) {
for (i = 0; i < 300000; i++) /* Wait a bit. */
if (gpio_get(GPIOA, GPIO0)) {
for (i = 0; i < 300000; i++) { /* Wait a bit. */
__asm__("nop");
}
}
for (i = 0; i < 300000; i++) /* Wait a bit. */
for (i = 0; i < 300000; i++) { /* Wait a bit. */
__asm__("nop");
}
}
return 0;

View File

@@ -31,8 +31,8 @@ static void gpio_setup(void)
/* Manually: */
//RCC_AHBENR |= RCC_AHBENR_GPIOCEN;
/* Using API functions: */
rcc_periph_clock_enable(RCC_GPIOC);
rcc_periph_clock_enable(RCC_GPIOC);
/* Set GPIO6 (in GPIO port B) to 'output push-pull'. */
/* Using API functions: */
@@ -50,23 +50,24 @@ int main(void)
/* Manually: */
// GPIOC_BSRR = PIN_LED; /* LED off */
// for (i = 0; i < 1000000; i++) /* Wait a bit. */
// __asm__("nop");
// __asm__("nop");
// GPIOC_BRR = PIN_LED; /* LED on */
// for (i = 0; i < 1000000; i++) /* Wait a bit. */
// __asm__("nop");
// __asm__("nop");
/* Using API functions gpio_set()/gpio_clear(): */
// gpio_set(PORT_LED, PIN_LED); /* LED off */
// for (i = 0; i < 1000000; i++) /* Wait a bit. */
// __asm__("nop");
// __asm__("nop");
// gpio_clear(PORT_LED, PIN_LED); /* LED on */
// for (i = 0; i < 1000000; i++) /* Wait a bit. */
// __asm__("nop");
// __asm__("nop");
/* Using API function gpio_toggle(): */
gpio_toggle(PORT_LED, PIN_LED); /* LED on/off */
for (i = 0; i < 1000000; i++) /* Wait a bit. */
for (i = 0; i < 1000000; i++) { /* Wait a bit. */
__asm__("nop");
}
}
return 0;

View File

@@ -35,8 +35,8 @@ static void systick_setup(int freq)
{
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB);
/* clear counter so it starts right away */
STK_CVR=0;
STK_CVR = 0;
systick_set_reload(rcc_core_frequency / freq);
systick_counter_enable();
systick_interrupt_enable();
@@ -79,5 +79,5 @@ int main(void)
systick_setup(8);
/* Do nothing in main loop */
while(1);
while (1);
}

View File

@@ -75,8 +75,9 @@ int main(void)
usart_send_blocking(USART1, '\r');
usart_send_blocking(USART1, '\n');
}
for (i = 0; i < 100000; i++) /* Wait a bit. */
for (i = 0; i < 100000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;

View File

@@ -26,10 +26,10 @@
#include <stddef.h>
#include <sys/types.h>
static ssize_t _iord(void *_cookie, char *_buf,size_t _n);
static ssize_t _iowr(void *_cookie,const char *_buf, size_t _n);
static ssize_t _iord(void *_cookie, char *_buf, size_t _n);
static ssize_t _iowr(void *_cookie, const char *_buf, size_t _n);
static ssize_t _iord(void *_cookie, char *_buf,size_t _n)
static ssize_t _iord(void *_cookie, char *_buf, size_t _n)
{
/* dont support reading now */
(void)_cookie;
@@ -38,7 +38,7 @@ static ssize_t _iord(void *_cookie, char *_buf,size_t _n)
return 0;
}
static ssize_t _iowr(void *_cookie,const char *_buf, size_t _n)
static ssize_t _iowr(void *_cookie, const char *_buf, size_t _n)
{
uint32_t dev = (uint32_t)_cookie;
@@ -51,7 +51,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. */
usart_set_baudrate(dev, 38400);
@@ -63,9 +63,9 @@ static FILE* usart_setup(uint32_t dev)
/* Finally enable the USART. */
usart_enable(dev);
cookie_io_functions_t stub = { _iord, _iowr, NULL, NULL };
FILE *fp = fopencookie((void *)dev,"rw+",stub);
FILE *fp = fopencookie((void *)dev, "rw+", stub);
/* Do not buffer the serial line */
setvbuf(fp, NULL, _IONBF, 0);
return fp;
@@ -106,13 +106,14 @@ int main(void)
/* Blink the LED (PD12) on the board with every transmitted byte. */
while (1) {
gpio_toggle(GPIOC, GPIO8); /* LED on/off */
fprintf(fp,"Pass: %d\n",c);
fprintf(fp, "Pass: %d\n", c);
c = (c == 200) ? 0 : c + 1; /* Increment c. */
for (i = 0; i < 1000000; i++) /* Wait a bit. */
for (i = 0; i < 1000000; i++) { /* Wait a bit. */
__asm__("NOP");
}
}
return 0;