changed pin to channel mapping to inline function