153rd
Member level 1
- Joined
- Mar 4, 2011
- Messages
- 34
- Helped
- 5
- Reputation
- 10
- Reaction score
- 5
- Trophy points
- 1,288
- Activity points
- 1,545
Hey guys,
I'm working on some C code for an STM32F4Discovery board.
When compiling, I get the following error:
static declaration of 'insert_function_here' follows non-static declaration (init() in my case)
I've found some topics on stackexange here, but those solutions don't completely apply to my problem.
The suggestions I've seen until now is that it has something to do with the curly brackets, however I don't see how that applies to the code above.
my main.h file is as follows:
Furthermore, my compiler ends with:
error: expected declaration or statement at end of input
Which also seems to suggest something is off with braces or parentheses..
When I empty my main completely, like this:
I keep having the same error, starting at the init function.
Removing void doesn't work(which makes sense, compiler things I'm declaring 'init' for a 2nd time right?)
Does anyone have a suggestion/tip/solution to this error I could take a look at?
It would be much appreciated
Thanks!
I'm working on some C code for an STM32F4Discovery board.
Code:
#include "main.h"
int main(void)
{
//Enable HSE clock
RCC_HSEConfig(RCC_HSE_ON);
//Wait for clock to stabilize
while (!RCC_WaitForHSEStartUp());
init();
while(1)
{
//GPIO_SetBits(GPIOD, LED[counter % 4]);
while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET); // Wait for Empty
USART_SendData(UART4, 'h');
GPIO_SetBits(GPIOD, LED[2]);
//VC0706_sendCommand(0xAA, 0x18, 0x81);
//while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET);
//USART_SendData(USART2, 'Y');
GPIOE->BSRRH |= GPIO_Pin_2; // set PE2 (CS) low
SPI_I2S_SendData(SPI1, 0xAA); // transmit data
//received_val = SPI1_send(0x00); // transmit dummy byte and receive data
GPIOE->BSRRL |= GPIO_Pin_2; // set PE2 (CS) high
GPIO_ResetBits(GPIOD, LEDS);
}
}
void init()// <<error starts here
{
static declaration of 'insert_function_here' follows non-static declaration (init() in my case)
I've found some topics on stackexange here, but those solutions don't completely apply to my problem.
The suggestions I've seen until now is that it has something to do with the curly brackets, however I don't see how that applies to the code above.
my main.h file is as follows:
Code:
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_tim.h"
#include "VC0706.h"
const uint16_t LEDS = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
const uint16_t LED[4] = {GPIO_Pin_12, GPIO_Pin_13, GPIO_Pin_14, GPIO_Pin_15};
void init(void);
void USART3_IRQHandler();
void UART4_IRQHandler();
Furthermore, my compiler ends with:
error: expected declaration or statement at end of input
Which also seems to suggest something is off with braces or parentheses..
When I empty my main completely, like this:
Code:
#include "main.h"
int main(void)
{
}
void init()
{
}
I keep having the same error, starting at the init function.
Removing void doesn't work(which makes sense, compiler things I'm declaring 'init' for a 2nd time right?)
Does anyone have a suggestion/tip/solution to this error I could take a look at?
It would be much appreciated
Thanks!