Pinvalidation

I extended the pin validation to validate the pins according to the mode choosen.