Skip to content
Snippets Groups Projects
Select Git revision
  • 5cf80f4b58a25308e80edd98c7efdf213137abdf
  • master default
  • labcomm2006
  • typedefs
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.4
  • v2006.0
  • v2014.3
  • v2014.2
  • v2014.1
  • v2014.0
  • v2013.0
16 results

labcomm_default_memory.c

Blame
  • Forked from Anders Blomdell / LabComm
    Source project has a limited visibility.
    comedi_bridge.c 801 B
    #include <stdio.h>      /* for printf() */
    #include <comedilib.h>
    
    int range = 0;
    int aref = AREF_GROUND;
    comedi_t *it;
    
    int comedi_write(int comediNbr, int subdev, int chan, int writeValue) {
    	static int retval;
    	retval = comedi_data_write(it, subdev, chan, range, aref, writeValue);
        return retval;
    }
    
    int comedi_read(int comediNbr, int subdev, int chan) {
    	lsampl_t data;
    	comedi_data_read(it, subdev, chan, range, aref, &data);
        return data;
    }
    
    int comedi_start(int comediNbr) {
    	it = comedi_open("/dev/comedi0");
    		if(it == NULL)
    	{
    		comedi_perror("comedi_open_error");
    		return -1;
    	}
    	return 0;
    }
    
    void comedi_stop(int comediNbr) {
    	// Ad-hoc. Should be updated:
    	comedi_data_write(it, 1, 0, range, aref, 32767);
    	comedi_data_write(it, 1, 1, range, aref, 32767);
    	comedi_close(it);
    }