avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] nested macros don't expand


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] nested macros don't expand
Date: Sat, 20 Nov 2010 15:32:35 +0100 (MET)

(Please subscribe to the list to see all replies.  Many people tend to
reply to the list only as it is a closed list anywaa.)

George Kvirkvia <address@hidden> wrote:

> 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

This needs two levels of indirection:

#define MOTOR_CONTROL_PIN PORTC,1

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

set_port_pin(MOTOR_CONTROL_PIN);

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]