Ejemplo n.º 1
0
bool ComediDigitalOutput::initialise()
{
	// set as output
	
	if(!(comedi_dio_config(m_device, m_subdevice, m_channels[0],COMEDI_OUTPUT))==0) {
		Logger(Critical, "ComediDigitalOutput::initialise() - Config error: %s.\n",comedi_strerror(comedi_errno()));
		return false;
	}
	if(!(comedi_set_routing(m_device, m_subdevice, m_channels[0], NI_PFI_OUTPUT_PFI_DO))==0) {
		Logger(Critical, "ComediDigitalOutput::initialise() - Routing error: %s.\n",comedi_strerror(comedi_errno()));
		return false;
	}
	return true;	

}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
	int retval;
	lsampl_t routing;
	struct parsed_options options;

	init_parsed_options(&options);
	options.freq = 0.;
	parse_options(&options, argc, argv);

	device = comedi_open(options.filename);
	if(!device){
		comedi_perror(options.filename);
		exit(-1);
	}
	routing = options.value;
	printf("Selecting routing %d for channel %d on subdevice %d.\n", routing, options.channel, options.subdevice);

	retval = comedi_set_routing(device, options.subdevice, options.channel, routing);
	if(retval < 0) comedi_perror("comedi_do_insn");
	return retval;
}