Re-define value in code

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TyFo_1975986
Level 1
Level 1

Is there a way for you to redefine a value in code? 

   

For instance, if I have "#define CapSense_AUTOCALIBRATION_ENABLE (1u)" set by my CapSense module, is there a way in my code to re-define this to (0u) depending on a specific input? If so, how could I possibly go about doing this?

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The #define is a macro command that goes to the C-compiler and as such is fixed at compile-time. You may re-define the value, but again: only at compile-time.

   

 

   

Bob

0 Likes
TyFo_1975986
Level 1
Level 1

Is there a proper way to re-define a value?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

As I said: No.

   

 

   

Bob

0 Likes
TyFo_1975986
Level 1
Level 1

I mean at compile-time.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Re-#define the macro and ignore the warning.

   

 

   

Bob

0 Likes