- From: edouard charvet <edouard.charvet_at_fr.thalesgroup.com>
- Date: Mon, 10 Oct 2005 09:34:40 +0200
Here's how I set up the lines: val[0]=INSN_CONFIG_CHANGE_NOTIFY; val[1]=0xFFFFFF; /* channels that trig an interrupt on rising edge */ val[2]=0xFFFFFF; /*channels that trig an interrupt on falling edge */ memset(&trig_insn,0,sizeof(comedi_insn)); trig_insn.insn=INSN_CONFIG; trig_insn.n=3; trig_insn.data=val; trig_insn.subdev=3; trig_insn.chanspec=CR_PACK(0,0,0); comedi_do_insn(device,&trig_insn); memset(&cmd,0,sizeof(cmd)); cmd.subdev = 3; cmd.flags = TRIG_WAKE_EOS; cmd.start_src = TRIG_NOW; cmd.start_arg = 0; cmd.scan_begin_src = TRIG_OTHER; cmd.scan_begin_arg = 0; cmd.convert_src = TRIG_FOLLOW; cmd.convert_arg = 0; cmd.scan_end_src = TRIG_COUNT; cmd.scan_end_arg = 1; cmd.stop_src = TRIG_COUNT; cmd.stop_arg = 0; chanlist=CR_PACK(0,0,0); cmd.chanlist = &chanlist; cmd.chanlist_len = 1; comedi_command(device,&cmd); regards, Edouard "Calin A. Culianu" a écrit : > On Fri, 7 Oct 2005, edouard charvet wrote: > > > ni6527 can do this. You can choose which line should generate an interrupt > > and which should not and on what kind of edge (rising and/or falling). > > However, once an interrupt is caught, you have to manually scan all your > > input lines to find which one had changed. > > > > In user space, you set this through a command call and then all you have to > > do is to wait on the file descriptor linked to the device. > > Cool. Wasn't aware comedi_cmd could clearly express this type of > situation. How do you configure the lines through the comedi API? > > Scanning all the lines isn't that bad.. it can be done as only one or a > small number of i/o operations if you do things like > comedi_dio_bitfield() (well, depends on the driver, but..) > > There are some el-cheapo boards out there that can do Change-of-State > detection (COS, as I found out it's called). They all have released > specs. I am tempted to buy one of these boards and write a driver for > it.. although I am *still* super-fuzzy on how you can express configuring > and doing COS detection useing the comedi api.. > > -Calin > > _______________________________________________ > comedi mailing list > comedi_at_comedi.org > https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
Received on 2005-10-10Z06:34:40