As the title says, are there board independent helper functions where you supply an Arduino pin number and it returns a port and bit number to do direct port manipulation.
Example: UNO pin 6 is Port D bit 6 but on a Mega pin 6 is Port H bit 3.
I could re-invent the wheel and roll my own if needed but I assume the core(s) must do this somewhere for me.
Have you looked at how digitalWrite() and digitalRead() do that?
uint8_t bit = digitalPinToBitMask(pin);
uint8_t port = digitalPinToPort(pin);
You might want to investigate these methods. I've heard that these are where the time is actually spent.
Thanks Paul,
I was off looking as you replied. I found the defines for digitalPinToPort & digitalPinToBitMask in Arduino.h and finally found the PROGMEM structures they refer to defined in the various pins_arduino.h.