diff --git a/gpioc2.h b/gpioc2.h index 86c55dd..6569aaa 100644 --- a/gpioc2.h +++ b/gpioc2.h @@ -109,6 +109,14 @@ GPIOC2::GPIOC2(int pin_number, bool direction) << pin_number; throw GPIOC2_Exception(message.str()); } + + if (set_direction() == false) + { + std::stringstream message; + message << "Unable to set the direction of pin " + << pin_number; + throw GPIOC2_Exception(message.str()); + } } @@ -191,4 +199,4 @@ bool GPIOC2::set_direction() } direction_file.close(); return true; -} \ No newline at end of file +}