Not using macros regularly the xmega io system is forcing my hand a little. I've made my own new macro in an attempt to make testing I/O pins easy but have come stuck with a macro not accepting a #define as its arguements, as shown. Any clues TIA.?
// PORT / PIN DEFINITIONS // Use following standard macro to turn output on // // PORT_SetOutputBit( _port, _bitPosition ) // Use following standard macro to turn output off // // PORT_ClearOutputBit( _port, _bitPosition ) // This is MY NEW MACRO to get the port data #define PORT_GetPortBit( _port, _bitPosition ) ( (_port)->IN & (1 << _bitPosition) ) // These are the port defines - note there is one differnt // I'd like to define a name as a port AND port pin position in one go - if possible #define bluetooth_power ( &PORTB, 0 ) // 0 = Power On #define sensor_power ( &PORTB, 1 ) // 0 = Power On #define red_led ( &PORTF, 6 ) // 1 = Led On #define green_led ( &PORTF, 6 ) // 1 = Led On #define link_established_bp 1 //This is how it works - and this compiles ok if (PORT_GetPortBit( &PORTC, link_established_bp ) == 0) {} //This is how I WANT to use it- bit this fails //complaining the macro only gets one argument if (PORT_GetPortBit( sensor_power) == 0) {}