I have the following code :
#define phase_1 0b00011000
#define phase_2 0b00101000
#define phase_3 0b00001010
#define phase_4 0b00001100
Which actually corresponds to the pins that need to be set to high for a given phase of a stepper motor. It works perfectly fine, but it is not really clear which bits correspond to which wire.
What I am trying to acheive is something like that
#define Yellow PORTB5
#define Orange PORTB4
#define Enable PORTB3
#define Blue PORTB2
#define White PORTB1
and then having something like that to set my bit in a way which is really easy to understand
#define phase_1 (1 << Yellow) | (1 << Enable)
#define phase_2 (1 << Blue) | (1 << Enable)
etc.
Is there a way to make define in a fashion similar to that so that when I look at my code in some time I will exactly know where each wire goes and what it means?