Hi,

> > i tried to use these macros for simplified port definitions 
> > because i want to change only one line when i change the port (PANIC_PORT):
> > 
> > 
> > // standard macros (K&R A.12, C-FAQs 11.17)
> > #   define mc_CAT(x, y) x ## y
> > #   define mc_XCAT(x, y) mc_CAT(x, y)
> > 
> > #   define PANIC_PORT P3
> > #   define  PANIC_PORT_DIR mc_XCAT(PANIC_PORT,DIR)
> > #   define  PANIC_PORT_SEL mc_XCAT(PANIC_PORT,SEL)
> > #   define  PANIC_PORT_OUT mc_XCAT(PANIC_PORT,OUT) // line 35
> 
> instead of that, you could duplicate the "sfr" definitions of the ports 
> in msp430/gpio.h. and use "P3IN_" as refenece (the header files define 
> the constants with underlines to the address of the coresponding 
> peripheral register)

ok, now i'm using:

#   define mc_PORT_u8(x)  (*(volatile u8*)(x))
#   define  PANIC_PORT_OUT mc_PORT_u8(mc_XCAT(PANIC_PORT,OUT_))

but i think i have to use different macros for other compilers.

Regards,

Rolf


Reply via email to