2024-08-06 12:31 AM
Solved! Go to Solution.
2024-08-09 01:18 AM
@LouisB wrote:
#ifdef SIMULATOR
// Your simulator specific user code here
#include "gui/common/myInclude.hpp"
#else
// Your hardware specific user code here
extern "C"
{
#include "stm32f7xx_hal.h"
}
#endif
extern C is not needed as stm32f7xx_hal.h already has this inside the header file. As far as I know all ST header files are like this.
This would work:
#ifndef SIMULATOR
#include "stm32f7xx_hal.h"
#endif
// LED Toggle function
void Screen1View::ToggleLED()
{
if (toggleButton1.getState())
{
#ifndef SIMULATOR
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET);
#else
//simulate an LED on the screen, for example
#endif
}
else
{
#ifndef SIMULATOR
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);
#else
//simulate an LED on the screen, for example
#endif
}
}
2024-08-06 03:28 AM
Ups, the error is:gui/src/model/Model.cpp:7:10: fatal error: stm32f7xx_hal.h: No such file or directory #include "stm32f7xx_hal.h". Sorry
2024-08-06 08:14 AM
Hello @amigafan ,
How did you include the file in your project ? The board and the simulator are built differently.
Best regards,
Louis B.
2024-08-06 08:27 AM
?? I wrote #include "stm32f7xx_hal.h" in Screen1View.cpp.
Br
2024-08-06 08:33 AM
I meant in which folder did you put the file ?
2024-08-06 08:39 AM
It is in STM32CubeIDE, I dit no add a file to any folder.
2024-08-09 12:27 AM - edited 2024-08-09 12:27 AM
Hello @amigafan,
The issue is the file itself, it's an hardware specific file that will only work on target.
#ifdef SIMULATOR
// Your simulator specific user code here
#include "gui/common/myInclude.hpp"
#else
// Your hardware specific user code here
extern "C"
{
#include "stm32f7xx_hal.h"
}
#endif
I hope it helps,
Best regards
2024-08-09 01:18 AM
@LouisB wrote:
#ifdef SIMULATOR
// Your simulator specific user code here
#include "gui/common/myInclude.hpp"
#else
// Your hardware specific user code here
extern "C"
{
#include "stm32f7xx_hal.h"
}
#endif
extern C is not needed as stm32f7xx_hal.h already has this inside the header file. As far as I know all ST header files are like this.
This would work:
#ifndef SIMULATOR
#include "stm32f7xx_hal.h"
#endif
// LED Toggle function
void Screen1View::ToggleLED()
{
if (toggleButton1.getState())
{
#ifndef SIMULATOR
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET);
#else
//simulate an LED on the screen, for example
#endif
}
else
{
#ifndef SIMULATOR
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET);
#else
//simulate an LED on the screen, for example
#endif
}
}