Lines Matching +full:gyro +full:- +full:odr
5 * SPDX-License-Identifier: Apache-2.0
26 const struct bmi08x_gyro_config *bmi08x = dev->config; in bmi08x_gyro_transceive_i2c()
29 return i2c_write_read_dt(&bmi08x->bus.i2c, ®, 1, data, length); in bmi08x_gyro_transceive_i2c()
32 return -EINVAL; in bmi08x_gyro_transceive_i2c()
38 return i2c_write_dt(&bmi08x->bus.i2c, buf, 1 + length); in bmi08x_gyro_transceive_i2c()
43 return i2c_is_ready_dt(&bus->i2c) ? 0 : -ENODEV; in bmi08x_bus_check_i2c()
58 const struct bmi08x_gyro_config *bmi08x = dev->config; in bmi08x_gyro_transceive_spi()
68 return spi_transceive_dt(&bmi08x->bus.spi, &tx, &rx); in bmi08x_gyro_transceive_spi()
71 return spi_write_dt(&bmi08x->bus.spi, &tx); in bmi08x_gyro_transceive_spi()
76 return spi_is_ready_dt(&bus->spi) ? 0 : -ENODEV; in bmi08x_bus_check_spi()
88 const struct bmi08x_gyro_config *config = dev->config; in bmi08x_bus_check()
90 return config->api->check(&config->bus); in bmi08x_bus_check()
96 const struct bmi08x_gyro_config *cfg = dev->config; in bmi08x_gyro_transceive()
98 return cfg->api->transceive(dev, reg, write, data, length); in bmi08x_gyro_transceive()
151 int odr = bmi08x_freq_to_odr_val(freq_int, freq_milli); in bmi08x_gyr_odr_set() local
153 if (odr < 0) { in bmi08x_gyr_odr_set()
154 return odr; in bmi08x_gyr_odr_set()
157 if (odr < BMI08X_GYRO_BW_532_ODR_2000_HZ || odr > BMI08X_GYRO_BW_32_ODR_100_HZ) { in bmi08x_gyr_odr_set()
158 return -ENOTSUP; in bmi08x_gyr_odr_set()
161 return bmi08x_gyro_byte_write(dev, BMI08X_REG_GYRO_BANDWIDTH, (uint8_t)odr); in bmi08x_gyr_odr_set()
166 struct bmi08x_gyro_data *bmi08x = dev->data; in bmi08x_gyr_range_set()
180 bmi08x->scale = BMI08X_GYR_SCALE(range); in bmi08x_gyr_range_set()
192 return bmi08x_gyr_odr_set(dev, val->val1, val->val2 / 1000); in bmi08x_gyr_config()
194 LOG_DBG("Gyro attribute not supported."); in bmi08x_gyr_config()
195 return -ENOTSUP; in bmi08x_gyr_config()
207 return -EBUSY; in bmi08x_attr_set()
219 return -ENOTSUP; in bmi08x_attr_set()
225 struct bmi08x_gyro_data *bmi08x = dev->data; in bmi08x_sample_fetch()
231 return -ENOTSUP; in bmi08x_sample_fetch()
234 ret = bmi08x_gyro_read(dev, BMI08X_REG_GYRO_X_LSB, (uint8_t *)bmi08x->gyr_sample, in bmi08x_sample_fetch()
235 sizeof(bmi08x->gyr_sample)); in bmi08x_sample_fetch()
241 for (i = 0; i < ARRAY_SIZE(bmi08x->gyr_sample); i++) { in bmi08x_sample_fetch()
242 bmi08x->gyr_sample[i] = sys_le16_to_cpu(bmi08x->gyr_sample[i]); in bmi08x_sample_fetch()
254 * max(raw_val) = +/- 2^15 in bmi08x_to_fixed_point()
259 val->val1 = converted_val / 1000000; in bmi08x_to_fixed_point()
260 val->val2 = converted_val % 1000000; in bmi08x_to_fixed_point()
293 struct bmi08x_gyro_data *bmi08x = dev->data; in bmi08x_gyr_channel_get()
295 bmi08x_channel_convert(chan, bmi08x->scale, bmi08x->gyr_sample, val); in bmi08x_gyr_channel_get()
306 return -EBUSY; in bmi08x_channel_get()
319 return -ENOTSUP; in bmi08x_channel_get()
337 return -ENOTSUP; in bmi08x_gyro_pm_action()
362 const struct bmi08x_gyro_config *config = dev->config; in bmi08x_gyro_init()
368 LOG_ERR("Bus not ready for '%s'", dev->name); in bmi08x_gyro_init()
389 return -ENODEV; in bmi08x_gyro_init()
392 /* set gyro default range */ in bmi08x_gyro_init()
393 ret = bmi08x_gyr_range_set(dev, config->gyro_fs); in bmi08x_gyro_init()
399 /* set gyro default bandwidth */ in bmi08x_gyro_init()
400 ret = bmi08x_gyro_byte_write(dev, BMI08X_REG_GYRO_BANDWIDTH, config->gyro_hz); in bmi08x_gyro_init()
402 LOG_ERR("Failed to set gyro's default ODR."); in bmi08x_gyro_init()
417 /* set gyro ints */ in bmi08x_gyro_init()
425 config->int3_4_conf_io); in bmi08x_gyro_init()
430 ret = bmi08x_gyro_byte_write(dev, BMI08X_REG_GYRO_INT3_INT4_IO_MAP, config->int3_4_map); in bmi08x_gyro_init()
451 /* the bmi08x-gyro should not have trigger mode with data-sync enabled */
453 "Only none trigger type allowed for bmi08x-gyro with data-sync enabled");
454 /* with data-sync, one of the int pins should be wired directory to the accel's int pins, their