How do I get rid of duplication

why is a separate function needed?
can't one function, knowing which board handle either board?

Adafruit_PWMServoDriver *pPwm;