~ubuntu-branches/debian/jessie/rtai/jessie

« back to all changes in this revision

Viewing changes to rtai-lab/scilab5/RTAI/macros/rtai4_comedi_dioin.sci

  • Committer: Bazaar Package Importer
  • Author(s): Roland Stigge
  • Date: 2009-07-04 11:47:08 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090704114708-0ivbkccfaawz2pby
Tags: 3.7.1-1
* New upstream release
* debian/control: Standards-Version: 3.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ] = rtai4_comedi_dioin(job,arg1,arg2)
 
2
  x=[];y=[];typ=[];
 
3
  select job
 
4
  case 'plot' then
 
5
    exprs=arg1.graphics.exprs;
 
6
    ch=exprs(1)
 
7
    name=exprs(2)
 
8
    standard_draw(arg1)
 
9
  case 'getinputs' then
 
10
    [x,y,typ]=standard_inputs(arg1)
 
11
  case 'getoutputs' then
 
12
    [x,y,typ]=standard_outputs(arg1)
 
13
  case 'getorigin' then
 
14
    [x,y]=standard_origin(arg1)
 
15
  case 'set' then
 
16
    x=arg1
 
17
    model=arg1.model;graphics=arg1.graphics;
 
18
    exprs=graphics.exprs;
 
19
    while %t do
 
20
      [ok,ch,name,exprs]=..
 
21
      getvalue('Set RTAI-COMEDI DIO block parameters',..
 
22
      ['Channel:';
 
23
       'Device:'],..
 
24
      list('vec',-1,'str',1),exprs)
 
25
      if ~ok then break,end
 
26
      if exists('outport') then out=ones(outport,1), in=[], else out=1, in=[], end
 
27
      [model,graphics,ok]=check_io(model,graphics,in,out,1,[])
 
28
      dev=str2code(name)
 
29
      if ok then
 
30
        graphics.exprs=exprs;
 
31
        model.rpar=[];
 
32
        model.ipar=[ch;
 
33
                    dev(length(dev))];
 
34
        model.dstate=[];
 
35
        x.graphics=graphics;x.model=model
 
36
        break
 
37
      end
 
38
    end
 
39
  case 'define' then
 
40
    ch=0
 
41
    name='comedi0'
 
42
    model=scicos_model()
 
43
    model.sim=list('rt_comedi_dioin',4)
 
44
    if exists('outport') then model.out=ones(outport,1), model.in=[], else model.out=1, model.in=[], end
 
45
    model.evtin=1
 
46
    model.rpar=[]
 
47
    model.ipar=[ch;
 
48
                0]
 
49
    model.dstate=[];
 
50
    model.blocktype='d'
 
51
    model.dep_ut=[%t %f]
 
52
    exprs=[sci2exp(ch),name]
 
53
    gr_i=['xstringb(orig(1),orig(2),[''COMEDI DI'';name+'' CH-''+string(ch)],sz(1),sz(2),''fill'');']
 
54
    x=standard_define([3 2],model,exprs,gr_i)
 
55
  end
 
56
endfunction