2023-07-12 05:51 AM - edited 2023-07-12 06:29 AM
It seems the IDE is not able to use the ADC and any functions related to it - my error is that the ADC libraries are not importing properly We are using the HAL libraries.. Additionally, the GPIO and any functions related to it are not being supported. I'm not sure why the files aren't being found by the program. I am using version 1.12.
// define the timer and GPIO pins used
TIM_HandleTypeDef htim; (error here is unknown type name 'TIM_HandleTypeDef'; did you mean 'TIM_TypeDef'?
GPIO_InitTypeDef GPIO_InitStruct; (error here is same as line before)
ADC_HandleTypeDef hadc; (error here is unknown type name 'ADC_HandleTypeDef')
#define PWM_PIN GPIO_PIN_0 (error here is same as line before)
#define PWM_PORT GPIOA (error here is 'GPIO_Pin_0' undeclared (first use in this function)
#define ADC_PIN GPIO_PIN_1 (error here is 'GPIO_Pin_1' undeclared (first use in this function)
#define ADC_PORT GPIOA
2023-07-12 06:51 AM
Hello @acai, thank you for posting,
It seems that you're missing necessary header files that are not being included in your code
Make sure you have included the following header files :
#include "stm32xx_hal.h"
#include "stm32xx_hal_gpio.h"
#include "stm32xx_hal_adc.h"
#include "stm32xx_hal_tim.h"
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-07-12 07:27 AM
Did I do this correctly? If so, how do I resolve the errors?
2023-07-12 08:00 AM
Hello again @acai,
Actually you need to replace the xx in "stm32xx..." by your board, i can see that you are using an stm32f7, in this case :
#include "stm32f7xx_hal.h"
#include "stm32f7xx_hal_gpio.h"
#include "stm32f7xx_hal_adc.h"
#include "stm32f7xx_hal_tim.h"
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-07-12 08:14 AM - edited 2023-07-12 08:15 AM
Before trying to develop a software, you should learn using a file search on your computer, so that you are capable of finding the files by name or determine that such files do not exist. And then there is another secret knowledge - you can read/copy the first error and search it on the Google or other web search engine. But don't tell it anyone, this is a super secret knowledge!
2023-07-12 08:40 AM
These should pull properly if stm32f7xx_hal_conf.h is properly selecting the sub-components with the appropriate #defines
2023-07-12 11:09 AM - edited 2023-07-12 11:22 AM
Hi, you've been very helpful so far but I'm still getting errors. I believe I have the necessary #include statements, the files do exist, and the file path pointing to them is correct, but I'm still receiving the error. Is there anything else I should try?
2023-07-12 01:11 PM
As @Tesla DeLorean wrote, there should be file named stm32f7xx_hal_conf.h and it must properly select the sub-components. Where have you found this project source? Have you generated a new project with CubeMX/IDE or imported an example? Otherwise, get back to the person who provided this code and request a fix.