Fixed all warnings for examples.
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
#include <libopencm3/stm32/f1/adc.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -47,7 +47,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -60,7 +60,7 @@ void gpio_setup(void)
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO15);
|
||||
}
|
||||
|
||||
void adc_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -94,7 +94,7 @@ void adc_setup(void)
|
||||
while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); //added this check
|
||||
}
|
||||
|
||||
void my_usart_print_int(u32 usart, int value)
|
||||
static void my_usart_print_int(u32 usart, int value)
|
||||
{
|
||||
s8 i;
|
||||
u8 nr_digits = 0;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
#include <libopencm3/stm32/timer.h>
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -48,7 +48,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -61,7 +61,7 @@ void gpio_setup(void)
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO15);
|
||||
}
|
||||
|
||||
void timer_setup(void)
|
||||
static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
@@ -86,7 +86,7 @@ void timer_setup(void)
|
||||
timer_enable_counter(timer);
|
||||
}
|
||||
|
||||
void adc_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -120,7 +120,7 @@ void adc_setup(void)
|
||||
while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0);
|
||||
}
|
||||
|
||||
void my_usart_print_int(u32 usart, int value)
|
||||
static void my_usart_print_int(u32 usart, int value)
|
||||
{
|
||||
s8 i;
|
||||
u8 nr_digits = 0;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
volatile u16 temperature = 0;
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -51,7 +51,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -64,7 +64,7 @@ void gpio_setup(void)
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO15);
|
||||
}
|
||||
|
||||
void timer_setup(void)
|
||||
static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
@@ -89,14 +89,14 @@ void timer_setup(void)
|
||||
timer_enable_counter(timer);
|
||||
}
|
||||
|
||||
void irq_setup(void)
|
||||
static void irq_setup(void)
|
||||
{
|
||||
/* Enable the adc1_2_isr() routine */
|
||||
nvic_set_priority(NVIC_ADC1_2_IRQ, 0);
|
||||
nvic_enable_irq(NVIC_ADC1_2_IRQ);
|
||||
}
|
||||
|
||||
void adc_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -132,7 +132,7 @@ void adc_setup(void)
|
||||
while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0);
|
||||
}
|
||||
|
||||
void my_usart_print_int(u32 usart, int value)
|
||||
static void my_usart_print_int(u32 usart, int value)
|
||||
{
|
||||
s8 i;
|
||||
u8 nr_digits = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ volatile u16 lisam_adc1 = 0;
|
||||
volatile u16 lisam_adc2 = 0;
|
||||
u8 channel_array[4]; /* for injected sampling, 4 channels max, for regular, 16 max */
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -55,7 +55,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -72,7 +72,7 @@ void gpio_setup(void)
|
||||
GPIO3 | GPIO0 );
|
||||
}
|
||||
|
||||
void timer_setup(void)
|
||||
static void timer_setup(void)
|
||||
{
|
||||
/* Set up the timer TIM2 for injected sampling */
|
||||
uint32_t timer;
|
||||
@@ -97,14 +97,14 @@ void timer_setup(void)
|
||||
timer_enable_counter(timer);
|
||||
}
|
||||
|
||||
void irq_setup(void)
|
||||
static void irq_setup(void)
|
||||
{
|
||||
/* Enable the adc1_2_isr() routine */
|
||||
nvic_set_priority(NVIC_ADC1_2_IRQ, 0);
|
||||
nvic_enable_irq(NVIC_ADC1_2_IRQ);
|
||||
}
|
||||
|
||||
void adc_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -149,7 +149,7 @@ void adc_setup(void)
|
||||
while ((ADC_CR2(ADC1) & ADC_CR2_CAL) != 0); //added this check
|
||||
}
|
||||
|
||||
void my_usart_print_int(u32 usart, int value)
|
||||
static void my_usart_print_int(u32 usart, int value)
|
||||
{
|
||||
s8 i;
|
||||
u8 nr_digits = 0;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <libopencm3/stm32/f1/adc.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART1_TX) and USART1. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -47,7 +47,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable GPIO clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
@@ -60,7 +60,7 @@ void gpio_setup(void)
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, GPIO15);
|
||||
}
|
||||
|
||||
void adc_setup(void)
|
||||
static void adc_setup(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -88,7 +88,7 @@ void adc_setup(void)
|
||||
adc_calibration(ADC1);
|
||||
}
|
||||
|
||||
void my_usart_print_int(u32 usart, int value)
|
||||
static void my_usart_print_int(u32 usart, int value)
|
||||
{
|
||||
s8 i;
|
||||
u8 nr_digits = 0;
|
||||
|
||||
@@ -47,7 +47,7 @@ struct can_rx_msg {
|
||||
struct can_tx_msg can_tx_msg;
|
||||
struct can_rx_msg can_rx_msg;
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Enable Alternate Function clock. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
@@ -85,7 +85,7 @@ void gpio_setup(void)
|
||||
|
||||
}
|
||||
|
||||
void systick_setup(void)
|
||||
static void systick_setup(void)
|
||||
{
|
||||
/* 72MHz / 8 => 9000000 counts per second */
|
||||
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
|
||||
@@ -100,7 +100,7 @@ void systick_setup(void)
|
||||
systick_counter_enable();
|
||||
}
|
||||
|
||||
void can_setup(void)
|
||||
static void can_setup(void)
|
||||
{
|
||||
/* Enable peripheral clocks. */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <libopencm3/stm32/f1/gpio.h>
|
||||
|
||||
/* Set STM32 to 72 MHz. */
|
||||
void clock_setup(void)
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -33,7 +33,7 @@ void clock_setup(void)
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* LED1 */
|
||||
/* Set GPIO8 (in GPIO port A) to 'output push-pull'. */
|
||||
@@ -70,7 +70,7 @@ void gpio_setup(void)
|
||||
gpio_set(GPIOC, GPIO2);
|
||||
}
|
||||
|
||||
void led_set(int id, int on)
|
||||
static void led_set(int id, int on)
|
||||
{
|
||||
if (on) {
|
||||
switch (id) {
|
||||
@@ -111,7 +111,7 @@ void led_set(int id, int on)
|
||||
}
|
||||
}
|
||||
|
||||
void led_advance(void)
|
||||
static void led_advance(void)
|
||||
{
|
||||
static int state = 0;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <libopencm3/stm32/f1/gpio.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
|
||||
void clock_setup(void)
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -35,7 +35,7 @@ void clock_setup(void)
|
||||
RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Setup GPIO pin GPIO_USART2_TX. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -54,7 +54,7 @@ void usart_setup(void)
|
||||
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Set GPIO8 (in GPIO port A) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <libopencm3/stm32/f1/dma.h>
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
|
||||
void clock_setup(void)
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -40,7 +40,7 @@ void clock_setup(void)
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_DMA1EN);
|
||||
}
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Setup GPIO pin GPIO_USART2_TX and GPIO_USART2_RX. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -67,7 +67,7 @@ void usart_setup(void)
|
||||
|
||||
}
|
||||
|
||||
void dma_write(char *data, int size)
|
||||
static void dma_write(char *data, int size)
|
||||
{
|
||||
/*
|
||||
* Using channel 7 for USART2_TX
|
||||
@@ -109,7 +109,7 @@ void dma1_channel7_isr(void)
|
||||
dma_disable_channel(DMA1, DMA_CHANNEL7);
|
||||
}
|
||||
|
||||
void dma_read(char *data, int size)
|
||||
static void dma_read(char *data, int size)
|
||||
{
|
||||
/*
|
||||
* Using channel 6 for USART2_RX
|
||||
@@ -151,7 +151,7 @@ void dma1_channel6_isr(void)
|
||||
dma_disable_channel(DMA1, DMA_CHANNEL6);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
/* Set GPIO8 (in GPIO port A) to 'output push-pull'. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
|
||||
void clock_setup(void)
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -36,7 +36,7 @@ void clock_setup(void)
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Enable the USART2 interrupt. */
|
||||
nvic_enable_irq(NVIC_USART2_IRQ);
|
||||
@@ -64,7 +64,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
gpio_set(GPIOA, GPIO8);
|
||||
|
||||
|
||||
@@ -45,7 +45,9 @@ struct ring {
|
||||
#define RING_DATA(RING) (RING)->data
|
||||
#define RING_EMPTY(RING) ((RING)->begin == (RING)->end)
|
||||
|
||||
void ring_init(struct ring *ring, u8 *buf, ring_size_t size)
|
||||
int _write(int file, char *ptr, int len);
|
||||
|
||||
static void ring_init(struct ring *ring, u8 *buf, ring_size_t size)
|
||||
{
|
||||
ring->data = buf;
|
||||
ring->size = size;
|
||||
@@ -53,7 +55,7 @@ void ring_init(struct ring *ring, u8 *buf, ring_size_t size)
|
||||
ring->end = 0;
|
||||
}
|
||||
|
||||
s32 ring_write_ch(struct ring *ring, u8 ch)
|
||||
static s32 ring_write_ch(struct ring *ring, u8 ch)
|
||||
{
|
||||
if (((ring->end + 1) % ring->size) != ring->begin) {
|
||||
ring->data[ring->end++] = ch;
|
||||
@@ -64,7 +66,7 @@ s32 ring_write_ch(struct ring *ring, u8 ch)
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 ring_write(struct ring *ring, u8 *data, ring_size_t size)
|
||||
static s32 ring_write(struct ring *ring, u8 *data, ring_size_t size)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@@ -76,7 +78,7 @@ s32 ring_write(struct ring *ring, u8 *data, ring_size_t size)
|
||||
return i;
|
||||
}
|
||||
|
||||
s32 ring_read_ch(struct ring *ring, u8 *ch)
|
||||
static s32 ring_read_ch(struct ring *ring, u8 *ch)
|
||||
{
|
||||
s32 ret = -1;
|
||||
|
||||
@@ -90,7 +92,8 @@ s32 ring_read_ch(struct ring *ring, u8 *ch)
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 ring_read(struct ring *ring, u8 *data, ring_size_t size)
|
||||
/* Not used!
|
||||
static s32 ring_read(struct ring *ring, u8 *data, ring_size_t size)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@@ -101,6 +104,7 @@ s32 ring_read(struct ring *ring, u8 *data, ring_size_t size)
|
||||
|
||||
return -i;
|
||||
}
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* The example implementation
|
||||
@@ -111,7 +115,7 @@ s32 ring_read(struct ring *ring, u8 *data, ring_size_t size)
|
||||
struct ring output_ring;
|
||||
u8 output_ring_buffer[BUFFER_SIZE];
|
||||
|
||||
void clock_setup(void)
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -124,7 +128,7 @@ void clock_setup(void)
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Initialize output ring buffer. */
|
||||
ring_init(&output_ring, output_ring_buffer, BUFFER_SIZE);
|
||||
@@ -155,7 +159,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
gpio_set(GPIOA, GPIO8);
|
||||
|
||||
@@ -217,7 +221,7 @@ int _write(int file, char *ptr, int len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void systick_setup(void)
|
||||
static void systick_setup(void)
|
||||
{
|
||||
/* 72MHz / 8 => 9000000 counts per second. */
|
||||
systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8);
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
void clock_setup(void)
|
||||
int _write(int file, char *ptr, int len);
|
||||
|
||||
static void clock_setup(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_12mhz_out_72mhz();
|
||||
|
||||
@@ -38,7 +40,7 @@ void clock_setup(void)
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART2EN);
|
||||
}
|
||||
|
||||
void usart_setup(void)
|
||||
static void usart_setup(void)
|
||||
{
|
||||
/* Setup GPIO pin GPIO_USART2_RE_TX on GPIO port B for transmit. */
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
@@ -56,7 +58,7 @@ void usart_setup(void)
|
||||
usart_enable(USART2);
|
||||
}
|
||||
|
||||
void gpio_setup(void)
|
||||
static void gpio_setup(void)
|
||||
{
|
||||
gpio_set(GPIOA, GPIO8);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user