text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAT9136_H_ #define ZEPHYR_DRIVERS_SENSOR_PAT9136_H_ #include <stdint.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #includ...
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_PAT9136_BUS_H_ #define ZEPHYR_DRIVERS_SENSOR_PAT9136_BUS_H_ #include <stdint.h> #include <zephyr/rtio/rtio.h> #include "pat9136.h" #incl<|fim_suff...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor_clock.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/sensor/pat9136.h> #include "pat9136.h" #include "pat9136_reg.h" #include "pat...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>truct device *dev, const struct sensor_decoder_api **decoder); #endif /* ZEPHYR_DRIVERS_SENSOR_PAT9136_DECODER_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAT9136_DECOD...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>x48 #define REG_RESOLUTION_X_UPPER 0x49 #define REG_RESOLUTION_Y_LOWER 0x4A #define REG_RESOLUTION_Y_UPPER 0x4B /* Misc. Defines */ #define PRODUCT_ID 0x4F #define POWER_UP_RESET_VAL 0x5A #define REG_MOTION_DETECTED(val) ((val) & BIT(7)) #define REG_OBSERVATION_READ_IS_VALID(val) (((val) ==...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/sys/check.h> #include <zephyr/rtio/rtio.h> #include ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>OR_PAT9136_STREAM_H_ #define ZEPHYR_DRIVERS_SENSOR_PAT9136_STREAM_H_ int pat9136_stream_init(const struct device *dev); void pat9136_stream_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); #endif /* ZEPHYR_DRIVERS_SENSOR_PAT9136_STREAM_H_ */ <|fim_prefix|>/* * Copyright (c) 20...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2017 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT plantower_pms7003 /* sensor pms7003.c - Driver for plantower PMS7003 sensor * PMS7003 product: http://www.plantower.com/en/content/?110.html * PMS7003 spec: http://aqicn.org/air/view/sensor/spec/pms7003.pd...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT pni_rm3100 #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/i2c.h> #include <zephyr/rtio/rtio.h> #include <zeph...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel, Inc. * Copyright (c) 2025 CogniPi<|fim_suffix|>tings; #if defined(CONFIG_RM3100_STREAM) struct rm3100_stream stream; #endif /* CONFIG_RM3100_STREAM */ }; #endif /* ZEPHYR_DRIVERS_SENSOR_PNI_RM3100_H_ */ <|fim_middle|>lot Foundation * * SPDX-License-Identifier: Apache-...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c)<|fim_suffix|>HIGH, buf, len, NULL); if (rtio_is_i2c(data->rtio.type)) { read_sqe->iodev_flags |= RTIO_IODEV_I2C_STOP | RTIO_IODEV_I2C_RESTART; } err = rtio_submit(ctx, 2); if (err) { return err; } do { cqe = rtio_cqe_consume(ctx); if (cqe != NULL) { err = cqe->result...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/sys/util.h> #include <zephyr/sys/byteorder.h> #include <zephyr/dt-bindings/sensor/rm3...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>r_api **decoder); #endif /* ZEPHYR_DRIVERS_SENSOR_RM3100_DECODER_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEP<|fim_middle|>HYR_DRIVERS_SENSOR_RM3100_DECODER_H_ #define ZEPHYR_DRIVERS_SENSOR_...
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_PNI_RM3100_REG_H_ #define ZEPHYR_DRIVERS_SENSOR_PNI_RM3100_REG_H_ /* Address value has a read bit */ #define REG_READ_BIT BIT(7) /* RM3100 regist...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ata->rtio.type)) { status_rd_sqe->iodev_flags |= RTIO_IODEV_I2C_STOP | RTIO_IODEV_I2C_RESTART; } status_rd_sqe->flags |= RTIO_SQE_CHAINED; val = RM3100_REG_MX | REG_READ_BIT; rtio_sqe_prep_tiny_write(write_sqe, data->rtio.iodev, RTIO_PRIO_HIGH, &val, 1, NULL); write_sqe->f...
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_RM3100_STREAM_H_ #define ZEPHYR_DRIVERS_SENSOR_RM3100_STREAM<|fim_suffix|>void rm3100_stream_submit(const struct device *dev, struct rtio_iodev...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Srishtik Bhandarkar * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT peacefair_pzem004t /* * sensor pzem004t.c - Driver for peacefair PZEM004T sensor * PZEM004T product: https://en.peacefair.cn/product/772.html */ #include <errno.h> #include <zephyr/init.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ine MEASUREMENT_REGISTER_TOTAL_LENGTH 0x000A /* Scaling factors for the PZEM004T sensor */ #define PZEM004T_VOLTAGE_SCALE 10 /* Voltage in 0.1V */ #define PZEM004T_CURRENT_SCALE 1000 /* Current in 0.001A */ #define PZEM004T_POWER_SCALE 10 /* Power in 0.1 W */ #define PZEM004T_ENERGY...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2021, Piotr Mienkowski * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT atmel_sam_tc_qdec /** @file * @brief Atmel SAM MCU family Quadrature Decoder (QDEC/TC) driver. */ #include <errno.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/util.h> #include <zephyr/device.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT qst_qmi8658a #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include <zephyr/kernel.h> #include <zephyr/logging...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026, Realtek Semiconductor Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #in<|fim_suffix|>#define AON_QDEC_BEE_ASSERT(inst) \ BUILD_ASSERT(DT_INST_PROP_OR(inst, x_enable, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Realtek, SIBG-SD7 * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT realtek_rts5912_tach #include <e<|fim_suffix|> whether internal counter is already latched */ if (tach->status & TACHO_STS_CNTRDY) { tach->status = TACHO_STS_CNTRDY; data->count = (tach...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Ian Morris * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_hs300x #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/logging/log.h>...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Renesas Electronics Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_hs400x #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/__assert.h> #include <...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>lux range."); return -EIO; } /* set ADC resolution */ if (i2c_reg_update_byte_dt(&config->i2c, ISL29035_COMMAND_II_REG, ISL29035_ADC_RES_MASK, ISL29035_ADC_RES_BITS) < 0) { LOG_DBG("Failed to set ADC resolution."); return -EIO; } #ifdef CONFIG_ISL29035_TRIGGER if (config-...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> ISL29035_OPMODE_ALS_ONCE 1 #define ISL29035_OPMODE_IR_ONCE 2 #define ISL29035_OPMODE_ALS_CONT 5 #define ISL29035_OPMODE_IR_CONT 6 #define ISL29035_COMMAND_II_REG 0x01 #define ISL29035_LUX_RANGE_SHIFT 0 #define ISL29035_LUX_RANGE_MASK (3 << ISL29035_LUX_RANGE_SHIFT) #define ISL29035_ADC_RES_SHIFT 2 ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* sensor_isl29035.c - trigger support for ISL29035 light sensor */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT isil_isl29035 #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/loggi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 SILA Emb<|fim_suffix|>r/drivers/sensor/bd8lb600fs.h> #include <zephyr/logging/log.h> #include "bd8lb600fs_diagnostics.h" LOG_MODULE_REGISTER(BD8LB600FS_DIAGNOSTICS, CONFIG_SENSOR_LOG_LEVEL); static int bd8lb600fs_diagnostics_sample_fetch(const struct device *dev, enum sensor_ch...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 SILA Embed<|fim_suffix|>FS_BD8LB600FS_DIAGNOSTICS_H_ #include <zephyr/device.h> struct bd8lb600fs_diagnostics_data { /* open load detection */ uint32_t old; /* over current protection or thermal shutdown*/ uint32_t ocp_or_tsd; }; struct bd8lb600fs_diagnostics_config { cons...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, Borislav Kereziev * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT rohm_bh1730 #include <errno.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(BH1730, CONFIG_SENSOR_LOG_LEVEL); #defin...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>g->mtreg != BH1750_DEFAULT_MTREG) { bh1750_mtreg_write(dev, cfg->mtreg); } return 0; } #define DEFINE_BH1750(_num) \ static struct bh1750_data bh1750_data_##_num; \ static const struct bh1750_dev_config bh1750_config_##_num = { \ .bus = I2C_DT_SPEC_INST_GET(_num), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* <|fim_suffix|>r: Apache-2.0 */ #define DT_DRV_COMPAT rohm_bh1790 #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include <zephyr/devicetree.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/__assert.h> LOG_MODUL...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 TOKITA Hiroshi * *<|fim_suffix|>pico_temp_sample_fetch, .channel_get = rpi_pico_temp_channel_get, }; static int rpi_pico_temp_init(const struct device *dev) { const struct rpi_pico_temp_config *cfg = dev->config; if (!device_is_ready(cfg->adc)) { LOG_ERR_DEVICE_NOT_READY(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ROL3_THE | RV3032_CONTROL3_THIE, RV3032_CONTROL3_THE | RV3032_CONTROL3_THIE); mfd_rv3032_update_reg8(config->parent, RV3032_REG_CONTROL3, RV3032_CONTROL3_TLE | RV3032_CONTROL3_TLIE, RV3032_CONTROL3_TLE | RV3032_CONTROL3_TLIE); mfd_rv3032_read_reg8(config->parent, RV3032_RE...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022, Hiroki Tada * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://datasheetspdf.com/pdf/1323325/Hamamatsu/S11059-02DT/1 */ #define DT_DRV_COMPAT hamamatsu_s11059 #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/i2c.h> #include ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_CMD_FULL_CAPACITY, &data->full_charge_capacity); if (status < 0) { LOG_ERR("Failed to read full charge capacity"); } break; case SENSOR_CHAN_GAUGE_REMAINING_CHARGE_CAPACITY: status = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_REM_CAPACITY, &data->remaining_charge_capacity); i...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Leica Geosystems AG * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SBS_GAUGE_H_ #define ZEPHYR_DRIVERS_SENSOR_SBS_GAUGE_H_ #include <stdint.h> #include <zephyr/drivers/i2c.h> /*** Standard Commands ***/ #define SBS_GAUGE_CMD_MANUFACTURER_ACCESS 0x...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>= &gls_sample_fetch, .channel_get = &gls_channel_get, }; static int gls_init(const struct device *dev) { struct gls_data *drv_data = dev->data; const struct gls_config *cfg = dev->config; if (!device_is_ready(cfg->adc)) { LOG_ERR_DEVICE_NOT_READY(cfg->adc); return -EINVAL; } /*Change followin...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT seeed_grove_temperature #include <zephyr/drivers/adc.h> #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <math.h> #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zep...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT seeed_hm330x #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/init.h> #include <zephyr/logging/log.h> #include <zephyr/sys/__assert.h> LOG_MODULE_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Jan Fäh * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byteorder.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>, 30}, {0x2445, 1}, {0x2340, 1}, {0x244E, 1}, {0x234B, 1}, }; #endif /* ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ */ <|fim_prefix|>/* * Copyright (c) 2024 Jan Fäh * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ #define ZEPHYR_DRIVERS_SENSOR_SCD4X_SCD4X_H_ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> tmp = (uint8_t)CLAMP(val->val1, SGP40_COMP_MIN_RH, SGP40_COMP_MAX_RH); /* adding +50 to eliminate rounding errors through truncation */ rh_ticks = (uint16_t)(((tmp * 65535U) + 50U) / 100U); sys_put_be16(rh_ticks, data->rh_param); data->rh_param[2] = sgp40_compute_crc(rh_ticks); } break; def...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Leonard Pollak * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SGP40_SGP40_H_ #define ZEPHYR_DRIVERS_SENSOR_SGP40_SGP40_H_ #include <zephyr/device.h> #define SGP40_CMD_MEASURE_RAW 0x260F #define SGP40_CMD_MEASURE_TEST 0x280E #define SGP40_CMD_HEATER_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sensirion_sht3xd #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/_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ct device *dev; struct gpio_callback alert_cb; uint16_t t_low; uint16_t t_high; uint16_t rh_low; uint16_t rh_high; sensor_trigger_handler_t handler; const struct sensor_trigger *trigger; #if defined(CONFIG_SHT3XD_TRIGGER_OWN_THREAD) K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_SHT3XD_THREAD_STACK...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>EVICE_NOT_READY(cfg->alert_gpio.port); return -ENODEV; } rc = gpio_pin_configure_dt(&cfg->alert_gpio, GPIO_INPUT); if (rc != 0) { LOG_DBG("Failed to configure alert pin %u!", cfg->alert_gpio.pin); return -EIO; } gpio_init_callback(&data->alert_cb, sht3xd_gpio_callback, BIT(cfg->alert_gp...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; case SENSOR_ATTR_SHT4X_HEATER_DURATION: if (val->val1 > SHT4X_HEATER_DURATION_IDX_MAX) { return -EINVAL; } data->heater_duration = val->val1; break; default: return -ENOTSUP; } return 0; } static int sht4x_init_chip(const struct device *dev) { int rc; /* 1 ms (max) power up time ac...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uration; }; static const uint8_t measure_cmd[3] = { 0xE0, 0xF6, 0xFD }; static const uint16_t measure_wait_us[3] = { 1600, 4500, 8300 }; /* * heater specifics * * power: * High power heater pulse -> ~200 mW @3.3V * Medium power heater pulse -> ~110 mW @3.3V * Low power heater pulse -> ~20 mW...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Thomas Stranger * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sensirion_shtcx #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/byte...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Thomas Stranger * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SHTCX_SHTCX_H_ #define ZEPHYR_DRIVERS_SENSOR_SHTCX_SHTCX_H_ #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>d(dev, STCC4_CMD_GET_PRODUCT_ID); if (ret < 0) { LOG_ERR("Failed to send get_product_id command"); return ret; } ret = stcc4_read_reg(dev, rx_buf, sizeof(rx_buf)); if (ret < 0) { LOG_ERR("Failed to read product ID"); return ret; } id_hi = sys_get_be16(rx_buf); id_lo = sys_get_be16(&rx_buf...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>MIN_TEMP + MAX_TEMP * (raw / 65535) */ #define STCC4_MAX_TEMP 175 #define STCC4_MIN_TEMP (-45) /* Humidity conversion: RH[%] = MIN_HUMI + MAX_HUMI * (raw / 65535) */ #define STCC4_MAX_HUMI 125 #define STCC4_MIN_HUMI (-6) enum stcc4_mode { STCC4_MODE_CONTINUOUS = STCC4_DT_MODE_CONTINUOUS, STCC4_MODE_SI...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>lse); if (calculated_crc == sensor_crc) { return 0; } return -EIO; } static int sts4x_write_command(const struct device *dev, uint8_t cmd) { const struct sts4x_config *cfg = dev->config; uint8_t tx_buf = cmd; return i2c_write_dt(&cfg->bus, &tx_buf, 1); } static int sts4x_read_sample(const str...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Cienet * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/sys/util.h> #include <zephyr/sys_clock.h> #include <zephyr/drivers/counter.h> #include <zephyr/logging/log.h> #include <zephyr/init.h> LOG_MODULE_REGISTER(sensor_clock, CONFIG_SENSOR_LOG_LEVEL); ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Cienet * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/sys_clock.h> int sensor_clock_get_cycles(uint64_t *cycles) { if (cycles == NULL) { return -EINVAL; } #ifdef CONFIG_TIMER_HAS_64BIT_CYCLE_COUNTER *cyc...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Google LLC. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/init.h> #include <zephyr/drivers/sensor.h> static int sensor_decoders_init(void) { STRUCT_SECTION_FOREACH(sensor_decoder_api, api) { k_object_access_all_grant(api); } return 0; } SYS_INIT(sensor_decoders_init, PO...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ephyr/syscalls/sensor_sample_fetch_chan_mrsh.c> static inline int z_vrfy_sensor_channel_get(const struct device *dev, enum sensor_channel chan, struct sensor_value *val) { K_OOPS(K_SYSCALL_DRIVER_SENSOR(dev, channel_get)); K_OOPS(K_SYSCALL_MEMORY_WRITE(val, sizeof(struct sensor_value)...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>(%s)", argv[1]); return -ENODEV; } if (!device_is_sensor(dev)) { shell_error(sh, "Device is not a sensor (%s)", argv[1]); return -ENODEV; } for (size_t i = 2; i < argc; i += 3) { int channel = parse_named_int(argv[i], sensor_channel_name, ARRAY_SIZE(sensor_channel_name)); int at...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SENSOR_SHELL_H #define ZEPHYR_DRIVERS_SENSOR_SENSOR_SHELL_H #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/rtio/rtio.h> #include <zephyr/shell/shell.h> struct ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #include <stdlib.h> #include <string.h> #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include "sensor_shell.h" /* Create a single common config for streaming */ static struct sensor_stream_trigger iodev_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> if (temp.supported) { shell_print(sh, "Temp: %.1d.%02d C", temp.val.val1, temp.val.val2 / 10000); } if (volt.supported) { shell_print(sh, "V: %5d.%02d V", volt.val.val1, volt.val.val2 / 10000); } if (v_desired.supported) { shell_print(sh, "V-desired: %d.%02d V", v_desired.val.v...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, Qingsong Gou <gouqs@hotmail.com> * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sifli_sf32lb_tsen #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/clock_control/sf32lb.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>supply) { regulator_enable(config->vin_supply); /* As stated by the Si7006 spec - Maximum powerup time is 80ms */ k_msleep(80); } LOG_DBG("si7006 init ok"); return 0; } #define SI7006_DEFINE(inst, name, temp_cmd) \ static struct si7006_data si7006_data_##name##_##inst; \ \...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ITY_TEMP_CONTR 0xE7 #define SI7006_WRITE_HEATER_CONTR 0x51 #define SI7006_READ_HEATER_CONTR 0x11 #define SI7006_READ_ID_LOW_0 0xFA #define SI7006_READ_ID_LOW_1 0x0F #define SI7006_READ_ID_HIG...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> si7055_data si7055_data_##inst; \ \ static const struct si7055_config si7055_config_##inst = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ }; \ \ SENSOR_DEVICE_DT_INST_DEFINE(inst, si7055_init, NULL, \ &si7055_data_##inst, &si7055_config_##inst, POST_K...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>0x31 #define SI7055_CRC_SIZE sizeof(uint8_t) #define SI7055_CRC_INIT 0x0 #define SI7055_DATA_SIZE (sizeof(uint8_t) * 2) #endif /* _SI7055_H */ <|fim_prefix|>/* * Copyright (c) 2020 Laird Connectivity * Copyri...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019 Actinius * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT silabs_si7060 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "si7060.h" #define SIGN_BIT_MASK 0x7F LOG_MODULE_R...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2019 Actinius * * SPDX-License-Identifier: Apache-2.0 */ #ifndef _SI7060_H #define _SI7060_H /* Si7060 register addresses */ #define SI7060_REG_CHIP_INFO 0xC0 #define SI7060_REG_TEMP_HIGH 0xC1 #define SI7060_REG_TEMP_LOW 0xC2 #define SI7060_REG_CONFIG 0xC4 #define SI7060_CHIP_ID_VALUE 0x01 #de...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Aurelien Jarno * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT silabs_si7210 #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byte...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|><|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_hts221 #include <zephyr/drivers/i2c.h> #include <zephyr/init.h> #include <zephyr/sys/__assert.h> #include <string.h> #include <zephyr/logging/log.h> #include "hts221.h" LOG_M...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>x_t ctx; union { #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) const struct i2c_dt_spec i2c; #endif #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) const struct spi_dt_spec spi; #endif } stmemsc_cfg; #ifdef CONFIG_HTS221_TRIGGER const struct gpio_dt_spec gpio_drdy; const struct gpio_dt_spec gpio_int; #endif /*...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>back."); return status; } /* enable data-ready interrupt */ status = hts221_drdy_on_int_set(ctx, 1); if (status < 0) { LOG_ERR("Could not enable data-ready interrupt."); return status; } #if defined(CONFIG_HTS221_TRIGGER_OWN_THREAD) k_sem_init(&data->drdy_sem, 0, K_SEM_MAX_LIMIT); k_thread...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_DEFINE_SPI(inst) \ static const struct i3g4250d_device_config i3g4250d_device_config_##inst = \ I3G4250D_CONFIG_SPI(inst); #define I3G4250D_DEFINE(inst) \ I3G4250D_DEFINE_SPI(inst); \ I3G4250D_DEVICE_INIT(inst) DT_INST_FOREACH_STATUS_OKAY(I3G4250D_DEFINE) <|fim_prefix|>/* ST Microelectronics I3G425...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>x; union { #if I3G4250D_ANY_INST_ON_BUS_STATUS_OKAY(spi) const struct spi_dt_spec spi; #endif } stmemsc_cfg; }; /* sensor data */ struct i3g4250d_data { int16_t angular_rate[3]; }; #endif /* __SENSOR_I3G4250D__ */ <|fim_prefix|>/* ST Microelectronics I3G4250D gyro driver * * Copyright (c) 2021 ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>/ if (iis2dh_device_id_get(iis2dh->ctx, &wai) < 0) { return -EIO; } if (wai != IIS2DH_ID) { LOG_ERR("Invalid chip ID: %02x", wai); return -EINVAL; } if (iis2dh_block_data_update_set(iis2dh->ctx, PROPERTY_ENABLE) < 0) { return -EIO; } if (iis2dh_operating_mode_set(iis2dh->ctx, cfg->pm)) {...
fim
zephyrproject-rtos/zephyr
c
/* ST Microelectronics IIS2DH 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2dh.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_IIS2DH_IIS2DH_H_ #define ZEPHYR_DRIVERS_SENSOR_IIS2DH_IIS2DH_H_ #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2DH 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2dh.pdf */ #define DT_DRV_COMPAT st_iis2dh #include <string.h> #include <zephyr/drivers/i2c.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2DH 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2dh.pdf */ #define DT_DRV_COMPAT st_iis2dh #include <string.h> #include "iis2dh.h" #include <ze...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2DH 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2dh.pdf */ #define DT_DRV_COMPAT st_iis2dh #include <zephyr/kernel.h> #include <zephyr/drivers/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>n a device is on a SPI bus. */ #ifdef CONFIG_IIS2DLPC_TAP #define IIS2DLPC_CONFIG_TAP(inst) \ .tap_mode = DT_INST_PROP(inst, tap_mode), \ .tap_threshold = DT_INST_PROP(inst, tap_threshold), \ .tap_shock = DT_INST_PROP(inst, tap_shock), \ .tap_latency = DT_INST_PROP(inst, tap_latency), \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>N_BUS_STATUS_OKAY(spi) #include <zephyr/drivers/spi.h> #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */ #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) #include <zephyr/drivers/i2c.h> #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ /* Return ODR reg value based on data rate set */ #define IIS2DLPC_ODR_TO_REG(_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2DLPC 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2dlpc.pdf */ #define DT_DRV_COMPAT st_iis2dlpc #include <zephyr/kernel.h> #include <zephyr/dr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>2iclx_driver_api); /* * Instantiation macros used when a device is on a SPI bus. */ #ifdef CONFIG_IIS2ICLX_TRIGGER #define IIS2ICLX_CFG_IRQ(inst) \ .trig_enabled = true, \ .gpio_drdy = GPIO_DT_SPEC_INST_GET(inst, drdy_gpios), \ .int_pin = DT_INST_PROP(inst, int_pin) #else #define IIS2ICLX_CFG...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2ICLX 2-axis accelerometer sensor driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2iclx.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_IIS2ICLX_IIS2ICLX_H_ #define ZEPHYR_DRIVERS_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> = SENSOR_CHAN_PRESS, .i2c_addr = { 0x5C, 0x5D }, .wai_addr = 0x0F, .wai_val = 0xB3, .out_data_addr = 0x28, .out_data_len = 0x05, .dev_init = (iis2iclx_lps22hh_init), .dev_conf = (iis2iclx_lps22hh_conf), }, #endif /* CONFIG_IIS2ICLX_EXT_LPS22HH */ }; stat...
fim
zephyrproject-rtos/zephyr
c
/* ST Microelectronics IIS2ICLX 2-axis accelerometer sensor driver * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2iclx.pdf */ #define DT_DRV_COMPAT st_iis2iclx #include <zephyr/kernel.h> #include <zephyr/drivers/s...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2MDC 3-axis magnetometer sensor * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2mdc.pdf */ #define DT_DRV_COMPAT st_iis2mdc #include <zephyr/init.h> #include <zephyr/sys/__as...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2MDC 3-axis magnetometer sensor * * Copyright (c) 2020 STMicroelectr<|fim_suffix|>ned(CONFIG_IIS2MDC_TRIGGER_GLOBAL_THREAD) struct k_work work; #endif /* CONFIG_IIS2MDC_TRIGGER_GLOBAL_THREAD */ #endif /* CONFIG_IIS2MDC_TRIGGER */ }; int iis2mdc_spi_init(const struct device ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>MDC, CONFIG_SENSOR_LOG_LEVEL); static int iis2mdc_i2c_read(const struct device *dev, uint8_t reg_addr, uint8_t *value, uint16_t len) { const struct iis2mdc_dev_config *cfg = dev->config; return i2c_burst_read_dt(&cfg->i2c, reg_addr, value, len); } static int iis2mdc_i2c_write(const struct device...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2MDC 3-axis magnetometer sensor * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2mdc.pdf */ #define DT_DRV_COMPAT st_iis2mdc #include <string.h> #include "iis2mdc.h" #include ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS2MDC 3-axis magnetometer sensor * * Copyright (c) 2020 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis2mdc.pdf */ #define DT_DRV_COMPAT st_iis2mdc #include <zephyr/kernel.h> #include <zephyr/driver...
fim
zephyrproject-rtos/zephyr
c
/* ST Microelectronics IIS328DQ 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * Copyright (c) 2024 SILA Embedded Solutions GmbH * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis328dq.pdf */ #define DT_DRV_COMPAT st_iis328dq #include ...
fim
zephyrproject-rtos/zephyr
c
/* ST Microelectronics IIS328DQ 3-axis accelerometer driver * * Copyright (c) 2020 STMicroelectronics * Copyright (c) 2024 SILA Embedded Solutions GmbH * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis328dq.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_IIS328DQ_IIS32...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>NFIG_IIS328DQ_TRIGGER_OWN_THREAD */ } #ifdef CONFIG_IIS328DQ_TRIGGER_OWN_THREAD static void iis328dq_thread(void *p1, void *p2, void *p3) { ARG_UNUSED(p2); ARG_UNUSED(p3); struct iis328dq_data *iis328dq = p1; while (1) { k_sem_take(&iis328dq->gpio_sem, K_FOREVER); iis328dq_handle_interrupt(iis3...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> LOG_ERR_DEVICE_NOT_READY(config->spi.bus); return -ENODEV; } config->bus_init(dev); if (iis3dhhc_init_chip(dev) < 0) { LOG_DBG("Failed to initialize chip"); return -EIO; } #ifdef CONFIG_IIS3DHHC_TRIGGER if (config->int_gpio.port) { if (iis3dhhc_init_interrupt(dev) < 0) { LOG_ERR("Fai...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>3DHHC_H_ */ <|fim_prefix|>/* ST Microelectronics IIS3DHHC accelerometer sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis3dhhc.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_IIS3DHHC_IIS3DHHC_H_ #define ZEP...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS3DHHC accelerometer sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis3dhhc.pdf */ #define DT_DRV_COMPAT st_iis3dhhc #include <string.h> #include "iis3dhhc.h" #include <z...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics IIS3DHHC accelerometer sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis3dhhc.pdf */ #define DT_DRV_COMPAT st_iis3dhhc #include <zephyr/kernel.h> #include <zephyr/drivers/s...
fim
zephyrproject-rtos/zephyr
c
/* ST Microelectronics IIS3DWB accelerometer senor * * Copyright (c) 2025 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/iis3dwb.pdf */ #define DT_DRV_COMPAT st_iis3dwb #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/...
fim
zephyrproject-rtos/zephyr
c