Ejemplo n.º 1
0
static ssize_t set_samplerate(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	unsigned long desired_samplerate;
	unsigned int divider;
	unsigned int internal_samplerate;

	strict_strtoul(buf, 10, &desired_samplerate);
	internal_samplerate = (itg3200_get_low_pass(client) == 0 ? 8000 : 1000);

	divider = internal_samplerate / desired_samplerate - 1;

	itg3200_set_samplerate_divider(client, divider);
	return count;
}
Ejemplo n.º 2
0
bool itg3200_init(int fd)
{
	itg3200_set_lowpass_samplerate(fd, lowpass256Hz_samplerate8kHz);
	itg3200_set_samplerate_divider(fd, 0);	
	return true;
}