I am using #defines for pin manipulation to make change of used pin easier such as
#define MyPin (1<<PB1) #define PORTMyPin PORTB ... PORTMyPin|=MyPin;
It works well but sometimes I don't want manipulate just one pin. For example I want to write all pins LOW except for one pin. I can do either
but either will fail when I decide to move MyPin from port B to port A. I wanted to add something like
#if (PORTMyPin!=PORTB) #error #endif
to get error when I move the pin to another port without updating this location depends on original location. But sadly it does not work and Google did not help me. How would you solve this?