Is there a way to pass multiple values to macro function as single defined macro value in C?
It is possible, but you need another level of macros to expand the argument:
#define CMBset_out_X(port,pin) (DDR##port) |= (1<<pin)
#define CMBset_out(x) CMBset_out_X(x)
Of course this means that you can't use the CMBset_out
macro with two explicit arguments.
An improvement upon the previous answer, which also allows you to call the macro with two explicit arguments.
It should work with any c99 (or better) compiler:
#define CMBset_out_X(port,pin) (DDR##port) |= (1<<pin)
#define CMBset_out(...) CMBset_out_X(__VA_ARGS__)
#define STATUS_LED B,7
CMBset_out(STATUS_LED)
CMBset_out(B, 7)