We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have several pins relabeled using the #define directive in a header file called "gpio.h". Several files reference this file. In main.c I reference this file with the fallowing command:
#include "gpio.h"
The gpio.h file has the following structure:
#ifndef __gpio_H#define __gpio_H#define FW_PROBE_DIG_1_Pin GPIO_PIN_12#define FW_PROBE_DIG_1_GPIO_Port GPIOE#define FW_PROBE_DIG_2_Pin GPIO_PIN_13#define FW_PROBE_DIG_2_GPIO_Port GPIOE#endif /* __gpio_H */
My code in "main.c" works when using the value "GPIOE" but doesn't work when using "FW_PROBE_DIG_1_GPIO_Port". The code compiles but the "GPIO" hardware pin only responds when I use the "GPIOE" in my function call.
Any ideas?
Dan Hobson said:The code compiles
Do you seriously believe your question makes any kind of sense if nobody but you know what "the code" even is?
I found the problem. Copied the wrong "#define" definition. Wish there was a way to debug this.
Most compilers allow to keep intermediate files. In your case the preprocessed one.
You can check whether the value written into the register is correct in the debug mode to quickly determine the problem