changeset 10909:af565713d2fb octave-forge

instrument-control: i2c, texinfo help strings
author eandrius
date Sun, 23 Sep 2012 21:54:40 +0000
parents e240a0b41b89
children c84734ce1355
files main/instrument-control/src/i2c/i2c.cc main/instrument-control/src/i2c/i2c_addr.cc main/instrument-control/src/i2c/i2c_close.cc main/instrument-control/src/i2c/i2c_read.cc main/instrument-control/src/i2c/i2c_write.cc
diffstat 5 files changed, 55 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main/instrument-control/src/i2c/i2c.cc	Sun Sep 23 18:17:38 2012 +0000
+++ b/main/instrument-control/src/i2c/i2c.cc	Sun Sep 23 21:54:40 2012 +0000
@@ -66,7 +66,17 @@
     os << this->fd;
 }
 
-DEFUN_DLD (i2c, args, nargout, "")
+DEFUN_DLD (i2c, args, nargout, 
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {@var{i2c} = } i2c ([@var{path}], [@var{address}])\n \
+\n\
+Open i2c interface.\n \
+\n\
+@var{path} - the interface path of type String. If omitted defaults to '/dev/i2c-0'. @*\
+@var{address} - the slave device address. If omitted must be set using i2c_addr() call.\n \
+\n\
+The i2c() shall return instance of @var{octave_i2c} class as the result @var{i2c}.\n \
+@end deftypefn")
 {
 #ifdef __WIN32__
     error("i2c: Windows platform support is not yet implemented, go away...");
--- a/main/instrument-control/src/i2c/i2c_addr.cc	Sun Sep 23 18:17:38 2012 +0000
+++ b/main/instrument-control/src/i2c/i2c_addr.cc	Sun Sep 23 21:54:40 2012 +0000
@@ -26,7 +26,20 @@
 
 #include "i2c.h"
 
-DEFUN_DLD (i2c_addr, args, nargout, "")
+DEFUN_DLD (i2c_addr, args, nargout, 
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} i2c_addr (@var{i2c}, @var{address})\n \
+@deftypefnx {Loadable Function} {@var{addr} = } i2c_addr (@var{i2c})\n \
+\n\
+Set new or get existing i2c slave device address.\n \
+\n\
+@var{i2c} - instance of @var{octave_i2c} class.@*\
+@var{address} - i2c slave device address of type Integer. \
+The address is passed in the 7 or 10 lower bits of the argument.\n \
+\n\
+If @var{address} parameter is omitted, the i2c_addr() shall return \
+current i2c slave device address as the result @var{addr}.\n \
+@end deftypefn")
 {
     if (args.length() > 2 || 
         args(0).type_id() != octave_i2c::static_type_id()) 
--- a/main/instrument-control/src/i2c/i2c_close.cc	Sun Sep 23 18:17:38 2012 +0000
+++ b/main/instrument-control/src/i2c/i2c_close.cc	Sun Sep 23 21:54:40 2012 +0000
@@ -25,7 +25,14 @@
 
 #include "i2c.h"
 
-DEFUN_DLD (i2c_close, args, nargout, "")
+DEFUN_DLD (i2c_close, args, nargout, 
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {} i2c_close (@var{i2c})\n \
+\n\
+Close the interface and release a file descriptor.\n \
+\n\
+@var{i2c} - instance of @var{octave_i2c} class.@*\
+@end deftypefn")
 {
     if (args.length() != 1 || args(0).type_id() != octave_i2c::static_type_id())
     {
--- a/main/instrument-control/src/i2c/i2c_read.cc	Sun Sep 23 18:17:38 2012 +0000
+++ b/main/instrument-control/src/i2c/i2c_read.cc	Sun Sep 23 21:54:40 2012 +0000
@@ -26,7 +26,17 @@
 
 #include "i2c.h"
 
-DEFUN_DLD (i2c_read, args, nargout, "")
+DEFUN_DLD (i2c_read, args, nargout, 
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {[@var{data}, @var{count}] = } i2c_read (@var{i2c}, @var{n})\n \
+\n\
+Read from i2c slave device.\n \
+\n\
+@var{i2c} - instance of @var{octave_i2c} class.@*\
+@var{n} - number of bytes to attempt to read of type Integer.\n \
+\n\
+The i2c_read() shall return number of bytes successfully read in @var{count} as Integer and the bytes themselves in @var{data} as uint8 array.\n \
+@end deftypefn")
 {
     if (args.length() < 1 || args.length() > 2 || args(0).type_id() != octave_i2c::static_type_id())
     {
--- a/main/instrument-control/src/i2c/i2c_write.cc	Sun Sep 23 18:17:38 2012 +0000
+++ b/main/instrument-control/src/i2c/i2c_write.cc	Sun Sep 23 21:54:40 2012 +0000
@@ -28,7 +28,17 @@
 
 using std::string;
 
-DEFUN_DLD (i2c_write, args, nargout, "")
+DEFUN_DLD (i2c_write, args, nargout, 
+"-*- texinfo -*-\n\
+@deftypefn {Loadable Function} {@var{n} = } i2c_write (@var{i2c}, @var{data})\n \
+\n\
+Write data to a i2c slave device.\n \
+\n\
+@var{i2c} - instance of @var{octave_i2c} class.@*\
+@var{data} - data to be written to the slave device. Can be either of String or uint8 type.\n \
+\n\
+Upon successful completion, i2c_write() shall return the number of bytes written as the result @var{n}.\n \
+@end deftypefn")
 {
     if (args.length() != 2 || args(0).type_id() != octave_i2c::static_type_id()) 
     {