avr: refactored pb funcs