Register an Funktion übergeben
Hallo,
wie kann ich die Adresse eines Registers an eine Funktion übergeben?
Code:
uint8_t outSet(uint8_t *port, uint8_t pin, uint8_t level) {
uint8_t *DDR = 0;
if (*port == PORTA) { *DDR = DDRA; }
if (*port == PORTB) { *DDR = DDRB; }
if (*port == PORTC) { *DDR = DDRC; }
if (*port == PORTD) { *DDR = DDRD; }
asm("nop");
if (level) {
*port |= (pin << *port);
} else {
*port &= ~(pin << *port);
}
return level;
}
Aufruf: outSet(&PORTA,3,1);
Nur der Compiler meldet: ../main.c:84: warning: passing argument 1 of 'outSet' discards qualifiers from pointer target type
Was mache ich falsch?
Gruß