From: Frank Mori Hess Date: Wed, 6 Aug 2008 20:06:16 +0000 (+0000) Subject: Added C++ binding for comedi_get_clock_source. Fixed binding for X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c99e7803a6b1c1ce5902e144104cdda1e7c38836;p=comedilib.git Added C++ binding for comedi_get_clock_source. Fixed binding for comedi_find_subdevice_by_type. --- diff --git a/c++/include/comedilib.hpp b/c++/include/comedilib.hpp index da9a370..319ee6c 100644 --- a/c++/include/comedilib.hpp +++ b/c++/include/comedilib.hpp @@ -405,6 +405,18 @@ namespace comedi } return retval; } + void get_clock_source(unsigned *clock, unsigned *period_ns) const + { + int retval = comedi_get_clock_source(comedi_handle(), index(), clock, period_ns); + if(retval < 0) + { + std::ostringstream message; + message << __PRETTY_FUNCTION__ << ": comedi_set_clock_source() failed."; + std::cerr << message.str() << std::endl; + comedi_perror("comedi_set_clock_source"); + throw std::runtime_error(message.str()); + } + } comedi_polynomial_t hardcal_converter(unsigned channel, unsigned range, enum comedi_conversion_direction direction) const { @@ -605,7 +617,7 @@ namespace comedi subdevice device::find_subdevice_by_type(int type, const subdevice *start_subdevice) const { unsigned start_index; - if(start_subdevice) start_index = start_subdevice->index(); + if(start_subdevice) start_index = start_subdevice->index() + 1; else start_index = 0; int subdev = comedi_find_subdevice_by_type(comedi_handle(), type, start_index); if(subdev < 0)