Engine
Engine

Reputation: 5422

what does this code mean ?

I'm reading a project , and I found this code, which I don't unterstand.

#define OUT_PINS            {X2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}, \
                    {Y2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}, \
                    {Z2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}

the program is running on SAM3S a cortex M3 from Atmel .

X2_Pin , Y2_Pin and Z2_Pin are defined .

can anyone explain o me what OUT_PINS now is ?

Upvotes: 0

Views: 158

Answers (2)

Chris
Chris

Reputation: 11

Well, in this case you dont really need this macro. But it brings your code a better overview. If u work with macros/defines and you need changes in your code you only have to change your macros/defines.

Upvotes: 1

venki
venki

Reputation: 182

OUT_PINS is a macro defined with some 2D array values. check the following example for better understanding.

eg: int *OP[] = {OUT_PINS } is similar to

int *OP[] = {{X2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}, \
                    {Y2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}, \
                    {Z2_PIN, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}}

Upvotes: 1

Related Questions