comedilib/swig/python
Ian Abbott 99958da64f swig/python: Removed test_comedi.py
It was untested, and never worked.  It would be better to replace it
with some small demo programs, similar to the C language demo programs.
2017-04-10 14:14:29 +01:00
..
comedi_python.i Revert previous commit, renaming comedi_wrap.c back to comedi_python_wrap.c. 2010-12-16 16:03:35 +00:00
comedi_wrap.doc Add chanlist_len parameter to comedi_get_cmd_generic_timed. 2010-11-08 11:01:42 +00:00
Makefile.am swig/python: Removed test_comedi.py 2017-04-10 14:14:29 +01:00
README.txt Suggest people use PYTHONPATH rather than adjusting sys.path internally. 2012-03-13 09:30:45 -04:00
setup.py Adjust setup.py to link against libtool's lib/.libs/. 2010-12-17 13:56:26 +00:00

** General info on the swig-generated wrappers for Comedilib **

0) Installing required tools
  The wrapper are made with SWIG. Any of the swig-1.3.x series should
  work.  Run
    $ swig -version
  to check the version you have installed, and upgrade if necessary.

1) Building the wrappers
  Note: the following applies when building wrappers separately from
  the comedilib library, using Python's distutils procedures instead
  of Comedilib's `make`.  In this case, Comedilib should be configured
  with the `--disable-python-binding` option to prevent it building
  and installing its own copy of the wrappers.

  After building the main comedilib library (running `make` in the
  base directory), just follow standard distutils procedures
    $ python setup.py build
    $ python setup.py install

  If you want to test the wrappers before installing them, you will
  need to set the `PYTHONPATH` environment variable so Python can find
  the compiled modules.  On my system, that looks like
    $ PYTHONPATH=build/lib.linux-i686-2.7/ ../../demo/python/info.py

2) Using the module
  All the comedilib functions are translated directly to python
  function. The various comedi structs are now available as python
  classes (e.g. comedi_cmd_struct). The members of each struct are now
  attributes of the class and can be set and retrieved in the usual
  way. Comedilib functions which take a pointer to a comedilib struct
  as an argument (in C) now, in python, accept the appropriate struct
  python object.

  For a multichannel acquisition, a C-array containing the channel
  list, gains and referencing is required. This can be created using a
  swig-generated helper class: chanlist(n). This creates a C-array of
  length n and type Unsigned Int. Individual members of the array can
  be accessed/set using pythons indexing syntax:
    mylist = chanlist(3)   #creates a chanlist array of length 3
    mylist[0] = 100 #set some values
    mylist[1] = 200
    mylist[2] = 300

  The chanlist object can then be passed to a comedi_cmd_struct
  object, for example. N.B. The chanlist object contains *no*
  length-checking or other error protection so use with care! Don't
  try to get/set indexes outside the array bounds.

  All the comedilib macros (e.g. CR_PACK) are now available as python
  functions (e.g. `comedi.cr_pack`).

  Look at the examples in demo/python to clarify the above.