Move/name a digital input at complie time

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

cross mob
Anonymous
Not applicable

Is there a way to change a pin's function name at compile time?

   

I'm using PSoC creator 3.3 and a CY8C3866AXI-206.

   

I had a PCB with a digital input on P2[6] but the next release of the PCB requires that pin be moved to P2[2]. Other than the pin move the source code remains the same. For example; let say the input is just a switch. In the source I name the pin as "SW1" and read its value with "SW1_read()" .. which, originally, read from P2[6]. Is there a way to modify that assignment at compile time ??  Some how do something like...

   

#ifdef  HW1_0

   

   SW1 = P2[6]

   

#else

   

   SW1 = P2[2]

   

#endif

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

cgb,

   

try to use this component to rename pins:

   

http://www.cypress.com/forum/psoc-community-components/automagically-assign-pin-locations-using-pin-...

   

and re-define pin names like this (untested)

   

#define SW1 P2_6 //comment or uncomment as necessary

   

//#define SW1 P2_2

   

 

   

IMHO new PCB should come with new revision of the code.

   

odissey1

View solution in original post

0 Likes
1 Reply
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

cgb,

   

try to use this component to rename pins:

   

http://www.cypress.com/forum/psoc-community-components/automagically-assign-pin-locations-using-pin-...

   

and re-define pin names like this (untested)

   

#define SW1 P2_6 //comment or uncomment as necessary

   

//#define SW1 P2_2

   

 

   

IMHO new PCB should come with new revision of the code.

   

odissey1

0 Likes