From c99e7803a6b1c1ce5902e144104cdda1e7c38836 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 6 Aug 2008 20:06:16 +0000 Subject: [PATCH] Added C++ binding for comedi_get_clock_source. Fixed binding for comedi_find_subdevice_by_type. --- c++/include/comedilib.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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) -- 2.26.2