Re: python/comedi

In summary, yes: ... Frank, please update the CVS version with the one
attached to this post (*not* my previous post). 

... While writing this reply and browsing the comedi.i file, I noticed I
had an additional, custom function ('BufferScan') in the comedi.i file
attached to my last post. This is a broken function (part of some
software-triggering code) and shouldn't have been included. Sorry for my
sloppiness.

Please discard that interface file and replace it with the one attached
to this post (with BufferScan removed). Since no-one has come running
back with problems with that comedi.i file, I assume it has worked
sucessfully for at least one or two other people (BufferScan aside) so
the attached version should be a good substitute for the current
CVS-version.

The current CVS version of the interface file does not generate wrappers
which handle function-results passed by reference. When I wrote the
file, I didn't think Comedilib passed anything by reference but I since
found a couple of functions which do (e.g. comedi_data_read and
comedi_data_read_delayed). To handle these I needed to copy most of the
comedilib headers into the comedi.i file, strip out the unnecessary
stuff and edit it to let SWIG know which pointer-arguments are 'output'.

cheers,
Bryan


On Sat, 2004-03-20 at 16:48, Steven Jenkins wrote:
> bryan cole wrote:
> > *BUT* the current version of comedilib ships with an old version of the
> > comedi.i swig interface file. The wrappers which this file creates have
> > a few fundamental flaws (although I think they build fine). I've
> > attached an updated comedi.i interface file which I use, which has fixed
> > most of these issues (well, it works great for me, anyway). Simply drop
> > it in place of the existing comedi.i file and then rerun swig (execute
> > 'swig -python comedi.i') to recreate new wrappers. You can then rebuild
> > these using 'python setup.py install'. Hopefully, everything will go
> > without a hitch :)
> 
> What are the flaws? Should we ask Frank to update CVS with this version?
> 
> For comparison, here's the SimpleDataLogger in Ruby:
> 
> --------
> require 'comedi'
> 
> dev = Comedi::open('/dev/comedi0')
> 
> aref = Comedi::AREF_GROUND
> range = 0
> chan = 4 #channel number
> subdev = 0 #analog in
> 
> maxdata = dev.get_maxdata(subdev, chan)
> cdi_range = dev.get_range(subdev, chan, range)
> 
> f = File.open('datalog.dat', 'ab')
> loop {
>      data = dev.data_read(subdev, chan, range, aref)
>      val = dev.to_phys(data, cdi_range, maxdata)
>      mytime = Time.now.to_f
>      f.puts "#{val}\t#{mytime}"
>      f.flush
>      sleep 30
>      puts "#{val} #{mytime}"
> }
> --------
> 
> Steve
> 
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
-- 
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382

Received on 2004-03-22Z19:04:13