I've ran into the problem when I tried to write simple port manipulation
macros for avr

#define MOTOR_CONTROL_PIN PORTC,1

#define set_port_pin(port, pin) (port |= (1<<pin))

when I try to use this macro like this: set_port_pin(MOTOR_CONTROL_PIN);
I get preprocessor error, saying that set_port_macro expects 2 arguments and
I pass only 1

When I rewrite the program and instead of defining macro set_port_pin I
write a function
which does the same, the program compiles without error.

So the only reason for this I think is that preprocessor doesnt
expand MOTOR_CONTROL_PIN macro
when it's used as parameter to another macro.

Any ideas?


Regards,
Giorgi Kvirkvia
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to