text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>_t *rbuffer, uint32_t rlen) { return i2c_burst_read_dt(&bus->i2c, reg, (uint8_t *)rbuffer, rlen); } static int icp201xx_write_reg_i2c(const union icp201xx_bus *bus, uint8_t reg, uint8_t *wbuffer, uint32_t wlen) { return i2c_burst_write_dt(&bus->i2c, reg, wbuffer, wlen); } const struct icp2...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>write_dt(&bus->spi, &tx); return rc; } return 0; } const struct icp201xx_bus_io icp201xx_bus_io_spi = { .read = icp201xx_read_reg_spi, .write = icp201xx_write_reg_spi, }; <|fim_prefix|>/* * Copyright (c) 2025 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific function...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/gpio.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT invensense_mpu6050 #include <zephyr/drivers/i2c.h> #include <zephyr/init.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "mpu60...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> /* Device type, uses the correct offsets for a particular device */ enum mpu6050_device_type { DEVICE_TYPE_MPU6050 = 0, DEVICE_TYPE_MPU6500, }; struct mpu6050_data { int16_t accel_x; int16_t accel_y; int16_t accel_z; uint16_t accel_sensitivity_shift; int16_t temp; int16_t gyro_x; int16_t gyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "mpu6050.h" LOG_MODULE_D...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021, Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "mpu9250.h" #include "ak8963.h" LOG_MODULE_DECLARE(MPU9250, CONFIG_SENSOR_LOG_LEVEL); #define I2...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021, Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MPU9250_AK8963_H_ #define ZEPHYR_DRIVERS_SENSOR_MPU9250_AK8963_H_ #include <stdint.h> #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> int ak8963_convert_magn(st...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> SENSOR_PI * 10) / (sensitivity_x10 * 180U); val->val1 = conv_val / 1000000; val->val2 = conv_val % 1000000; } /* see "Temperature Measurement" section from register map description */ static inline void mpu9250_convert_temp(struct sensor_value *val, int16_t raw_val) { /* Temp[*C] = (raw / s...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021, Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MPU9250_MPU9250_H_ #define ZEPHYR_DRIVERS_SENSOR_MPU9250_MPU9250_H_ #include <stdint.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c....
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_interrupt_configure_dt(&cfg->int_pin, GPIO_INT_DISABLE); if (ret < 0) { LOG_ERR("Disabling gpio interrupt failed with err: %d", ret); return; } #if defined(CONFIG_MPU9250_TRIGGER_OWN_THREAD) k_sem_give(&drv_data->gpio_sem); #elif defined(CONFIG_MPU9250_TRIGGER_GLOBAL_THREAD) k_work_submit(&drv_d...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/pm/device.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/__assert.h> <...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>stack, CONFIG_TAD2144_THREAD_STACK_SIZE); struct k_thread thread; struct k_sem gpio_sem; #endif #ifdef CONFIG_TAD2144_TRIGGER_GLOBAL_THREAD struct k_work work; #endif }; struct tad214x_config { union tad214x_bus bus; const struct tad214x_bus_io *bus_io; struct gpio_dt_spec gpio_int; struct gpio_dt...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ /* * B<|fim_suffix|>i2c, .write = tad214x_write_reg_i2c, }; #endif /* CONFIG_I2C */ <|fim_middle|>us-specific functionality for TAD214x accessed via I2C. */ #include "tad214x_drv.h" #if CONFIG_I2C #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2026 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific functionality for TAD214X accessed via SPI. */ #include "tad214x_drv.h" #if CONFIG_SPI #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(TAD214X_SPI, CONFIG_SENSOR_LOG_LEVEL); #define TAD214X_SERIF_SPI_REG_W...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/gpio.h> #inc...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT hoperf_th02 #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/sensor.h> #include <z...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TH02_TH02_H_ #define ZEPHYR_DRIVERS_SENSOR_TH02_TH02_H_ #include <zephyr/device.h> #include <zephyr/sys/util.h> #define TH02_REG_STATUS 0x00 #define TH02_R<|fim_suffix|>ruct th...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Linumiz * * SPDX-License-Identifier: Apache-2.0 * * Relevant documents: * - BQ27441 * Datasheet: https://www.ti.com/lit/gpn/bq27441-g1 * Technical reference manual: https://www.ti.com/lit/pdf/sluuac9 * - BQ27421 * Datasheet: https://www.ti.com/lit/gpn/bq27421-g1 * ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Linumiz * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZE<|fim_suffix|>VG_CURRENT 0x10 /* AverageCurrent() */ #define BQ274XX_CMD_STDBY_CURRENT 0x12 /* StandbyCurrent() */ #define BQ274XX_CMD_MAX_CURRENT 0x14 /* MaxLoadCurrent() */ #define BQ274XX_CMD_AVG_POWER ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> 0; } int bq274xx_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) { const struct bq274xx_config *config = dev->config; struct bq274xx_data *data = dev->data; int ret; if (trig->type != SENSOR_TRIG_DATA_READY) { return -ENOTSUP; } ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uct device *dev, enum sensor_channel chan, struct sensor_value *val) { const struct fdc1004_config *cfg = dev->config; const struct fdc1004_data *data = dev->data; enum fdc1004_channel priv_chan = (enum fdc1004_channel)chan; int ch; if (priv_chan < FDC1004_CHAN_CIN1 || priv_chan ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Zephyr Project Developers * * SPDX-License-Identifier: Apache-2.0 * * TI FDC1004 — registers and channel definitions. */ #ifndef DRIVERS_SENSOR_FDC1004_H_ #define DRIVERS_SENSOR_FDC1004_H_ #include <|fim_suffix|>FDC1004_REG_CONF_MEAS3 0x0A #define FDC1004_REG_CONF_MEAS4 0...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* fdc2x1x.c - Driver for the Texas Instruments FDC2X1X */ /* * Copyright (c) 2020 arithmetics.io * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_fdc2x1x #include <zephyr/device.h> #include <zephyr/pm/device.h> #include <zephyr/sys/util.h> #include <zephyr/logging/log.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 arithmetics.io * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_FDC2X1X_FDC2X1X_H_ #define ZEPHYR_DRIVERS_SENSOR_FDC2X1X_FDC2X1X_H_ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #define PI ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>2x1x_get_status(dev, &status); out: gpio_pin_interrupt_configure_dt(&cfg->intb_gpio, GPIO_INT_EDGE_TO_ACTIVE); return ret; } int fdc2x1x_init_interrupt(const struct device *dev) { struct fdc2x1x_data *drv_data = dev->data; const struct fdc2x1x_config *cfg = dev->config; int ret; k_mutex_init(&drv...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Leonard Pollak * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_ina219 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/pm/device.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>turn 84; case 1: return 148; case 2: return 276; case 3: return 532; case 9: return 1060; case 10: return 2013; case 11: return 4260; case 12: return 8510; case 13: return 17020; case 14: return 34050; case 15: return 68100; default: return -EINVAL; } } #endif /* ZEPHYR_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ /* TODO: Add functionality for Trigger. */ #define DT_DRV_COMPAT ti_ina226 #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/dt-bindings/sensor/ina226.h> #include...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ne INA226_REG_CURRENT 0x04 #define INA226_REG_CALIB 0x05 #define INA226_REG_MASK 0x06 #define INA226_REG_ALERT 0x07 #define INA226_REG_MANUFACTURER_ID 0xFE #define INA226_REG_DEVICE_ID 0xFF #endif /* ZEPHYR_DRIVERS_SENSOR_INA2XX_INA226_H_ */ <|fim_prefix|>/* * Copyright 2024 NXP * Copyright 2...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>b = INA230_BUS_VOLTAGE_UV_LSB, \ .power_scale = INA230_POWER_SCALING, \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, alert_gpios), \ (INA230_CFG_IRQ(inst)), ())}; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ert_limit; }; int ina230_trigger_mode_init(const struct device *dev); int ina230_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler); #endif /* ZEPHYR_DRIVERS_SENSOR_INA2XX_INA230_H_ */ <|fim_prefix|>/* * Copyright 2021 The Chromium OS Aut...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2021 The Chromium OS Authors * Copyright 2021 Grinn * * SPDX-License-Identifier: Apache-2.0 */ #include "ina230.h" #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(INA230, CONFIG_SENSOR_LOG_LEVEL); static void ina230_gpio_call...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2021 Grinn * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ #include "ina237.h" #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/dt-bindings/sensor/ina237.h> #include <zephyr/sys/byteorder.h> LOG_MODULE_DECLARE(INA2XX, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>INA237_REG_SUVL 0x0D #define INA237_REG_BOVL 0x0E #define INA237_REG_BUVL 0x0F #define INA237_REG_TEMP_LIMIT 0x10 #define INA237_REG_PWR_LIMIT 0x11 #define INA237_REG_MANUFACTURER_ID 0x3E #define INA228_REG_SHUNT_TEMPCO 0x03 #define INA228_REG_ENERGY 0x09 #define INA228_REG_CHARGE...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>urn -ENOTSUP; } } <|fim_prefix|>/* * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ #include "ina2xx_common.h" static int ina2xx_set_adc_config(const struct device *dev, const struct sensor_value *val) { const struct ina2xx_config *config = dev->config; uint16_t data ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2021 Grinn * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ #include "ina2xx_common.h" #include <zephyr/sys/byteorder.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(INA2XX, CONFIG_SENSOR_LOG_LEVEL); int ina2xx_reg_read_24(const struct i2c_dt_spe...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nt8_t power[3]; uint8_t die_temp[2]; uint8_t energy[5]; uint8_t charge[5]; }; int ina2xx_reg_read_24(const struct i2c_dt_spec *bus, uint8_t reg, uint32_t *val); int ina2xx_reg_read_16(const struct i2c_dt_spec *bus, uint8_t reg, uint16_t *val); int ina2xx_reg_write(const struct i2c_dt_spec *bus, uint8_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ #include "ina2xx_common.h" static int ina2xx_fetch_bus_voltage(const struct device *dev) { #ifdef CONFIG_INA2XX_HAS_CHANNEL_BUS_VOLTAGE const struct ina2xx_config *config = dev->config; const struct ina2xx_channel *ch...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2025 Nova Dynamics LLC * * SPDX-License-Identifier: Apache-2.0 */ #include "ina2xx_common.h" #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> static int ina2xx_get_bus_voltage(const struct device *dev, struct sensor_value *val) { #ifdef CONFIG_INA2XX_HAS_CHANNEL_BUS_VOLTAGE const st...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ck(&trigg->gpio_cb, ina2xx_gpio_callback, BIT(alert_gpio->pin)); ret = gpio_add_callback(alert_gpio->port, &trigg->gpio_cb); if (ret < 0) { LOG_ERR("Could not set gpio callback"); return ret; } return gpio_pin_interrupt_configure_dt(alert_gpio, GPIO_INT_EDGE_FALLING); } <...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2022 Grinn * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_INA2XX_TRIGGER_H_ #define ZEPHYR_DRIVERS_SENSOR_INA2XX_TRIGGER_H_ #include <zephyr/driver<|fim_suffix|>er_handler_t handler_alert; const struct sensor_trigger *trig_alert; }; int ina2xx_trigger_mode_...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_ina3221 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/pm/device.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/types.h> #include <zephyr/drivers/gpio.h> #define INA3221_CONFIG 0x00 #define INA3221_SHUNT_V1 0x01 #define INA3221_BUS_V1 0x02 #define INA3221_SHUNT_V2 0x03 #define INA3221_BUS_V2 0x04 #define INA3221_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>: return -ENOTSUP; } return ina7xx_reg_field_update(dev, INA7xx_REG_ADC_CONFIG, INA7xx_MODE, reg_val); } #endif /* CONFIG_PM_DEVICE */ static DEVICE_API(sensor, ina7xx_api) = { .sample_fetch = ina7xx_sample_fetch, .channel_get = ina7xx_channel_get, }; #define INA7xx_INIT(n) ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_INA7xx_INA7xx_H_ #define ZEPHYR_DRIVERS_SENSOR_INA7xx_INA7xx_H_ /* Config register shifts and masks */ #define INA7xx_REG_CONFIG 0x00 #define INA7xx_RST_MASK 0x1 #define INA7xx_RST_SHIFT ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Calian Advanced Technologies * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT national_lm95234 #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/lm95234....
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> return 0; } int opt300x_init(const struct device *dev) { if (opt300x_chip_init(dev) < 0) { return -EINVAL; } #ifdef CONFIG_OPT300X_TRIGGER if (opt300x_init_interrupt(dev)) { LOG_ERR("Failed to initialize interrupt"); return -EIO; } #endif return 0; } #define OPT300X_DEFINE(inst, partno) ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>SENSOR_OPT300X_ */ <|fim_prefix|>/* * Copyright (c) 2019 Actinius * Copyright (c) 2025 Bang & Olufsen A/S * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_OPT300X_H_ #define ZEPHYR_DRIVERS_SENSOR_OPT300X_H_ #include <zephyr/sys/util.h> #include <zephyr/drivers/i2c.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t(&dat->thread, "opt300x_trigger"); #elif defined(CONFIG_OPT300X_TRIGGER_GLOBAL_THREAD) k_work_init(&dat->work_int, opt300x_int_work); #endif return 0; } int opt300x_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) { const struct opt300x_c...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_hdc #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/util.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TI_HDC_TI_HDC_H_ #define ZEPHYR_DRIVERS_SENSOR_TI_HDC_TI_HDC_H_ #include <zephyr/kernel.h> #define TI_HDC_REG_TEMP 0x0 #define TI_HDC_REG_HUMIDITY 0x1 #define TI_HDC_REG_MANUFID 0xFE #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>> 10; break; default: return -ENOTSUP; } return 0; } static DEVICE_API(sensor, ti_hdc20xx_api_funcs) = { .sample_fetch = ti_hdc20xx_sample_fetch, .channel_get = ti_hdc20xx_channel_get, }; static int ti_hdc20xx_reset(const struct device *dev) { const struct ti_hdc20xx_config *config = dev->con...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Psicontrol N.V. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_hdc302x #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/sys/crc.h> #include...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Michal Morsisko * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_tmag5170 #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include <zephyr/devicetree.h> #include <zephyr/pm/device.h> #include <zephyr/sys/byteord...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>defined(CONFIG_TMAG5170_TRIGGER) struct gpio_dt_spec int_gpio; #endif }; struct tmag5170_data { uint8_t chip_revision; uint16_t x; uint16_t y; uint16_t z; uint16_t temperature; uint16_t angle; #if defined(CONFIG_TMAG5170_TRIGGER) struct gpio_callback gpio_cb; sensor_trigger_handler_t handler_drd...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Michal Morsisko * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_tmag5170 #include <zephyr/kernel.h> #include <z<|fim_suffix|>_THREAD) k_sem_init(&data->sem, 0, 1); k_thread_create(&data->thread, data->thread_stack, CONFIG_TMAG5170_THREAD_STACK_SIZE, t...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>raw_value data read from the device * @param[out] temperature holds the result data after the operation */ static inline void tmag5273_temperature_convert(int64_t raw_value, struct sensor_value *temperature) { const int64_t value = (TMAG5273_TEMPERATURE_T_SENS_T0 + ((raw_value - TMAG5273_TEMPERATU...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>273_OTP_CRC_ER_POS 1 #define TMAG5273_VCC_UV_ER_POS 0 #define TMAG5273_INTB_RB_MSK GENMASK(4, 4) #define TMAG5273_OSC_ER_MSK GENMASK(3, 3) #define TMAG5273_INT_ER_MSK GENMASK(2, 2) #define TMAG5273_OTP_CRC_ER_MSK GENMASK(1, 1) #define TMAG5273_VCC_UV_ER_MSK GENMASK(0, 0) #define TMAG5273_INTB_PIN_HIGH (...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>T_GET_OR(inst, int_gpios, { 0 }),)) \ }; \ \ SENSOR_DEVICE_DT_INST_DEFINE(inst, tmp007_init, NULL, \ &tmp007_data_##inst, &tmp007_config_##inst, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, &tmp007_driver_api); \ DT_INST_FOREACH_STATUS_OKAY(TMP007_DEFINE) <...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TMP007_TMP007_H_ #define ZEPHYR_DRIVERS_SENSOR_TMP007_TMP007_H_ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/util.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_ALERT_EN_BIT) < 0) { LOG_DBG("Failed to enable interrupt pin!"); return -EIO; } drv_data->dev = dev; if (!gpio_is_ready_dt(&cfg->int_gpio)) { LOG_ERR_DEVICE_NOT_READY(cfg->int_gpio.port); return -ENODEV; } gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INT_LEVEL_ACTIVE); gpio_init_callback(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ster value */ integer = (val->val1 << TMP1075_DATA_INTE_SHIFT) & TMP1075_DATA_INTE_MASK; frac = ((val->val2 / TMP1075_TEMP_SCALE) << TMP1075_DATA_FRAC_SHIFT) & TMP1075_DATA_FRAC_MASK; return set_threshold_attribute(dev, TMP1075_REG_THIGH, integer | frac, "SENSOR_ATTR_UPPER_THRES...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler); void tmp1075_trigger_handle_alert(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins); #endif <|fim_prefix|>/* * Copyright (c) 2024 Arrow Electronics. * * SPDX-License-Identifier: Apa...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>pio, struct gpio_callback *cb, gpio_port_pins_t pins) { struct tmp1075_data *drv_data = CONTAINER_OF(cb, struct tmp1075_data, temp_alert_gpio_cb); /* Successful read, call set callbacks */ if (drv_data->temp_alert_handler) { drv_data->temp_alert_handler(drv_data->tmp1075_dev, drv_data->temp_ale...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Jimmy Johnson <catch22@fastmail.net> * Copyright (c) 2022 T-Mobile USA, Inc. * Copyright (c) 2025 Byteflies NV * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_tmp108 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sens...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e hysteresis config 1 bit */ uint16_t CONF_HYS0; /** Temperature hysteresis config 2 bit */ #endif }; #define TI_TMP108_GET_CONF(x, cfg) ((struct tmp108_config *)(x->config))->reg_def.cfg struct tmp108_config { const struct i2c_dt_spec i2c_spec; struct tmp_108_reg_def reg_def; #ifdef CONFIG_TMP108_A...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2021 Jimmy Johnson <catch22@fastmail.net> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include "tmp108.h" LOG_MODULE_DECLARE(TMP108, CONFIG_SENSOR_LOG_LEVEL); void tmp108_trigger_handle_alert(const st...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ue = 0x0000; } else if (val->val1 == 150) { value = TMP112_CONFIG_EM; } else { return -ENOTSUP; } if (tmp112_update_config(dev, TMP112_CONFIG_EM, value) < 0) { LOG_DBG("Failed to set attribute!"); return -EIO; } break; #endif #if CONFIG_TMP112_SAMPLING_FREQUENCY_RUNTIME case SEN...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Innoseis BV * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TMP112_TMP112_H_ #define ZEPHYR_DRIVERS_SENSOR_TMP112_TMP112_H_ #include <zephyr/device.h> #include <zephyr/sys/util.h> #define TMP112_REG_TEMPERATURE 0x00 #define TMP11<|fim_suffix...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>*/ rc = tmp114_device_id_check(dev, &id); if (rc < 0) { return rc; } LOG_INF("Got device ID: %x", id); drv_data->id = id; rc = tmp114_write_config(dev, TMP114_CFGR_CONV, cfg->odr); if (rc < 0) { return rc; } val.val1 = cfg->oversampling ? 1 : 0; val.val2 = 0; rc = tmp114_attr_set(dev, SE...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2019 Centaur Analytics, Inc * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_tmp11x #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device.h> #include <zephyr/drivers/sensor/tmp11x.h> #include <zephyr/dt-bindin...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nt16_t conf); int tmp11x_reg_read(const struct device *dev, uint8_t reg, uint16_t *val); #ifdef CONFIG_TMP11X_TRIGGER int tmp11x_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler); int tmp11x_init_interrupt(const struct device *dev); #endif...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Tobias Meyer <tobiuhg@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_tmp11x #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> #include "tmp11x.h" LOG_MODULE_DECLARE(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ta_##inst; \ static const struct tmp435_config tmp435_config_##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ .external_channel = DT_INST_PROP(inst, external_channel), ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Bittium Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_TMP435_H_ #define ZEPHYR_DRIVERS_SENSOR_TMP435_H_ #define TMP435_CONF_REG_1 0x03 #define TMP435_CONF_REG_1_DATA 0xc4 /* [7]=1 ALERT Masked, [6]=1 Shut Down (one shot mode), [2]=1 −55 C t...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>g->conversion_rate); ret = tmp451_set_conversion_rate(cfg, &init_sensor_val); if (ret < 0) { LOG_ERR("Failed to set conversion rate"); return ret; } /* Set ideality factor correction for remote channel */ ret = i2c_reg_write_byte_dt(&cfg->i2c, TMP451_REG_NC, cfg->ideality_factor); if (ret < 0) ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_OWN_THREAD) K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_TMP451_THREAD_STACK_SIZE); struct k_thread thread; struct k_sem gpio_sem; #elif defined(CONFIG_TMP451_TRIGGER_GLOBAL_THREAD) struct k_work work; #endif #endif /* CONFIG_TMP451_TRIGGER */ }; #ifdef CONFIG_TMP451_TRIGGER int tmp451_trigger_set(con...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nction. * However, we choose not to trigger the remote handler because * technically it's not a threshold trigger. * * If OPEN detection interrupt is desired, likely best to add * a custom trigger for it in the future. */ if (status & TMP451_STATUS_OPEN) { LOG_ERR("Remote diode open...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Prevas A/S * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ist_tsic_xx6 #include <zephyr/device.h> #include <zephyr/drivers/pwm.h> #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include <zephyr/sys/atomic.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Prevas A/S * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.festo.com/media/pim/620/D15000100140620.PDF * */ #define DT_DRV_COMPAT festo_veaa_x_3 #include <stdio.h> #include <zephyr/device.h> #include <zephyr/drivers/adc.h> #include <zephyr/drivers/da...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Juliane Schulze, deveritec GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT vishay_vcnl36825t #include "vcnl36825t.h" #include <stdlib.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/pm/device.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Juliane Schulze, deveritec GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VCNL36825T_VCNL36825T_H_ #define ZEPHYR_DRIVERS_SENSOR_VCNL36825T_VCNL36825T_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/s...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> } rc = gpio_pin_interrupt_configure_dt(&config->int_gpio, GPIO_INT_DISABLE); if (rc < 0) { LOG_ERR("could not set SoC interrupt configuration %d", rc); return rc; } return 0; } <|fim_prefix|>/* * Copyright (c) 2024 deveritec GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_CO...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2020 Richard Osterloh * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT vishay_vcnl4040 #include "vcnl4040.h" #include <zephyr/pm/device.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/logging/log.h> #include <st...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Richard Osterloh * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VCNL4040_VCNL4040_H_ #define ZEPHYR_DRIVERS_SENSOR_VCNL4040_VCNL4040_H_ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #include <zeph...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2020 Richard Osterloh * * SPDX-License-Identifier: Apache-2.0 */ #include "vcnl4040.h" #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(vcnl4040, CONFIG_SENSOR_LOG_LEVEL); static void vcnl4040_handle_cb(struct vcnl4040_data *data) { const struct vcnl4040_config *config = data->dev->config; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>sensor_value *val) { struct veml6031_data *data = dev->data; if (chan != SENSOR_CHAN_LIGHT) { return -ENOTSUP; } /* SENSOR_ATTR_.*_THRESH are not in enum sensor_attribute_veml6031 */ switch ((int)attr) { case SENSOR_ATTR_VEML6031_IT: val->val1 = data->itim; break; case SENSOR_ATTR_VEML6031_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> if (ret < 0) { return ret; } return veml6046_fetch(dev); } else { return -ENOTSUP; } return 0; } static int veml6046_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) { struct veml6046_data *data = dev->data; switch ((int)chan) { case SENSOR_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Andreas Kilian * Copyright (c) 2024 Jeff Welder (Ellenby Technologies, Inc.) * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT vishay_veml7700 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/kernel...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 FTP Technologies * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT voltage_divider #include <inttypes.h> #include <zephyr/drivers/adc.h> #include <zephyr/drivers/adc/voltage_divider.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Würth Elektronik eiSos GmbH & Co. KG * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT we_wsen_hids_2525020210002 #include <stdlib.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byteorder.h> #include <zephyr/logging/log.h> #include "wsen_hids_252502...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>5020210002_heater_t heater; }; #endif /* ZEPHYR_DRIVERS_SENSOR_WSEN_HIDS_2525020210002_WSEN_HIDS_2525020210002_H_ */ <|fim_prefix|>/* * Copyright (c) 2024 Würth Elektronik eiSos GmbH & Co. KG * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_HIDS_2525020210002_WSEN_HIDS_2...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>isds_2536030320001_convert_angular_rate(value, data->rate_z); value++; } break; default: LOG_ERR("Channel not supported %d", channel); return -ENOTSUP; } return 0; } /* Set accelerometer output data rate. See isds_2536030320001_accel_odr_list for allowed values. */ static int isds_25360303...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ZE); struct k_thread drdy_thread; struct k_sem drdy_sem; #ifdef CONFIG_WSEN_ISDS_2536030320001_EVENTS K_KERNEL_STACK_MEMBER(events_thread_stack, CONFIG_WSEN_ISDS_2536030320001_THREAD_STACK_SIZE); struct k_thread events_thread; struct k_sem events_sem; #endif #elif defined(CONFIG_WSEN_ISDS_25...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Würth Elektronik eiSos GmbH & Co. KG * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT we_wsen_isds_2536030320001 #include <zephyr/logging/log.h> #include "wsen_isds_2536030320001.h" LOG_MODULE_DECLARE(WSEN_ISDS_2536030320001, CONFIG_SENSOR_LOG_LEVEL); /* En...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Würth Elektronik eiSos GmbH & Co. KG * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT we_wsen_itds_2533020201601 #include <string.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byteorder.h> #include <zephyr/logging/log.h> #include <wsen_sensors_com...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Würth Elektronik eiSos GmbH & Co. KG * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_WSEN_ITDS_2533020201601_WSEN_ITDS_2533020201601_H_ #define ZEPHYR_DRIVERS_SENSOR_WSEN_ITDS_2533020201601_WSEN_ITDS_2533020201601_H_ #include <zephyr/drivers/gpio.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>S_enable) != WE_SUCCESS) { LOG_ERR("Failed to enable tap recognition in Y direction"); return -EIO; } } if (cfg->tap_threshold[2] > 0) { if (ITDS_enableTapZ(&data->sensor_interface, ITDS_enable) != WE_SUCCESS) { LOG_ERR("Failed to enable tap recognition in Z direction"); return -EIO; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>511020213301_DEFINE(inst) \ static struct pads_2511020213301_data pads_2511020213301_data_##inst = \ PADS_2511020213301_CONFIG_WE_INTERFACE(inst); \ static const struct pads_251102021330...
fim
zephyrproject-rtos/zephyr
c