Gast
#2652727
Was ist der Vorteil, wenn ich die Funktion so definiere und nicht wie
gewohnt? Speicherplatz? Übersichtlichkeit?
#define PIN_SET_AS_PIO_OUTPUT(pin, pio) do {
\
Pio *pio_ptr;
\
if (PIO_A == pio)
\
{
\
pio_ptr = PIOA;
\
}
\
else if(PIO_B == pio)
\
{
\
pio_ptr = PIOB; \
}
\
else
\
{
\
pio_ptr = PIOC;
\
}
\
/* Bit corresponding to pin is set in output enable register. */
\
pio_ptr->PIO_OER = pin;
\
/* PIO control is enabled on the specified pin. */
\
pio_ptr->PIO_PER = pin;
\
} while (0);