I've replaced the portable implementation with hard coded ports and pin masks.