Pass 1 Galileo speedup for pinMode

Similar changes like I made for Edison.  Much faster for ping...
May still see if any other enhancements can be made

I also included the Arduino sketch that I do some of the testing with