/* Set the ITG-3200 sample rate. 
The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */
static bool itg3200_set_sample_rate(sensor_hal_t *hal, int16_t rate)
/* Set the ITG-3200 sample rate. 
The internal sampling rate is 1KHz for all filter bandwidths except 256Hz, which uses an 8KHz internal rate. */
static bool itg3200_set_sample_rate(sensor_hal_t *hal, int16_t rate)
{
	uint16_t internal_rate;
	uint8_t divider;
	if (hal->bandwidth == 256) {
		internal_rate = 8000;
	} else {
		internal_rate = 1000;
	}
	divider = (internal_rate / rate) - 1;
	sensor_bus_put(hal, ITG3200_SMPLRT_DIV, divider);
	return true;
}