text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>0; } int tmd2620_trigger_set(const struct device *dev, const struct sensor_trigger *trigg, sensor_trigger_handler_t handler) { LOG_DBG("Setting trigger handler."); const struct tmd2620_config *config = dev->config; struct tmd2620_data *data = dev->data; int ret; tmd2620_setup_int(dev->config, f...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 T-Mobile USA, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_tsl2540 #include "tsl2540.h" #include <stdlib.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device.h> #include <zephyr/sys/__assert.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 T-Mobile USA, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TSL2540_TSL2540_H_ #define ZEPHYR_DRIVERS_SENSOR_TSL2540_TSL2540_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 T-Mobile USA, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "tsl2540.h" #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(tsl2540, CONFIG_SENSOR_LOG_LEVEL); static void tsl2540_setup_int(const struct device *dev, bool enable) { const struct tsl2540_config *confi...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ion_time; uint8_t gain; }; struct tsl2561_data { uint16_t ch0; uint16_t ch1; uint32_t ch_scale; }; static int tsl2561_reg_read(const struct device *dev, uint8_t reg, uint8_t *buf, uint8_t size) { int ret; const struct tsl2561_config *config = dev->config; uint8_t cmd = (TSL2561_COMMAND_CMD | TSL2...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ IF_ENABLED(CONFIG_TSL2591_TRIGGER, \ (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(n, int_gpios, {0}),))}; \ PM_DEVICE_DT_INST_DEFINE(n, tsl2591_pm_action); \ SENSOR_DEVIC...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Kurtis Dinelle * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TSL2591_TSL2591_H_ #define ZEPHYR_DRIVERS_SENSOR_TSL2591_TSL2591_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor/tsl25...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>{ LOG_ERR("Failed to initialize trigger semaphore"); return ret; } k_thread_create(&data->thread, data->thread_stack, CONFIG_TSL2591_THREAD_STACK_SIZE, tsl2591_thread, data, NULL, NULL, K_PRIO_COOP(CONFIG_TSL2591_THREAD_PRIORITY), 0, K_NO_WAIT); #elif defined(CONFIG_TSL2591_TRIGGER_GLOBAL_THR...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Balthazar Deliers * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT aosong_ags10 #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/crc.h> #include "ags10.h" LOG...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Balthazar Deliers * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_AGS10_H_ #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_AGS10_H_ #ifdef __cplusplus extern "C" { #endif #include <zephyr/device.h> #include <zephyr/drivers/<|fim_suffix|> 0x...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT aosong_dht #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/sensor.h> #include <string.h> #include <zephyr/k...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_DHT_DHT_H_ #define ZEPHYR_DRIVERS_SENSOR_DHT_DHT_H_ #include <zephyr/device.h> #define DHT_START_SIGNAL_DURATION 18000 #define DHT_SIGNAL<|fim_suffix|>efine DHT_DATA_BITS_NUM 40 st...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ static struct dht20_data am2301b_data_##n; \ \ static const struct dht20_config am2301b_config_##n = {.bus = I2C_DT_SPEC_INST_GET(n)}; \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017 Intel Corporation * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT avago_apds9253 /* @file * @brief driver for APDS9253 ALS/RGB/ */ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <ze...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017 Intel Corporation * Copyright (c) 2018 PHYTEC Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_APDS9253_APDS9253_H_ #define ZEPHYR_DRIVERS_SENSOR_APDS9253_APDS9253_H_ #include <zephyr/drivers/gpio.h> #define APDS9253_MAIN_CTRL_REG ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Daniel Kampert <DanielKampert@kampis-elektroecke.de> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device_runtime.h> #include <zephyr/l...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ndif static int apds9960_sensor_setup(const struct device *dev) { const struct apds9960_config *config = dev->config; uint8_t chip_id; if (i2c_reg_read_byte_dt(&config->i2c, APDS9960_ID_REG, &chip_id)) { LOG_ERR("Failed reading chip id"); return -EIO; } if (!((chip_id == APDS9960_ID_1...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017 Intel Corporation * Copyright (c) 2018 PHYTEC Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_APDS9960_APDS9960_H_ #define ZEPHYR_DRIVERS_SENSOR_APDS9960_APDS9960_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #i...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include "apds9960.h" extern struct apd...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT asahi_kasei_ak8975 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> #define AK8975_REG_ADJ_DATA_START 0x10 #define AK8975_MEASURE_TIME_US 9000 #define AK8975_MICRO_GAUSS_PER_BIT 3000 struct ak8975_data { int16_t x_sample; int16_t y_sample; int16_t z_sample; uint8_t x_adj; uint8_t y_adj; uint8_t z_adj; }; struct ak8975_config { struct i2c_dt_spec i2c; }; #end...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ &akm09918c_config_##inst, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, &akm09918c_driver_api); DT_INST_FOREACH_STATUS_OKAY(AKM09918C_DEFINE) <|fim_prefix|>/* * Copyright (c) 2023 Google LLC * Copyright (c) 2024 Florian Weber <Florian.Weber@live.de> * SPDX-Lic...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>er_header header; struct __packed { uint8_t st1; int16_t data[3]; uint8_t tmps; /* not used - only for padding */ uint8_t st2; /* not used but includes overflow data */ } reading; }; void akm09918_async_fetch(struct k_work *work); int akm09918c_get_decoder(const struct device *dev, const str...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * Copyright (c) 2024 Croxel Inc. * Copyright (c) 2024 Florian Weber <Florian.Weber@live.de> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/rtio/rtio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/sys/byteo...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #include "akm09918c.h" #define DT_DRV_COMPAT asahi_kasei_akm09918c static int akm09918c_decoder_get_frame_count(const uint8_t *buffer, struct sensor_chan_spec chan_spec, uint16_t *frame_count) { ARG_UNUS...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>function only supports setting single channels, so skip MAGN_XYZ */ default: return -ENOTSUP; } /* Set the ST1 register to show we have data */ data->reg[AKM09918C_REG_ST1] |= AKM09918C_ST1_DRDY; /* Convert fixed-point Gauss values into microgauss and then into its bit representation */ int32_t ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_AKM09918C_AKM09918C_EMUL_H #define ZEPHYR_DRIVERS_SENSOR_AKM09918C_AKM09918C_EMUL_H #include <zephyr/drivers/emul.h> /** * @brief Set one or more register values * * @param target The target emulator to mo...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>R_AKM09918C_AKM09918C_REG_H */ <|fim_prefix|>/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_AKM09918C_AKM09918C_REG_H #define ZEPHYR_DRIVERS_SENSOR_AKM09918C_AKM09918C_REG_H #include <zephyr/sys/util_macro.h> #define AKM09918C_REG_WIA1 0x00...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> return TSEN_DEFAULT_OFFSET; } return val & TSEN_EFUSE_TRIM_VALUE_MASK; #elif defined(CONFIG_SOC_SERIES_BL70X) || defined(CONFIG_SOC_SERIES_BL70XL) || \ defined(CONFIG_SOC_SERIES_BL60X) uint32_t val; int ret; ret = otp_read(efuse, TSEN_EFUSE_ENABLE_REG, &val, sizeof(uint32_t))...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bosch_bma280 #include <zephyr/drivers/i2c.h> #include <zephyr/init.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/__assert.h> #include <zephyr/logging/log.h> #include "bma280.h" L...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>PE_TH 0x28 #define BMA280_REG_ACCEL_X_LSB 0x2 #define BMA280_REG_ACCEL_Y_LSB 0x4 #define BMA280_REG_ACCEL_Z_LSB 0x6 #if DT_INST_PROP(0, is_bmc150) #define BMA280_ACCEL_LSB_BITS 4 #define BMA280_ACCEL_LSB_SHIFT 4 #else #define BMA280_ACCEL_LSB_BITS 6 #define BMA280_ACCEL_LSB_SHIFT 2 #endif #defin...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ld not disable data ready interrupt"); return -EIO; } drv_data->any_motion_handler = handler; if (handler == NULL) { return 0; } drv_data->any_motion_trigger = trig; /* enable any-motion interrupt */ if (i2c_reg_update_byte_dt(&config->i2c, BMA280_REG_INT_EN_0, BMA280...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMA4xx 3-axis accelerometer driver * * Copyright (c) 2023 Google LLC * Copyright (c) 2024 Croxel Inc. * Copyright (c) 2024 Cienet * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bosch_bma4xx #include <zephyr/init.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>a4xx_config { int (*bus_init)(const struct device *dev); const union bma4xx_bus_cfg bus_cfg; uint8_t bus_type; const struct gpio_dt_spec gpio_interrupt; }; /** Used to implement bus-specific R/W operations. See bma4xx_i2c.c and * bma4xx_spi.c. */ struct bma4xx_hw_operations { int (*read_data)(co...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>to use * non-latch mode instead. * Reference: * https://community.bosch-sensortec.com/mems-sensors-forum-jrmujtaw/post/bma456-sends-multiple-fifo-interrupt-bma4-fifo-wm-int-vWCT2Uz7Alv6flK */ res |= dev_data->hw_ops->write_reg(dev, BMA4XX_REG_INT_LATCH, 0); __ASSERT(res == 0, "%s could not enabl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>} } buffer += size; } *frame_count = count; return 0; } static int bma4xx_decoder_get_size_info(struct sensor_chan_spec ch, size_t *base_size, size_t *frame_size) { switch (ch.chan_type) { case SENSOR_CHAN_ACCEL_X: case SENSOR_CHAN_ACCEL_Y: case SENSOR_CHAN_ACCEL_Z: case SENSOR_CHAN_A...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>fifo_data { struct bma4xx_decoder_header header; uint8_t int_status; uint16_t accel_odr: 4; uint16_t fifo_count: 10; uint16_t reserved: 1; } __attribute__((__packed__)); struct bma4xx_encoded_data { struct bma4xx_decoder_header header; uint8_t accel_xyz_raw_data[6]; #ifdef CONFIG_BMA4XX_TEMPERATUR...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> BMA4XX_BIT_FIFO_HEADER_CONTROL BIT(6) #define BMA4XX_BIT_FIFO_HEADER_REGULAR BIT(7) /* fh_parm, control */ #define BMA4XX_BIT_FIFO_HEADER_SENSORTIME BIT(2) #define BMA4XX_BIT_FIFO_HEAD_OVER_READ_MSB BIT(5) /* * Other constants */ /* BMA4xx FIFO Length definition */ #define BMA4XX_FIFO_HEADER_LENGTH...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> case SENSOR_CHAN_ACCEL_XYZ: break; default: return -ENOTSUP; } struct bma4xx_emul_data *data = target->data; int16_t upper_bound_scale = (BIT(11) - 1); switch (data->regs[BMA4XX_REG_ACCEL_RANGE]) { case BMA4XX_RANGE_2G: *shift = 5; *upper = (q31_t)(2 * 9.80665 * upper_bound_scale * BIT(...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Google LLC * SPDX-Lic<|fim_suffix|> /** * Return the current interrupt configuration. * * Provided pointers are out-parameters for the INT1_IO_CTRL register and * whether interrupts are in latched mode. The return value is the current value * of the INT_MAP_DATA register. ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMA4xx 3-axis accelerometer driver * * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bosch_bma4xx #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #include "bma4xx.h" #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) LOG_MODULE_DECLA...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ret = gpio_pin_configure_dt(&cfg->gpio_interrupt, GPIO_INPUT); if (ret < 0) { LOG_ERR("Failed to configure gpio pin"); return ret; } gpio_init_callback(&data->gpio_cb, bma4xx_gpio_callback, BIT(cfg->gpio_interrupt.pin)); ret = gpio_add_callback(cfg->gpio_interrupt.port, &data->gpio_cb); if (ret...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Cienet * <|fim_suffix|>success, negative error code otherwise */ int bma4xx_init_interrupt(const struct device *dev); /** * @brief Enable the trigger gpio interrupt1 * * @param dev bma4xx device pointer * @param new_cfg New configuration to use for the device * @return int...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Cienet * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bosch_bma4xx #include <zephyr/drivers/sensor.h> #include <zephyr/rtio/work.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/sensor_clock.h> #include "bma4xx.h" #include "bma4xx_decoder.h" #i...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>sor, struct rtio_iodev_sqe *iodev_sqe); void bma4xx_fifo_event(const struct device *dev); #endif /* ZEPHYR_DRIVERS_SENSOR_BMA4XX_RTIO_H_ */ <|fim_prefix|>/* * Copyright (c) 2023 Google LLC * Copyright (c) 2024 Cienet * <|fim_middle|> * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_S...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>DROP) { /* Flush the FIFO */ struct rtio_sqe *write_signal_path_reset = rtio_sqe_acquire(r); uint8_t write_buffer[] = { FIELD_GET(BMA4XX_REG_ADDRESS_MASK, BMA4XX_REG_CMD), BMA4XX_CMD_FIFO_FLUSH, }; rtio_sqe_prep_tiny_write(write_signal_path_reset, iodev, RTIO_PRIO_NORM, writ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t8_t value) { return -ENOTSUP; } static const struct bma4xx_hw_operations spi_ops = { .read_data = bma4xx_spi_read_data, .write_data = bma4xx_spi_write_data, .read_reg = bma4xx_spi_read_reg, .write_reg = bma4xx_spi_write_reg, .update_reg = bma4xx_spi_update_reg, }; int bma4xx_spi_init(const stru...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* bmc150_magn.c - Driver for Bosch BMC150 magnetometer sensor */ /* * Copyright (c) 2016 Intel Corporation * * This code is based on bmm050.c from: * https://github.com/BoschSensortec/BMM050_driver * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bosch_bmc150_magn #include <zeph...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* sensor_bmc150_magn.h - header file for BMC150 magnetometer sensor driver */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMC150_MAGN_BMC150_MAGN_H_ #define ZEPHYR_DRIVERS_SENSOR_BMC150_MAGN_BMC150_MAGN_H_ #include <zephyr/types.h>...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>CONFIG_BMC150_MAGN_TRIGGER_THREAD_STACK, bmc150_magn_thread_main, data, NULL, NULL, K_PRIO_COOP(10), 0, K_NO_WAIT); if (!gpio_is_ready_dt(&config->int_gpio)) { LOG_ERR_DEVICE_NOT_READY(config->int_gpio.port); return -ENODEV; } gpio_pin_configure_dt(&config->int_gpio, GPIO_INT_EDGE_TO_ACT...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* bme280.c - Driver for Bosch BME280 temperature and pressure sensor */ /* * Copyright (c) 2016, 2017 Intel Corporation * Copyright (c) 2017 IpTronix S.r.l. * Copyright (c) 2021 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016, 2017 Intel Corporation * Copyright (c) 2017 IpTronix S.r.l. * Copyright <|fim_suffix|>nt32_t comp_press; uint32_t comp_humidity; }; struct bme280_data { /* Compensation parameters. */ uint16_t dig_t1; int16_t dig_t2; int16_t dig_t3; uint16_t dig_p1; int16_t dig_p2; int...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> rc); return; } rtio_iodev_sqe_ok(iodev_sqe, 0); } void bme280_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe) { struct rtio_work_req *req = rtio_work_req_alloc(); if (req == NULL) { LOG_ERR("RTIO work item allocation failed. Consider to increase " "CONFIG_RTIO_WORKQ_POOL_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Intel Corporation * SPDX-License-Identifier: Apache-2.0 */ #include "bme280.h" #include <math.h> static int bme280_decoder_get_frame_count(const uint8_t *buffer, struct sensor_chan_spec chan_spec, uint16_t *frame_count) { const struct bme280_encoded_data *edata = (cons...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uint8_t val) { return i2c_reg_write_byte_dt(&bus->i2c, reg, val); } const struct bme280_bus_io bme280_bus_io_i2c = { .check = bme280_bus_check_i2c, .read = bme280_reg_read_i2c, .write = bme280_reg_write_i2c, }; #endif /* BME280_BUS_I2C */ <|fim_prefix|>/* * Copyright (c) 2016, 2017 Intel Corporation...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016, 2017 Intel Corporation * Copyright (c) 2017 IpTronix S.r.l. * Copyright (c) 2021 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-spec<|fim_suffix|>(&bus->spi) ? 0 : -ENODEV; } static int bme280_reg_read_spi(const union bme280_bus *bus, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Bosch Sensortec GmbH * Copyright (c) 2022, Leonard Pollak * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gpio.h> #include <zephyr/init.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/__assert.h> #include <zephyr/driver...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>d CONFIG_BME680_FILTER_64 #define BME680_FILTER (6 << 2) #elif defined CONFIG_BME680_FILTER_128 #define BME680_FILTER (7 << 2) #endif #define BME680_MODE_SLEEP 0 #define BME680_MODE_FORCED 1 #define BME680_CTRL_MEAS_VAL (BME680_PRESS_OVER...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Alif Semiconductor * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <string.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/logging/log.h> #include <zephyr/rtio/rtio.h> #include <zephyr/sys/mpsc_lockfree.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Alif Semiconductor * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include "bme680.h" static inline int32_t bme680_q31_conv(int64_t val, int64_t mult, int32_t div) { return (int32_t)((val * mult) / div); } /* Get frame count for specified cha...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016, 2017 Intel Corporation * Copyright (c) 2017 IpTronix S.r.l. * Copyright (c) 2021 Nordic Semiconductor ASA * Copyright (c) 2022, Leonard Pollak * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific functionality for BME680s accessed via I2C. */ #include "bme680.h"...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; } static int bme680_reg_write_spi(const struct device *dev, uint8_t reg, uint8_t val) { const struct bme680_config *config = dev->config; int err; uint8_t cmd[] = { reg & BME680_SPI_WRITE_MSK, val }; const struct spi_buf tx_buf = { .buf = cmd, .len = sizeof(cmd) }; const struct spi_buf_se...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>{ return -EIO; } bmg160->scale = BMG160_RANGE_TO_SCALE(range_dps); return 0; case SENSOR_ATTR_SAMPLING_FREQUENCY: idx = bmg160_is_val_valid(val->val1, bmg160_sampling_freq_map, BMG160_SAMPLING_FREQ_MAP_SIZE); if (idx < 0) { return -ENOTSUP; } /* * The sampling fre...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> uint8_t reg_addr, uint8_t *byte); int bmg160_update_byte(const struct device *dev, uint8_t reg_addr, uint8_t mask, uint8_t value); int bmg160_write_byte(const struct device *dev, uint8_t reg_addr, uint8_t data); int bmg160_slope_config(const struct device *dev, enum senso...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMG160 gyro driver, trigger implementation * * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * http://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMG160-DS000-09.pdf */ #include <zephyr/kernel.h> #include <zephyr/drivers/sensor...
fim
zephyrproject-rtos/zephyr
c
/* Bosch BMI08X inertial measurement unit driver * * Copyright (c) 2022 Meta Platforms, Inc. and its affiliates * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include "bmi08x.h" /* * Output data rate map with allowed frequencies: * freq = freq_int + freq_milli / 1000 * * Since we don'...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMI08X inertial measurement unit header * * Copyright (c) 2022 Meta Platforms, Inc. and its affiliates * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI08X_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI08X_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h>...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ely */ ret = bmi08x_accel_byte_write(dev, BMI08X_REG_ACCEL_PWR_CTRL, BMI08X_ACCEL_POWER_DISABLE); if (ret < 0) { LOG_ERR("Cannot deactivate accel."); return ret; } /* required when switching power modes */ k_msleep(BMI08X_POWER_CONFIG_DELAY); /* disable config loading */ ret = bmi08x_accel_byte...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_ACCEL_ASYNC_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_ACCEL_ASYNC_H_ #include <zephyr/device.h> #include <zephyr/rtio/rtio.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>8X_ACCEL_DECODER_H_ #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include "bmi08x.h" void bmi08x_accel_encode_header(const struct device *dev, struct bmi08x_accel_encoded_data *edata, bool is_streaming, uint16_t buf_len); int bmi08x_accel_decoder_get(const struct device *dev, const ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; struct bmi08x_accel_data *data = dev->data; struct rtio_iodev_sqe *iodev_sqe = data->stream.iodev_sqe; struct bmi08x_accel_encoded_data *edata; uint32_t buf_len; int ret; ret = rtio_sqe_rx_buf(iodev_sqe, 0, 0, (uint8_t **)&edata, &buf_len); if (ret < 0 || buf_len == 0 || edata->header.fifo_len =...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI08X_<|fim_suffix|>_BMI08X_BMI08X_ACCEL_STREAM_H_ */ <|fim_middle|>BMI08X_ACCEL_STREAM_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_ACCEL_STREA...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMI08X inertial measurement unit driver, trigger implementation * * Copyright (c) 2022 Meta Platforms, Inc. and its affiliates * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device.h> #include <zephyr/kernel...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include "bmi08x_bus.h" static uint8_t dummy_byte_val; int bmi08x_prep_reg_read_rtio_async(const struct bmi08x_rtio_bus *bus, uint8_t reg, uint8_t *buf, size_t size, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>08x_reg_write_rtio(const struct bmi08x_rtio_bus *bus, uint8_t reg, const uint8_t *buf, int size); #endif /* ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_RTIO_BUS_H_ */ <|fim_prefix|>/* * Copyright (c<|fim_middle|>) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, 0x18, 0x00, 0x80, 0x2e, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Bosch BMI08X inertial measurement unit driver * * Copyright (c) 2022 Meta Platforms, Inc. and its affiliates * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/pm/device.h> #include <zephyr/init.h> #include <zeph...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>RS_SENSOR_BMI08X_BMI08X_GYRO_ASYNC_H_ #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/rtio/rtio.h> void bmi08x_gyro_async_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); #endif /* ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_GYRO_ASYNC_H_ */ <|fim_prefix|>/* * Copyrig...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>R_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ <|fim_middle|>#ifndef ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_GYRO_DECODER_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_GYRO_DECODER_H_ #include <zephyr/dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <stdint.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_GYRO_STREAM_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI08X_BMI08X_GYRO_STREAM_H_ #include <zephyr/device.h> #include <zephyr/rtio/rtio.h> int bmi08x_gyro_stream_init(const struct device *dev); void...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_TRIGGER_GLOBAL_THREAD) data->work.handler = bmi08x_gyr_work_handler; data->dev = dev; #endif gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT); gpio_init_callback(&data->gpio_cb, bmi08x_gyr_gpio_callback, BIT(cfg->int_gpio.pin)); ret = gpio_add_callback(cfg->int_gpio.port, &data->gpio_cb); if (...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>turn ret; } #if defined(CONFIG_BMI160_TRIGGER) #define BMI160_TRIGGER_CFG(inst) \ .interrupt = GPIO_DT_SPEC_INST_GET(inst, int_gpios), #else #define BMI160_TRIGGER_CFG(inst) #endif #define BMI160_DEVICE_INIT(inst) \ IF_ENABLED(CONFIG_PM_DEVICE_RUNTIME, (PM_DEVICE_DT_INST_DEFINE(inst, bmi160_pm)...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>fine BMI160_INT_STEP_NOMO_Z_EN BIT(2) #define BMI160_INT_STEP_NOMO_Y_EN BIT(1) #define BMI160_INT_STEP_NOMO_X_EN BIT(0) #define BMI160_INT_STEP_NOMO_MASK (BIT(0) | BIT(1) | BIT(2)) /* BMI160_REG_INT_OUT_CTRL */ #define BMI160_INT2_OUT_EN BIT(7) #define BMI160_INT2_OD BIT(6) #define BMI160_INT2_LVL B...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>NT1_EDGE_CTRL); } <|fim_prefix|>/* Bosch BMI160 inertial measurement unit driver, trigger implementation * * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include "bmi16...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2020 Google LLC * * SPDX-License-Identifier: Apache-2.0 * * Emulator for the Bosch BMI160 accelerometer / gyro. This supports basic * init and reading of canned samples. It supports both I2C and SPI buses. */ #define DT_DRV_COMPAT bosch_bmi160 #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ad * @return False otherwise */ __maybe_unused static bool emul_bmi160_i2c_is_reading_reg(struct i2c_msg *msgs, int num_msgs, uint32_t reg) { if (!emul_bmi160_i2c_is_touching_reg(msgs, num_msgs, reg)) { return false; } return i2c_is_read_op(&msgs[1]); } /** * @brief Check if I2C messages...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Bosch Sensortec GmbH * Copyright (c) 2022 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #define DT<|fim_suffix|>(odr < 50.0)) { reg = BMI270_ACC_ODR_25_HZ; } else if ((odr >= 50.0) && (odr < 100.0)) { reg = BMI270_ACC_ODR_50_HZ; } else if ((odr >= ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2021 Bosch Sensortec GmbH * Copyright (c) 2022 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI270_BMI270_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI270_BMI270_H_ #include <stdint.h> #include <zephyr/device.h> #include <zephyr/sys/atomic.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Bosch Sensortec GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef BMI270_BMI270_CONFIG_FILE_H_ #define BMI270_BMI270_CONFIG_FILE_H_ /* Source : https://github.com/BoschSensortec/BMI270-Sensor-API/blob/v2.63.1/bmi270_maximum_fifo.c#L51 */ static const uint8_t bmi270_conf...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> I2C devices. * Maximum write length is BMI270_WR_LEN + 1 byte for address. */ uint8_t buf[1 + BMI270_WR_LEN]; if (len > BMI270_WR_LEN) { return -EINVAL; } buf[0] = start; if (len > 0) { memcpy(&buf[1], data, len); } return i2c_write_dt(&bus->i2c, buf, 1 + len); } static int bmi270_bus_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific functionality for BMI270s accessed via SPI. */ #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include "bmi270.h" LOG_M<|fim_suffix|> }; /* First byte we read should be dis...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Elektronikutvecklingsbyrån EUB AB * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(bmi270); #include "bmi270.h" enum { INT_FLAGS_INT1, INT_FLAGS_INT2, }; static void bmi270_raise_int_flag(const struct device *dev, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>aults: 8g accel, 2000dps gyro */ data->acc_full_scale = 8000; /* ±8G in milli-G */ data->gyro_full_scale = 2000000; /* ±2000dps in micro-dps */ ret = bosch_bmi323_bus_init(dev); if (ret < 0) { LOG_WRN("Failed to re-init bus"); return ret; } ret = bosch_bmi323_enable_feature_engine(dev); ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * Copyright (c) 2025 Alif Semiconductor * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_BMI323_BMI323_H_ #define ZEPHYR_DRIVERS_SENSOR_BMI323_BMI323_H_ #include <zephyr/sys/util.h> #include <zephyr/types.h> #include <zephyr/devi...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025 Alif Semiconductor * * SPDX-License-Identifier: Apache-2.0 */ #include <string.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/logging/log.h> #include <zephyr/rtio/rtio.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/atomic.h> #inc...
fim
zephyrproject-rtos/zephyr
c