GPIO - NC fix, asserts for preconditions, errors for runtime errors

The initial effort was to fix gpio and NC pins, which made me think about the error usage in mbed. This pull request is to properly use error for runtime errors and asserts for preconditions.

Open for review.