portInputRegister array?

Hi folks,

I'm a bit of a pointers noob (I'm used to high level programmer languages).
I Can't figure out how to turn the followin into an array:

volatile uint8_t *rx0PortRegister;
volatile uint8_t *rx1PortRegister;
volatile uint8_t *rx2PortRegister;
rxPortRegister[0] = portInputRegister(port[0]);
rxPortRegister[1] = portInputRegister(port[1]);
rxPortRegister[2] = portInputRegister(port[2]);

(I'm using this to do quicker pin reads)

With this fragment we cannot tell what you are doing, but it seems misguided.

you created a pointer to rx0PortRegister but did not assign it anything, so it points nowhere.

If you want an array, create an array:

volatile uint8_t rx0PortRegister[3].

What kind of function is portInputRegister()? What does it return?

(And what makes you think pointers are not high level?)

I figured it out:

#define NUM_CONN 3

int RX[NUM_CONN] = {A1, A3, A5};
volatile uint8_t *rxPortRegister[NUM_CONN];
uint8_t rxBitMask[NUM_CONN];

void setup() {
  for (int i=0; i<NUM_CONN; i++) {
    uint8_t port = digitalPinToPort(RX[i]);
    rxPortRegister[i] = portInputRegister(port);
    rxBitMask[i] = digitalPinToBitMask(RX[i]);
  }
}

uint8_t rxRead(int index) {
  return *rxPortRegister[index] & rxBitMask[index];
}

My opologies, I guess pointers aren’t higher or lower level. But I have more experience with Javascript, Java, Lua, ActionScript and c++ frameworks (openFrameworks) that try to avoid pointers.