text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
/* * Copyright (c) 2025, CATIE * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include "max30101.h" LOG_MODULE_DECLARE(MAX30101, CONFIG_SENSOR_LOG_LEVEL); #if CONFIG_MAX30101_TRIGGER_OWN_THREAD K_THREAD_STACK_DEFINE(max30101_workqueue_stack, CONFIG_MAX30101_THREAD_SIZE); static struc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ \ static struct max31790_fan_fault_data max31790_fan_fault_##inst##_data; \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Cop<|fim_suffix|>90_MAX31790_FAN_FAULT_H_ #include <zephyr/drivers/i2c.h> struct max31790_fan_fault_config { struct i2c_dt_spec i2c; }; struct max31790_fan_fault_data { uint16_t value; }; #endif /* ZEPHYR_DRIVERS_SENSOR_MAX31790_MAX31790_FAN_FAULT_H_ */ <|fim_middle|>yright (c) 2024 SILA Embed...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>"max31790_fan_speed.h" #define FACTOR_RPM_TO_HZ 60 #define TACH_COUNT_FREQUENCY (MAX31790_OSCILLATOR_FREQUENCY_IN_HZ / 4) #define TACH_COUNTS_PER_REVOLUTION 2 LOG_MODULE_REGISTER(MAX31790_FAN_SPEED, CONFIG_SENSOR_LOG_LEVEL); static int max31790_fan_speed_sample_fetch(const struct device...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 SILA Embedded Solutions GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MAX31790_MAX31790_FAN_SPEED_H_ #define ZEPHYR_DRIVERS_SENSOR_MAX31790_MAX31790_FAN_SPEED_H_ #include <zephyr/drivers/i2c.h> struct max31790_fan_speed_config { struct i2c_dt_spec i2c; ui...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Christian Hirsch * Copyright (c) 2025 Petr Vilím * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT maxim_max31855 #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/byteor...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>emperature); default: return -ENOTSUP; } } static int max31865_attr_set(const struct device *dev, enum sensor_channel chan, enum sensor_attribute attr, const struct sensor_value *val) { if (chan != SENSOR_CHAN_ALL && chan != SENSOR_CHAN_AMBIENT_TEMP) { LOG_ERR("Invalid channel provided"); ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> conversion_mode; bool one_shot; bool three_wire; uint8_t fault_cycle; bool filter_50hz; uint16_t low_threshold; uint16_t high_threshold; }; /* Bit manipulation macros */ #define TESTBIT(data, pos) ((0u == (data & BIT(pos))) ? 0u : 1u) #endif <|fim_prefix|>/* * Copyright (c) 2022 HAW Hamburg FTZ-...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t max31875_data *data = dev->data; if (!device_is_ready(cfg->bus.bus)) { LOG_ERR_DEVICE_NOT_READY(cfg->bus.bus); return -ENODEV; } data->config_reg = MAX31875_CONFIG(cfg->data_format, cfg->resolution, cfg->conversions_per_second); return max31875_update_config(dev, 0, 0); } #define MA...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>BIT, value) != 0) { LOG_DBG("Failed to set attribute!"); return -EIO; } return 0; default: return -ENOTSUP; } return 0; } static int max44009_sample_fetch(const struct device *dev, enum sensor_channel chan) { struct max44009_data *drv_data = dev->data; uint8_t val_h, val_l; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>l.h> #include <zephyr/drivers/i2c.h> #define MAX44009_SAMPLING_CONTROL_BIT BIT(7) #define MAX44009_CONTINUOUS_SAMPLING BIT(7) #define MAX44009_SAMPLE_EXPONENT_SHIFT 12 #define MAX44009_MANTISSA_HIGH_NIBBLE_MASK 0xf00 #define MAX44009_MANTISSA_LOW_NIBBLE_MASK 0xf #define MAX44009_REG_CONFIG 0x02 #define...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>static DEVICE_API(sensor, max6675_api) = { .sample_fetch = &max6675_sample_fetch, .channel_get = &max6675_channel_get, }; static int max6675_init(const struct device *dev) { const struct max6675_config *config = dev->config; if (!spi_is_ready_dt(&config->spi)) { LOG_ERR_DEVICE_NOT_READY(config->sp...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_gpio, GPIO_INT_DISABLE); } #endif return ret; } ret = k_sem_take(&data->read_sem, K_MSEC(CONFIG_MB7040_DELAY_MS)); #if MB7040_HAS_STATUS_GPIO /* Check if status_gpio port is present */ if (cfg->status_gpio.port != NULL) { gpio_pin_interrupt_configure_dt(&cfg->status_gpio, GPIO_INT_DISABLE); ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>etch(const struct device *dev, enum sensor_channel chan) { const struct htu31d_config *cfg = dev->config; struct htu31d_data *data = dev->data; uint8_t conv_cmd; uint8_t read_cmd; uint8_t rx_buf[HTU31D_T_RH_BUF_LEN]; uint8_t conv_delay; int ret; if ((chan != SENSOR_CHAN_ALL) && (chan != SENSOR_CH...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e per datasheet: 15 ms max */ #define HTU31D_RESET_TIME_MS 15U /* * Conversion delay per OSR level in milliseconds. * * Datasheet Table 3 lists per-channel maxima of (1.57, 3.06, 6.03, 11.98) ms * for temperature and (1.11, 2.14, 4.21, 8.34) ms for humidity; both run in * parallel, so temperature is...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2019 Thomas Schmid <tom@lfence.de> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT meas_ms5607 #include <zephyr/init.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/__assert.h> #include "ms5607.h" #define...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> *val); }; #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) extern const struct ms5607_transfer_function ms5607_i2c_transfer_function; #endif #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) extern const struct ms5607_transfer_function ms5607_spi_transfer_function; #endif struct ms5607_config { const struct ms5607_tran...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>*config, uint8_t cmd, uint16_t *val) { uint8_t valb[2]; int err; err = i2c_burst_read_dt(&config->bus_cfg.i2c, cmd, valb, sizeof(valb)); if (err < 0) { return err; } *val = sys_get_be16(valb); return 0; } static int ms5607_i2c_start_conversion(const struct ms5607_config *config, uint8_t ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019 Thomas Schmid <tom@lfence.de> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT meas_ms5607 #include <string.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include "ms5607.h" #define LOG_LEVEL CONFIG_SENSOR_LOG...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT meas_ms5637 #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/by...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MS5637_MS5637_H_ #define ZEPHYR_DRIVERS_SENSOR_MS5637_MS5637_H_ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> /* I2C commands (MS5637-02BA03 datasheet) */ #define MS5...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* Driver for MS5837 pressure sensor * * Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu> * Copyright (c) 2025 Ivan Wagner <ivan.wagner@tecinvent.ch> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/init.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ure, const int32_t adc_pressure); struct ms5837_data { /* Calibration values */ uint16_t factory; uint16_t sens_t1; uint16_t off_t1; uint16_t tcs; uint16_t tco; uint16_t t_ref; uint16_t tempsens; /* Measured values */ int32_t pressure; int32_t temperature; /* Conversion commands ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nst struct i2c_dt_spec *i2c) { uint8_t buffer[2]; int rc; rc = i2c_burst_read_dt(i2c, MLX90394_REG_CID, buffer, ARRAY_SIZE(buffer)); if (rc != 0) { LOG_ERR("Failed to read who-am-i register (rc=%d)", rc); return -EIO; } if (buffer[0] != MLX90394_CID || buffer[1] != MLX90394_DID) { LOG_ERR("W...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Florian Weber <Florian.Weber@live.de> * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MLX90394_MLX90394_H_ #define ZEPHYR_DRIVERS_SENSOR_MLX90394_MLX90394_H_ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #i<|fim_suffix|> enum mlx90394_reg_c...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Florian Weber <Florian.Weber@live.de> * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT melexis_mlx90394 #include <zephyr/logging/log.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/sensor_clock.h> #include "mlx903...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ure); *fit = 1; } break; default: return -ENOTSUP; } return 1; } SENSOR_DECODER_API_DT_DEFINE() = { .get_frame_count = mlx90394_decoder_get_frame_count, .get_size_info = mlx90394_decoder_get_size_info, .decode = mlx90394_decoder_decode, }; int mlx90394_get_decoder(const struct device *dev, co...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ (FIELD_PREP(MLX90394_CTRL1_MODE, MODE) | FIELD_PREP(MLX90394_CTRL1_X_EN, X_EN) | \ FIELD_PREP(MLX90394_CTRL1_Y_EN, Y_EN) | FIELD_PREP(MLX90394_CTRL1_Z_EN, Z_EN) | \ FIELD_PREP(MLX90394_CTRL1_SWOK, SWOK)) #define MLX90394_CTRL1_DEFAULT MLX90394_CTRL1_PREP(0, 1, 1, 1, 0) /* CTRL...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t(const struct device *dev) { int ret = 0; struct mc3419_driver_data *data = dev->data; const struct mc3419_config *cfg = dev->config; if (!(i2c_is_ready_dt(&cfg->i2c))) { LOG_ERR_DEVICE_NOT_READY(cfg->i2c.bus); return -ENODEV; } k_sem_init(&data->sem, 1, 1); #if defined(CONFIG_MC3419_TRIGGER...
fim
zephyrproject-rtos/zephyr
c
/* * SPDX-License-Identifier: Apache-2.0 * * Copyright (c) 2023 Linumiz */ #ifndef ZEPHYR_DRIVERS_SENSOR_MC3419_H_ #define ZEPHYR_DRIVERS_SENSOR_MC3419_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/sys/util.h> /*...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>k, handler ? int_mask : 0); if (ret < 0) { LOG_ERR("Failed to configure motion interrupt (%d)", ret); return ret; } } ret = i2c_reg_update_byte_dt(&cfg->i2c, MC3419_REG_INT_CTRL, buf, buf); if (ret < 0) { LOG_ERR("Failed to configure interrupt (%d)", ret); return ret; } gpio_...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Intel Corporation * * 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> #include <zep...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> const struct mmc56x3_bus_io mmc56x3_bus_io_i2c; #define MMC56X3_REG_TEMP 0x09 #define MMC56X3_CHIP_ID 0x10 #define MMC56X3_REG_STATUS 0x18 #define MMC56X3_REG_INTERNAL_ODR 0x1a #define MMC56X3_REG_INTERNAL_CTRL_0 0x1b #define MMC56X3_REG_INTERNAL_CTRL_1 0x1c #define MM...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>fault: continue; break; } } rc = mmc56x3_sample_fetch_helper(dev, SENSOR_CHAN_ALL, &edata->data); if (rc != 0) { LOG_ERR("Failed to fetch samples"); rtio_iodev_sqe_err(iodev_sqe, rc); return; } rtio_iodev_sqe_ok(iodev_sqe, 0); } void mmc56x3_submit(const struct device *dev, struct rt...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Intel Corporation * SPDX-License-Identifier: Apache-2.0 */ #include "mmc56x3.h" #include <math.h> static int mmc56x3_decoder_get_frame_count(const uint8_t *buffer, struct sensor_chan_spec chan_spec, uint16_t *frame_count) { const struct mmc5<|fim_suffix|>MC56X3_MAGN_C...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>g_write_i2c, .raw_read = mmc56x3_raw_read_i2c, .raw_write = mmc56x3_raw_write_i2c, }; <|fim_prefix|>/* * Copyright (c) 2024 Intel Corporation * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific functionality for MMC56X3s accessed via I2C. */ #include "mmc56x3.h" static int mmc56x3_bus_che...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>return -ENOTSUP; } switch (attr) { case SENSOR_ATTR_FULL_SCALE: return mhz19b_attr_full_scale_cfg(dev, val->val1); case SENSOR_ATTR_MHZ19B_ABC: return mhz19b_attr_abc_cfg(dev, val->val1); default: return -ENOTSUP; } } static int mhz19b_attr_get(const struct device *dev, enum sensor_channel...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 G-Technologies Sdn. Bhd. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MHZ19B_MHZ19B #define ZEPHYR_DRIVERS_SENSOR_MHZ19B_MHZ19B #include <zephyr/kernel.h> #include <zephyr/device.<|fim_suffix|>_CMD_IDX_GET_CO2, /* Read range */ MHZ19B_CMD_IDX_GET...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Intel Corporation * Copyright (c) 2022 Microchip Technology Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_xec_tach #include <errno.h> #include <soc.h> #include <zephyr/arch/cpu.h> #include <zephyr/device.h> #include <zephyr/drivers/pinctrl.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, Thomas Schmid <tom@lfence.de> * Copyright (c) 2022, Maxmillion McLaughlin * Copyright (c) 2020, SER Consulting LLC / Steven Riedl * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_mcp9600 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 FTP Technologies * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_mcp970x #include <zephyr/drivers/adc.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(mcp970x, CONFIG_SENSOR_LOG_LEVEL); enum ic_family { FA...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Microchip Technology Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_mtch9010 #include <errno.h> #include <stdint.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdio.h> #include <zephyr/drivers/sensor...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025 Microchip Technology Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_MICROCHIP_MTCH9010_PRIV_H_ #define ZEPHYR_DRIVERS_SENSOR_MICROCHIP_MTCH9010_PRIV_H_ #include <stdint.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/drivers/uart.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>" Label: %s", ch->label ? ch->label : "N/A"); LOG_DBG(" Shunt: %u uOhm (%u.%03u mOhm)", ch->shunt_resistor_uohm, ch->shunt_resistor_uohm / 1000, ch->shunt_resistor_uohm % 1000); LOG_DBG(" VBUS Mode: %s", pac194x_sense_mode_name_get(ch->vbus_mode)); LOG_DBG(" VSENSE Mode:%s", ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Google, LLC * * SPDX-License-Identifier: Apache-2.0 */ #ifndef PAC194X_H #define PAC194X_H #define PAC194X_MAX_CHANNELS 4 /* --- Special Commands (Register addresses with no data) --- */ /** REFRESH command: Updates readable registers and resets accumulators */ #define PAC...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 Daniel DeGrasse <daniel@degrasse.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_tcn75a #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(tcn75a, CONFIG_SENSOR_LOG_LEVEL); #include "tcn75a.h" int tcn75a_sample_fetch(const struct device *dev, en...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 Daniel DeGrasse <daniel@degrasse.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef _DRIVERS_SENSOR_TCN75A_H_ #define _DRIVERS_SENSOR_TCN75A_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/byteorder....
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 Daniel DeGrasse <daniel@degrasse.com> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(tcn75a, CONFIG_SENSOR_LOG_LEVEL); #include "tcn75a.h" int tcn75a_trigger_set(const struct device *dev, const struct sensor_trigger *trig, ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Benedikt Schmidt <benediktibk@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT onnn_nct75 #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> LOG_MODULE...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> return sensor_value_from_milli(val, data->ntc_mC); case SENSOR_CHAN_DIE_TEMP: return sensor_value_from_milli(val, data->die_mC); case NPM10XX_SENSOR_CHAN_VSYS: return sensor_value_from_milli(val, data->vsys_mv); case NPM10XX_SENSOR_CHAN_VBUS: return sensor_value_from_milli(val, data->vbus_mv)...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ #include <math.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/mfd/npm13xx.h> #include <zephyr/kernel.h> #include <zephyr/sys/linear_range.h> #include <zephyr/drivers/sensor/npm13xx_charger.h> struct npm13xx_ch...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Nordic Semiconductor ASA * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nordic_npm2100_vbat #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/mfd/npm2100.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #in...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2018, Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/pm/device.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/dt-bindings/sensor/qdec_nrf.h> #include <soc.h> #include <nrfx_qdec.h> #include <hal/nrf_gpio.h> #incl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>(0), 0); irq_enable(DT_INST_IRQN(0)); nrf_temp_int_enable(NRF_TEMP, NRF_TEMP_INT_DATARDY_MASK); return 0; } #define NRF_TEMP_DEFINE(inst) \ static struct temp_nrf5_data temp_nrf5_data_##inst; \ \ SENSOR_DEVICE_DT_INST_DEFINE(inst, temp_nrf5_init, NULL, \ &temp_nrf...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>IT_PRIORITY, &temp_nrfs_drv_api); <|fim_prefix|>/* * Copyright (c) 2024 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nordic_nrf_temp_nrfs #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ce.buffer = &data->raw; data->sequence.buffer_size = sizeof(data->raw); data->sequence.calibrate = true; return 0; } #define NRF_VBAT_INIT(inst) \ static struct vbat_data vbat_data_##inst; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ntc_compensation comp_tdk_ntcgxx3jx103x[] = { { -25, 86560 }, { -15, 53460 }, { -5, 33930 }, { 5, 22070 }, { 15, 14700 }, { 25, 10000 }, { 35, 6942 }, { 45, 4911 }, { 55, 3536 }, { 65, 2588 }, { 75, 1924 }, { 85, 1451 }, { 95, 1110 }, { 105, 860 }, { 115, 674 }, { 125, 534 }, }; DT_INST_F...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #ifndef NTC_THERMISTOR_H #define NTC_THERMISTOR_H #include <stdbool.h> #include <zephyr/types.h> struct ntc_compensation { const int32_t temp_c; const uint32_t ohm; }; struct ntc_type { const struct ntc_compensation *...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>pe->comp[high].ohm, type->comp[high].temp_c * 1000, ohm); return temp; } <|fim_prefix|>/* * Copyright <|fim_middle|>(c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #include <limits.h> #include "ntc_thermistor.h" /** * fixp_linear_interpolate() - interpolates a value from two...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>npcx_threshold_ctrl_set_param(config->adc, config->th_sel, &param); } static int adc_cmp_npcx_sample_fetch(const struct device *dev, enum sensor_channel chan) { return -ENOTSUP; } static int adc_cmp_npcx_channel_get(const struct device *dev, enum sensor_channel chan, stru...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ .buffer = &adc_v2t_npcx_data_##inst.buffer, \ .buffer_size = sizeof(adc_v2t_npcx_data_##inst.buffer), \ .resolution = 10, \ }, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_MDSEL); /* Configure clock module and its frequency of tachometer */ if (config->sample_clk == 0) { return -EINVAL; } else if (data->input_clk == LFCLK) { /* Enable low power mode */ inst->TCKC |= BIT(NPCX_TCKC_LOW_PWR); if (config->sample_clk != data->input_clk) { LOG_ERR("%s operate freq...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017, NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxas21002 #include "fxas21002.h" #include <zephyr/sys/util.h> #include <zephyr/sys/__assert.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(FXAS21002, CONFIG_SENSOR_LOG_LEVEL); /* Sample period...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017, NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/<|fim_suffix|>c.h> #endif #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include <zephyr/drivers/spi.h> #endif #include <zephyr/drivers/gpio.h> #include <zephyr/kernel.h> #define FXAS21002_BUS_I2C (1<<0) #define FXAS...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017, NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxas21002 #include <zephyr/logging/log.h> #include "fxas21002.h" LOG_MODULE_DECLARE(FXAS21002, CONFIG_SENSOR_LOG_LEVEL); static void fxas21002_gpio_callback(const struct device *dev, struct g...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxls8974 #include "fxls8974.h" #include <zephyr/sys/util.h> #include <zephyr/sys/__assert.h> #include <zephyr/logging/log.h> #include <stdlib.h> LOG_MODULE_REGI...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ <|fim_suffix|>5 0x19 #define WHOAMI_ID_FXLS8964 0x84 #define WHOAMI_ID_FXLS8974 0x86 #define FXLS8974_CTRLREG1_ACTIVE_MASK 0x01 #define FXLS8974_CTRLREG1_RST_MASK 0x80 #define FXLS8974_CTRLREG1_FSR_MASK 0x06 #define F...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2024 NXP * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxls8974 #include "fxls8974.h" #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(FXLS8974, CONFIG_SENSOR_LOG_LEVEL); static void fxls8974_gpio_callback(const struct device ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxos8700 #include "fxos8700.h" #include <zephyr/sys/util.h> #include <zephyr/sys/__assert.h> #include <zephyr/logging/log.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Freescale Semiconductor, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/dr<|fim_suffix|>R_ACTIVE, }; enum fxos8700_mode { FXOS8700_MODE_ACCEL = 0, FXOS8700_MODE_MAGN = 1, FXOS8700_MODE_HYBRID = 3, }; enum fxos8700_power_mode { FXOS8700_PM_NORMAL = 0...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 Freescale Semiconductor, Inc. * Copyright (c) 2018 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_fxos8700 #include "fxos8700.h" #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(FXOS8700, CONFIG_SENSOR_LOG_LEVEL); static void fxos8700_gpio...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Vestas Wind Systems A/S * Copyright 2022, 2024-2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_kinetis_acmp #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/mcux_acmp.h> #include <zephyr/logging/log.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> val->val1 = (int32_t)(data->filter_config.enableSample); break; case SENSOR_ATTR_MCUX_LPCMP_FILTER_COUNT: val->val1 = (int32_t)(data->filter_config.filterSampleCount); break; case SENSOR_ATTR_MCUX_LPCMP_FILTER_PERIOD: val->val1 = (int32_t)(data->filter_config.filterSamplePeriod); break; /**...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_ERR_DEVICE_NOT_READY(config->adc); return -EINVAL; } for (i = 0; i < ARRAY_SIZE(ch_cfg); i++) { err = adc_channel_setup(config->adc, &ch_cfg[i]); if (err) { LOG_ERR("failed to configure ADC channel (err %d)", err); return err; } } return 0; } BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_lpadc_temp40 #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/adc.h> #include <zephyr/logging/log.h> #include <zephyr/devicetree.h> LOG_MODULE_REGISTER(lpadc_temp40, CO...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2025-2026 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/adc.h> #include <zephyr/logging/log.h> #include <zephyr/nvmem.h> #include <zephyr/sys/util.h> LOG_MODULE_REGISTER(nxp_pmc_tm...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> if (chan != SENSOR_CHAN_DIE_TEMP) { return -ENOTSUP; } temp = (float)data->hot_temp - ((float)data->temp_cnt - (float)data->hot_cnt) * (((float)data->hot_temp - TEMPMON_ROOM_TEMP) / ((float)data->room_cnt - (float)data->hot_cnt)); return sensor_value_from_double(val, temp); } ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/adc.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/clock_control.h> #define DT_DRV_COMP...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e_temp = TMPSNS_GetCurrentTemperature(cfg->base); return 0; default: return -ENOTSUP; } } static DEVICE_API(sensor, tmpsns_driver_api) = { .channel_get = nxp_tmpsns_channel_get, .sample_fetch = nxp_tmpsns_channel_fetch, }; static int nxp_tmpsns_init(const struct device *dev) { tmpsns_config_t c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>T_INST_DEFINE(n, p3t1755_pm_hook); \ SENSOR_DEVICE_DT_INST_DEFINE(n, p3t1755_init, PM_DEVICE_DT_INST_GET(n), &p3t1755_data_##n, \ &p3t1755_config_##n, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, &p3t1755_driver_api...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_D<|fim_suffix|>struct device *dev, uint8_t reg, uint8_t *byte, uint8_t len); int (*get)(const struct device *dev); int (*put)(const struct device *dev); }; union p3t1755_bus_cfg { #if DT_ANY_INST_ON_BUS_STATUS_OKAY(i...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> sensor_attribute attr, struct sensor_value *val) { struct qdc_mcux_data *data = dev->data; if (ch != SENSOR_CHAN_ROTATION) { return -ENOTSUP; } switch ((enum sensor_attribute_qdec_mcux)attr) { case SENSOR_ATTR_QDEC_MOD_VAL: val->val1 = data->counts_per_revolution; return 0; case SENSOR_ATTR...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022, Prevas A/S * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_mcux_qdec #include <errno.h> #include <stdint.h> #include <fsl_enc.h> #include <fsl_xbara.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <errno.h> #include <stdint.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/arch/arch_interface.h> #ifndef M_PI #define M_PI 3.14159265358979323846 #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>#n##_data, \ &qdec_mcux_##n##_config, POST_KERNEL, \ CONFIG_SENSOR_INIT_PRIORITY, &qdec_tpm_api); DT_INST_FOREACH_STATUS_OKAY(QDEC_MCUX_INIT) <|fim_prefix|>/* * Copyright 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPA...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 CATIE * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT omron_2smpb_02e #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(O2SMPB_02E, CONFIG_SENSOR_LOG_LEVEL); /* * Calibration coefficients...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nused const float d6f_p0001_polynomial_coefficients[] = {-0.024864, 0.049944}; DT_INST_FOREACH_STATUS_OKAY_VARGS(D6F_INIT, DT_DRV_COMPAT, d6f_p0001_polynomial_coefficients) #undef DT_DRV_COMPAT #define DT_DRV_COMPAT omron_d6f_p0010 static __maybe_unused const float d6f_p0010_polynomial_coefficients[] = {...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>3905_bus_##inst, \ .ctx = &paa3905_rtio_ctx_##inst, \ }, \ }; \ \ SENSOR_DEVICE_DT_INST_DEFINE(inst, \ paa3905_init, \ NULL, \ &paa3905_data_##inst, \ &paa3905_cfg_##inst, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>vior * is detected. */ int paa3905_recover(const struct device *dev); #endif /* ZEPHYR_DRIVERS_SENSOR_PAA3905_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPi<|fim_middle|>lot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_P...
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_PAA3905_BUS_H_ #define ZEPHYR_DRIVERS_SENSOR_PAA3905_BUS_H_ #include <stdint.h> #include <zephyr/rtio/rtio.h> #include "paa3905.h" #include "paa39...
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 "paa3905.h" #include "paa3905_reg.h" #include "paa3905_decoder.h" #include <zephyr/logging/l...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ECODER_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAA3905_DECODER_H_ #define ZEPHYR_DRIVERS_SENSOR_PAA3905_DECODER_H_ #include <stdint.h> #include <zephyr/drivers/sensor....
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>RS_SENSOR_PAA3905_REG_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAA3905_REG_H_ #define ZEPHYR_DRIVERS_SENSOR_PAA3905_REG_H_ #define REG_SPI_READ_BIT 0 #define REG_SPI_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>callback context */ data->stream.dev = dev; if (!cfg->int_gpio.port) { LOG_ERR("Interrupt GPIO not supplied"); return -ENODEV; } if (!gpio_is_ready_dt(&cfg->int_gpio)) { LOG_ERR_DEVICE_NOT_READY(cfg->int_gpio.port); return -ENODEV; } err = gpio_pin_configure_dt(&cfg->int_gpio, GPIO_INPUT)...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e *dev); void paa3905_stream_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe); #endif /* ZEPHYR_DRIVERS_SENSOR_PAA3905_STREAM_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-<|fim_middle|>Identifier: Apache-2...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Paul Timke <ptimkec@live.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT pixart_paj7620 #include <zephyr/drivers/i2c.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #incl...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Paul Timke <ptimkec@live.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAJ7620_H_ #define ZEPHYR_DRIVERS_SENSOR_PAJ7620_H_ #include <zephyr/drivers/sensor/paj7620.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025 Paul Timke <ptimkec@live.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_PAJ7620_REG_H_ #define ZEPHYR_DRIVERS_SENSOR_PAJ7620_REG_H_ #include <stdint.h> /** * @file * @brief PAJ7620 Register addresses and values. Not all registers from the * data sheet are...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>is_ready_dt(&config->int_gpio)) { LOG_ERR_DEVICE_NOT_READY(config->int_gpio.port); return -ENODEV; } ret = gpio_pin_configure_dt(&config->int_gpio, GPIO_INPUT); if (ret < 0) { return ret; } gpio_init_callback(&data->gpio_cb, paj7620_gpio_callback, BIT(config->int_gpio.pin)); ret = gpio_add_...
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 pixart_pat9136 #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/spi.h> #include <zephyr/rt<|fim_suffix|>handler = conditional_write_fn, }, ...
fim
zephyrproject-rtos/zephyr
c