/* Get a range table index associated with a range value.  */
static bool sensor_range_index(const sensor_caps_t *caps, int16_t range, int *index)
/* Get a range table index associated with a range value.  */
static bool sensor_range_index(const sensor_caps_t *caps, int16_t range, int *index)
{
	if (caps && caps->range_table) {
		for (int i = 0; i < caps->range_count; ++i) {
			if (caps->range_table[i].range_units == range) {
				*index = i;
				return true;
			}
		}
	}
	return false;
}