Ejemplo n.º 1
0
static
struct eegdev* open_device(struct grpconf group[3])
{
	struct eegdev* dev;
	char devicestr[256] = "biosemi";

	if (!(dev = egd_open(devicestr)))
		return NULL;

	group[0].nch = egd_get_numch(dev, egd_sensor_type("eeg"));
	group[1].nch = egd_get_numch(dev, egd_sensor_type("undefined"));
	group[2].nch = egd_get_numch(dev, egd_sensor_type("trigger"));

	return dev;
}
Ejemplo n.º 2
0
static
int configure_egd_acq(struct acq* acq)
{
	int i, stype, isint;
	const char* const types[3] = {"eeg", "undefined", "trigger"};
	struct eegdev* dev = acq->dev;
	
	for (i=0; i<3; i++) {
		stype = egd_sensor_type(types[i]);
		egd_channel_info(dev, stype, 0, EGD_ISINT, &isint, EGD_EOL);
		acq->grp[i].sensortype = stype;
		acq->grp[i].index = 0;
		acq->grp[i].nch = egd_get_numch(dev, stype);
		acq->grp[i].iarray = i;
		acq->grp[i].arr_offset = 0;
		acq->grp[i].datatype = (isint) ? EGD_INT32 : EGD_FLOAT;
		acq->strides[i] = (stype == EGD_TRIGGER) ?
		                          sizeof(int32_t) : sizeof(float);
		acq->strides[i] *= acq->grp[i].nch;

		if (!(acq->buff[i] = malloc(acq->strides[i]*CHUNK_NS)))
			break;
	}

	return (i == 3) ? 0 : -1;;
}
Ejemplo n.º 3
0
static
int test_chinfo(struct eegdev* dev)
{
	unsigned int i, eegnch, sensnch, trinch;
	int isint;
	double dmm[2];
	int32_t imm[2];

	eegnch = egd_get_numch(dev, egd_sensor_type("eeg"));
	sensnch = egd_get_numch(dev, egd_sensor_type("undefined"));
	trinch = egd_get_numch(dev, egd_sensor_type("trigger"));

	for (i=0; i<eegnch; i++) {
		if (egd_channel_info(dev, egd_sensor_type("eeg"), i, EGD_MM_D, dmm, 
		                                EGD_ISINT, &isint, EGD_EOL))
			return -1;
		if (isint  || dmm[0] != -262144.0 
		           || dmm[1] != 262143.96875)
		  	return -1;
	}
	for (i=0; i<sensnch; i++) {
		if (egd_channel_info(dev, egd_sensor_type("undefined"), i, EGD_MM_D, dmm, 
		                                EGD_ISINT, &isint, EGD_EOL))
			return -1;
		if (isint  || dmm[0] != -262144.0 
		           || dmm[1] != 262143.96875)
		  	return -1;
	}
	for (i=0; i<trinch; i++) {
		if (egd_channel_info(dev, egd_sensor_type("trigger"), i, EGD_MM_I, imm, 
		                                EGD_ISINT, &isint, EGD_EOL))
			return -1;
		if (!isint  || imm[0] != -8388608 
		            || imm[1] != 8388607)
		  	return -1;
	}

	return 0;
}
Ejemplo n.º 4
0
static
int print_cap(struct eegdev* dev)
{
	unsigned int sampling_freq, eeg_nmax, sensor_nmax, trigger_nmax;
	char *device_type, *device_id;
	char prefiltering[128];
	int retval;

	egd_get_cap(dev, EGD_CAP_DEVTYPE, &device_type);
	egd_get_cap(dev, EGD_CAP_DEVID, &device_id);
	egd_get_cap(dev, EGD_CAP_FS, &sampling_freq);
	eeg_nmax = egd_get_numch(dev, egd_sensor_type("eeg"));
	sensor_nmax = egd_get_numch(dev, egd_sensor_type("undefined"));
	trigger_nmax = egd_get_numch(dev, egd_sensor_type("trigger"));
	egd_channel_info(dev, egd_sensor_type("eeg"), 0,
				EGD_PREFILTERING, prefiltering, EGD_EOL);
	retval = (int)sampling_freq;

	if (!verbose)
		return retval;

	printf("\tVersion : %s\n"
	       "\tsystem capabilities:\n"
	       "\t\tdevice type: %s\n"
	       "\t\tdevice model: %s\n"
	       "\t\tsampling frequency: %u Hz\n"
	       "\t\tnum EEG channels: %u\n"
	       "\t\tnum sensor channels: %u\n"
	       "\t\tnum trigger channels: %u\n"
	       "\t\tprefiltering: %s\n",
	       egd_get_string(),
	       device_type, device_id, sampling_freq,
	       eeg_nmax, sensor_nmax, trigger_nmax, prefiltering);

	return retval;
}