Fixed all warnings for examples.

This commit is contained in:
Piotr Esden-Tempski
2013-02-26 19:33:42 -08:00
parent 9c552e7585
commit 3d3ddc7014
88 changed files with 365 additions and 306 deletions

View File

@@ -36,12 +36,14 @@
static volatile struct state_t state;
int _write(int file, char *ptr, int len);
__attribute__((always_inline)) static inline void __WFI(void)
{
__asm volatile ("wfi");
}
void gpio_setup(void)
static void gpio_setup(void)
{
/* green led for ticking, blue for button feedback */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_DISCO_GREEN_PIN);
@@ -69,7 +71,7 @@ void BUTTON_DISCO_USER_isr(void)
}
}
void setup_buttons(void)
static void setup_buttons(void)
{
/* Enable EXTI0 interrupt. */
nvic_enable_irq(BUTTON_DISCO_USER_NVIC);
@@ -83,7 +85,7 @@ void setup_buttons(void)
exti_enable_request(BUTTON_DISCO_USER_EXTI);
}
void usart_setup(void)
static void usart_setup(void)
{
usart_set_baudrate(USART_CONSOLE, 115200);
usart_set_databits(USART_CONSOLE, 8);
@@ -123,7 +125,7 @@ int _write(int file, char *ptr, int len)
/*
* Free running ms timer.
*/
void setup_button_press_timer(void)
static void setup_button_press_timer(void)
{
timer_reset(TIMER_BUTTON_PRESS);
timer_set_prescaler(TIMER_BUTTON_PRESS, 3999); // 4Mhz/1000hz - 1
@@ -131,7 +133,7 @@ void setup_button_press_timer(void)
timer_enable_counter(TIMER_BUTTON_PRESS);
}
int setup_rtc(void)
static int setup_rtc(void)
{
/* turn on power block to enable unlocking */
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_PWREN);
@@ -180,7 +182,7 @@ int setup_rtc(void)
return 0;
}
int setup_rtc_wakeup(int period)
static int setup_rtc_wakeup(int period)
{
rtc_unlock();
@@ -227,12 +229,12 @@ void rtc_wkup_isr(void)
state.rtc_ticked = true;
}
int process_state(volatile struct state_t *st)
static int process_state(volatile struct state_t *st)
{
if (st->rtc_ticked) {
st->rtc_ticked = 0;
printf("Tick: %x\n", (unsigned int) RTC_TR);
#if FULL_USER_EXPERIENCE
#if defined(FULL_USER_EXPERIENCE)
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
#else
gpio_clear(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
@@ -251,7 +253,7 @@ int process_state(volatile struct state_t *st)
return 0;
}
void reset_clocks(void)
static void reset_clocks(void)
{
/* 4MHz MSI raw range 2*/
clock_scale_t myclock_config = {

View File

@@ -31,7 +31,9 @@
static struct state_t state;
void clock_setup(void)
int _write(int file, char *ptr, int len);
static void clock_setup(void)
{
rcc_clock_setup_pll(&clock_config[CLOCK_VRANGE1_HSI_PLL_24MHZ]);
/* Lots of things on all ports... */
@@ -47,7 +49,7 @@ void clock_setup(void)
}
void gpio_setup(void)
static void gpio_setup(void)
{
/* green led for ticking, blue for button feedback */
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, LED_DISCO_GREEN_PIN);
@@ -60,7 +62,7 @@ void gpio_setup(void)
gpio_set_af(GPIOA, GPIO_AF7, GPIO2);
}
void usart_setup(void)
static void usart_setup(void)
{
usart_set_baudrate(USART_CONSOLE, 115200);
usart_set_databits(USART_CONSOLE, 8);
@@ -131,7 +133,7 @@ void tim6_isr(void)
* Another ms timer, this one used to generate an overflow interrupt at 1ms
* It is used to toggle leds and write tick counts
*/
void setup_tim6(void)
static void setup_tim6(void)
{
timer_reset(TIM6);
// 24Mhz / 10khz -1.
@@ -148,7 +150,7 @@ void setup_tim6(void)
/*
* Free running ms timer.
*/
void setup_tim7(void)
static void setup_tim7(void)
{
timer_reset(TIM7);
timer_set_prescaler(TIM7, 23999); // 24Mhz/1000hz - 1
@@ -156,7 +158,7 @@ void setup_tim7(void)
timer_enable_counter(TIM7);
}
void setup_buttons(void)
static void setup_buttons(void)
{
/* Enable EXTI0 interrupt. */
nvic_enable_irq(BUTTON_DISCO_USER_NVIC);

View File

@@ -25,7 +25,7 @@
#define PORT_LED GPIOB
#define PIN_LED GPIO6
void gpio_setup(void)
static void gpio_setup(void)
{
/* Enable GPIOB clock. */
/* Manually: */

View File

@@ -22,7 +22,7 @@
#include <libopencm3/stm32/l1/gpio.h>
#include <libopencm3/stm32/usart.h>
void clock_setup(void)
static void clock_setup(void)
{
/* We are running on MSI after boot. */
/* Enable GPIOD clock for LED & USARTs. */
@@ -33,7 +33,7 @@ void clock_setup(void)
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
}
void usart_setup(void)
static void usart_setup(void)
{
/* Setup USART2 parameters. */
usart_set_baudrate(USART2, 38400);
@@ -47,7 +47,7 @@ void usart_setup(void)
usart_enable(USART2);
}
void gpio_setup(void)
static void gpio_setup(void)
{
/* Setup GPIO pin GPIO7 on GPIO port B for Green LED. */
gpio_mode_setup(GPIOB, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO7);