From 12389d30c38c9eae0b053dd53d96d081c30240cf Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 10 Aug 2007 18:48:03 +0000 Subject: [PATCH] Moved comedi_internal_trigger into common.c --- demo/ao_mmap.c | 16 ---------------- demo/ao_waveform.c | 17 ----------------- demo/common.c | 16 ++++++++++++++++ demo/examples.h | 1 + 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/demo/ao_mmap.c b/demo/ao_mmap.c index 50ea279..03611f7 100644 --- a/demo/ao_mmap.c +++ b/demo/ao_mmap.c @@ -37,22 +37,6 @@ #include "examples.h" -static int comedi_internal_trigger(comedi_t *dev, unsigned int subd, unsigned int trignum) -{ - comedi_insn insn; - lsampl_t data[1]; - - memset(&insn, 0, sizeof(comedi_insn)); - insn.insn = INSN_INTTRIG; - insn.subdev = subd; - insn.data = data; - insn.n = 1; - - data[0] = trignum; - - return comedi_do_insn(dev, &insn); -} - static void write_waveform(sampl_t *buffer, int size, double amplitude, double offset, int maxdata) { int i; diff --git a/demo/ao_waveform.c b/demo/ao_waveform.c index fe75bed..33bab51 100644 --- a/demo/ao_waveform.c +++ b/demo/ao_waveform.c @@ -75,23 +75,6 @@ void dds_init_sine(void); void dds_init_pseudocycloid(void); void dds_init_sawtooth(void); -int comedi_internal_trigger(comedi_t *dev, unsigned int subd, unsigned int trignum) -{ - comedi_insn insn; - lsampl_t data[1]; - - memset(&insn, 0, sizeof(comedi_insn)); - insn.insn = INSN_INTTRIG; - insn.subdev = subd; - insn.data = data; - insn.n = 1; - - data[0] = trignum; - - return comedi_do_insn(dev, &insn); -} - - int main(int argc, char *argv[]) { comedi_cmd cmd; diff --git a/demo/common.c b/demo/common.c index 8be9fc7..0d2198b 100644 --- a/demo/common.c +++ b/demo/common.c @@ -267,3 +267,19 @@ int set_gate_source(comedi_t *device, unsigned subdevice, lsampl_t gate_index, l } return 0; } + +int comedi_internal_trigger(comedi_t *dev, unsigned int subd, unsigned int trignum) +{ + comedi_insn insn; + lsampl_t data[1]; + + memset(&insn, 0, sizeof(comedi_insn)); + insn.insn = INSN_INTTRIG; + insn.subdev = subd; + insn.data = data; + insn.n = 1; + + data[0] = trignum; + + return comedi_do_insn(dev, &insn); +} diff --git a/demo/examples.h b/demo/examples.h index 5c50584..73d8bb8 100644 --- a/demo/examples.h +++ b/demo/examples.h @@ -35,6 +35,7 @@ extern int reset_counter(comedi_t *device, unsigned subdevice); extern int set_counter_mode(comedi_t *device, unsigned subdevice, lsampl_t mode_bits); extern int set_clock_source(comedi_t *device, unsigned subdevice, lsampl_t clock, lsampl_t period_ns); extern int set_gate_source(comedi_t *device, unsigned subdevice, lsampl_t gate_index, lsampl_t gate_source); +extern int comedi_internal_trigger(comedi_t *dev, unsigned int subd, unsigned int trignum); #define sec_to_nsec(x) ((x)*1000000000) #define sec_to_usec(x) ((x)*1000000) -- 2.26.2