text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
/*
* Copyright (c) 2025 Alif Semiconductor
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <limits.h>
#include <zephyr/drivers/sensor.h>
#include "bmi323.h"
#ifdef CONFIG_SENSOR_ASYNC_API
static int32_t bmi323_centi_to_q31(int32_t centi_deg, int shift)
{
return (int32_t)(((int64_t)centi_deg * (1LL << (31 ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Alif Semiconductor
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/drivers/i2c.h>
#include "bmi323_i2c.h"
static int bosch_bmi323_i2c_read_words(const void *context, uint8_t offset, uint16_t *words,
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>V_DEFINE(inst)), ()); \
\
static const struct i2c_dt_spec i2c_spec##inst = \
I2C_DT_SPEC_INST_GET(inst); \
\
static const struct bosch_bmi323_bus bosch_bmi323_bus_api##inst = { \
.context = &i2c_spec##inst, .api = &bosch_bmi323_i2c_bus_api}
#endif /* ZEPHYR_DRIVERS_S... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>3_spi_init};
<|fim_prefix|>/*
* Copyright (c) 2023 Trackunit Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "bmi323.h"
#include <zephyr/device.h>
#include <zephyr/drivers/spi.h>
static int bosch_bmi323_spi_read_words(const void *context, uint8_t offset, uint16_t *words,
u... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Trackunit Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMI323_BMI323_SPI_H_
#define ZEPHYR_DRIVERS_SENSOR_BMI323_BMI323_SPI_H_
#include "bmi323.h"
#include <zephyr/devicetree.h>
#include <zephyr/drivers/spi.h>
#define BMI323_DEVICE_SPI... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>y(&drv_data->tregs,
raw_y, rhall, false);
drv_data->sample_z = bmm150_compensate_z(&drv_data->tregs,
raw_z, rhall);
return 0;
}
/*
* Datasheet specify raw units are 16 LSB/uT and this function converts it to
* Gauss
*/
static void bmm150_convert(struct sensor_value *val, int raw_val)
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* sensor_bmm150.h - header file for BMM150 Geomagnetic sensor driver */
/*
* Copyright (c) 2017 Intel Corporation
* Copyright (c) 2023 FTP Technologies
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMM150_BMM150_H_
#define ZEPHYR_DRIVERS_SENSOR_BMM150_BMM150_H_
#include... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>.check = bmm150_bus_check_i2c,
.read = bmm150_reg_read_i2c,
.write = bmm150_reg_write_i2c,
};
#endif /* BMM150_BUS_I2C */
<|fim_prefix|>/*
* Copyright (c) 2016, 2017 Intel Corporation
* Copyright (c) 2017 IpTronix S.r.l.
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Ap... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> .buffers = &tx_buf,
.count = 1
};
int ret;
ret = spi_write_dt(&bus->spi, &tx);
if (ret) {
LOG_DBG("spi_write FAIL %d\n", ret);
return ret;
}
return 0;
}
const struct bmm150_bus_io bmm150_bus_io_spi = {
.check = bmm150_bus_check_spi,
.read = bmm150_reg_read_spi,
.write = bmm150_reg_write_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>50_THREAD_STACK_SIZE,
bmm150_thread_main,
(void *)dev,
NULL,
NULL,
K_PRIO_COOP(CONFIG_BMM150_THREAD_PRIORITY),
0,
K_NO_WAIT);
#elif defined(CONFIG_BMM150_TRIGGER_GLOBAL_THREAD)
k_work_init(&data->work, bmm150_work_handler);
#endif
#if defined(CONFIG_BMM150_TRIGGER_GLOBAL_THREAD) || \
defi... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>;
}
break;
default:
return -EINVAL;
}
return 0;
}
static void mag_reg_to_odr(uint8_t bits, struct sensor_value *val)
{
switch (bits) {
case BMM350_DATA_RATE_1_5625HZ:
val->val1 = 1;
val->val2 = 562500;
break;
case BMM350_DATA_RATE_3_125HZ:
val->val1 = 3;
val->val2 = 125000;
break... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Bosch Sensortec GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Bus-specific functionality for BMM350s accessed via I2C.
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMM350_BMM350_H_
#define ZEPHYR_DRIVERS_SENSOR_BMM350_BMM350_H_
#include <zephyr/types.h>
#include <zephyr/device.... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>bmm350_bus_rtio = {
.check = bmm350_bus_check_rtio,
.read = bmm350_reg_read_rtio,
.write = bmm350_reg_write_rtio,
.read_async_prep = bmm350_prep_reg_read_rtio_async,
.write_async_prep = bmm350_prep_reg_write_rtio_async,
};
<|fim_prefix|>/*
* Copyright (c) 2024 Bosch Sensortec GmbH
* Copyright (c) 2... | 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 "bmm350.h"
#include "bmm350_decoder.h"
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(BMM350_DECODER, CONFIG_SENSOR_LOG_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Croxel, Inc.
* Copyright (c) 2025 CogniPilot Fou<|fim_suffix|>_decoder_compensate_raw_data(const struct bmm350_raw_mag_data *raw_data,
const struct mag_compensate *comp,
struct bmm350_mag_temp_data *out);
int bmm350_encode(const struct device *dev,
const struct sen... | 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/kernel.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/sys/check.h>
#include "bmm350.h"
#include "bmm350_stream.h"
#include "bmm350_decoder.h"
#include <zephy... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> ZEPHYR_DRIVERS_SENSOR_BMM350_STREAM_H_ */
<|fim_prefix|>/*
* Copyright (c) 2025 Croxel Inc.
* Copyright (c) 2025 CogniPilot Foundation
*
* SPDX-License-Identifier: Ap<|fim_middle|>ache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMM350_STREAM_H_
#define ZEPHYR_DRIVERS_SENSOR_BMM350_STREAM_H_
int bmm350_s... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>M350_TRIGGER_GLOBAL_THREAD)
data->dev = dev;
#endif
ret = gpio_pin_configure_dt(&cfg->drdy_int, GPIO_INPUT);
if (ret < 0) {
return ret;
}
gpio_init_callback(&data->gpio_cb, bmm350_gpio_callback, BIT(cfg->drdy_int.pin));
ret = gpio_add_callback(cfg->drdy_int.port, &data->gpio_cb);
if (ret < 0) ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* Bosch BMP180 pressure sensor
*
* Copyright (c) 2024 , Chris Ruehl
*
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://www.mouser.hk/datasheet/2/783/BST-BMP180-DS000-1509579.pdf
*/
#include <math.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* Bosch BMP180 pressure sensor
*
* Copyright (c) 2024 Chris Ruehl
*
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://www.mouser.hk/datasheet/2/783/BST-BMP180-DS000-1509579.pdf
*/
#ifndef ZEPHYR_DRIVER_SENSORS_BMP180_H
#define ZEPHYR_DRIVER_SENSORS_BMP180_H
/* Reg<|fim_suffix|>IT(5)... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>ev, val);
break;
default:
LOG_DBG("Channel not supported.");
return -ENOTSUP;
}
return 0;
}
static int bmp388_get_calibration_data(const struct device *dev)
{
struct bmp388_data *data = dev->data;
struct bmp388_cal_data *cal = &data->cal;
if (bmp388_reg_read(dev, BMP388_REG_CALIB0, (uint8_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_DATA4 0x08
#define BMP388_REG_DATA5 0x09
#define BMP388_REG_SENSORTIME0 0x0C
#define BMP388_REG_SENSORTIME1 0x0D
#define BMP388_REG_SENSORTIME2 0x0E
#define BMP388_REG_SENSORTIME3 0x0F
#define BMP388_REG_EVENT 0x10
#define BMP388_REG_INT_STATUS 0x11
#define BMP388_REG_FIFO_LENG... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2016, 2017 Intel Corporation
* Copyright (c) 2017 IpTronix S.r.l.
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
<|fim_suffix|> uint8_t reg, uint8_t val)
{
return i2c_reg_write_byte_dt(&bus->i2c, reg, val);
}
const struct bmp388_bus_io bmp3... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2016, 2017 Intel Corporation
* Copyright (c) 2017 IpTronix S.r.l.
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Bus-specific functionality for BMP388s accessed via SPI.
*/
#include <zephyr/logging/log.h>
#include "bmp388.h"
#ifdef BMP3XX_USE_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* Bosch BMP388 pressure sensor
*
* Copyright (c) 2020 Facebook, Inc. and its affiliates
*
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp388-ds001.pdf
*/
#include <zephyr/kernel.h>
#include <zephyr/pm/device... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 Badgerd Technologies B.V.
* Copyright (c) 2023 Metratec GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "bmp581.h"
#include "bmp581_bus.h"
#include "bmp581_decoder.h"
#include "bmp581_stream.h"
#include <math.h>
#include <zephyr/device.h>
#include <zephyr/drivers/g... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>OUNT_LIMIT_15 0x03
/* Interrupt configurations */
#define BMP5_INT_MODE_PULSED 0
#define BMP5_INT_MODE_LATCHED 1
#define BMP5_INT_POL_ACTIVE_LOW 0
#define BMP5_INT_POL_ACTIVE_HIGH 1
#define BMP5_INT_OD_PUSHPULL 0
#define BMP5_INT_OD_OPENDRAIN 1
/* NVM and Interrupt status asserted macros */
#define... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Croxel, Inc.
* Copyright (c) 2025 CogniPilot Foundation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "bmp581.h"
#include "bmp581_bus.h"
int bmp581_prep_reg_read_rtio_async(const struct bmp581_bus *bus,
uint8_t reg, uint8_t *buf, size_t size,
struct rti... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Croxel, Inc.
* Copyright (c) 2025 Cogni<|fim_suffix|>p581_bus *bus,
uint8_t reg, uint8_t *buf, size_t size,
struct rtio_sqe **out);
int bmp581_prep_reg_write_rtio_async(const struct bmp581_bus *bus,
uint8_t reg, const uint8_t *buf, size_t size,
... | 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/util.h>
#include "bmp581.h"
#include "bmp581_decoder.h"
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(BMP581... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2025 Croxel, Inc.
* Copyright (c) 2025 CogniPilot Foundation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMP581_DECODER_H_
#define ZEPHYR_DRIVERS_SENSOR_BMP581_DECODER_H_
#include <stdint.h>
#include <zephyr/drivers/sensor.h>
#include "bmp581.h"
struct bmp581_enco... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>m_result(dev, err);
return;
}
read_sqe->flags |= RTIO_SQE_CHAINED;
} else if ((data->stream.enabled_mask & BMP581_EVENT_FIFO_WM) != 0) {
size_t len_data = data->stream.fifo_thres * sizeof(struct bmp581_frame);
size_t len_required = sizeof(struct bmp581_encoded_data) + len_data;
err = rti... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2025 Croxel Inc.
* Copyright (c) 2025 CogniPilot Foundation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BMP581_STREAM_H_
#define ZEPHYR_DRIVERS_SENSOR_BMP581_STREAM_H_
#include <zephyr/device.h>
#include <zephyr/rtio/rtio.h>
int bmp581_stream_init(const struct dev... | 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 brcm_afbr_s50
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor_clock.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/gpio.h>
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>channel(SENSOR_CHAN_AFBR_S50_PIXELS)) == 0) {
return -ENODATA;
}
out->header.base_timestamp_ns = edata->header.timestamp;
out->header.reading_count = 32;
/* Result comes encoded in Q9.22 format */
out->shift = 9;
for (size_t i = 0 ; i < 32 ; i++) {
if (edata->payload.Pixels[i].Amplitud... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Google LLC
* Copyright (c) 2025 Croxel Inc.
* Copyright (c) 2025 CogniPilot Foundation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_AFBR_S50_DECODER_H_
#define ZEPHYR_DRIVERS_SENSOR_AFBR_S50_DECODER_H_
#include <stdint.h>
#include <zephyr/drivers... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>id afbr_s50_platform_init_hooks_add(struct afbr_s50_platform_init_node *node);
int afbr_s50_platform_get_by_id(s2pi_slave_t slave,
struct afbr_s50_platform_data **data);
int afbr_s50_platform_get_by_hnd(argus_hnd_t *hnd,
struct afbr_s50_platform_data **data);
#endif /* ZEPHYR_DRIVERS_SENSOR_BRO... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 MASSDRIVER EI
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT sensylink_cht8315
#include <zephyr/device.h>
#include <zephyr/pm/device.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/senso... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>num pm_device_action action)
{
const struct current_sense_amplifier_dt_spec *config = dev->config;
int ret;
if (config->power_gpio.port == NULL) {
return 0;
}
switch (action) {
case PM_DEVICE_ACTION_RESUME:
ret = gpio_pin_set_dt(&config->power_gpio, 1);
if (ret != 0) {
LOG_ERR("failed to ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Google LLC.
* Copyright (c) 2024 Croxel Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor_clock.h>
#include <zephyr/dsp/types.h>
#include <zephyr/logging/log.h>
#include <zephyr/rtio/work.h>
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 ENE Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ene_kb106x_tach
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/sensor.h>
#include <reg/tacho.h>
/* Device config */
struct tach_kb106x_config {
/* tachometer controller base a... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 ENE Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ene_kb1200_tach
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/sensor.h>
#include <reg/tacho.h>
/* Device config */
struct tach_kb1200_config {
/* tachometer controller base a... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>nst = { \
IF_ENABLED(CONFIG_ENS160_TRIGGER, \
(.int_gpio = GPIO_DT_SPEC_INST_GET(inst, int_gpios),)) \
COND_CODE_1(DT_INST_ON_BUS(inst, spi), \
(ENS... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Gustavo Silva
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_ENS160_ENS160_H_
#define ZEPHYR_DRIVERS_SENSOR_ENS160_ENS160_H_
#include <zephyr/types.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>
#includ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>onfig->i2c.bus);
return -ENODEV;
}
data->tf = &ens160_i2c_transfer_function;
return 0;
}
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */
<|fim_prefix|>/*
* Copyright (c) 2024 Gustavo Silva
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT sciosense_ens160
#include <zephyr/dri... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Gustavo Silva
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT sciosense_ens160
#include <zephyr/drivers/spi.h>
#include "ens160.h"
LOG_MODULE_DECLARE(ENS160, CONFIG_SENSOR_LOG_LEVEL);
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define ENS160_SPI_READ_BIT BIT... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Gustavo Silva
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_C<|fim_suffix|>ady_handler(dev, data->data_ready_trigger);
}
ens160_setup_int(dev, true);
}
#ifdef CONFIG_ENS160_TRIGGER_OWN_THREAD
static void ens160_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>struct device *dev, enum sensor_channel chan,
struct sensor_value *val)
{
struct esp32_temp_data *data = dev->data;
if (chan != SENSOR_CHAN_DIE_TEMP) {
return -ENOTSUP;
}
return sensor_value_from_double(val, data->temp_out);
}
static DEVICE_API(sensor, esp32_temp_driver_api) = {
.sample_fet... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT espressif_esp32_pcnt
/* Include esp-idf headers first to avoid redefining BIT() macro */
#include <hal/pcnt_hal.h>
#include <hal/pcnt_ll.h>
#include <hal/pcnt_types.h>
#in... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Dipak Shetty <shetty.dipak@gmx.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT everlight_als_pt19
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/adc.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/kernel.h>
#inc... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Prevas A/S
*
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://www.gassensing.co.uk/wp-content/uploads/2023/05/ExplorIR-M-Data-Sheet-Rev-4.13_3.pdf
*
*/
#define DT_DRV_COMPAT gss_explorir_m
#include <stdio.h>
#include <zephyr/kernel.h>
#include <zephyr/devic... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT fintek_f75303
#include <zephyr/device.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/pm/device.h>
#include <zephyr/pm/device_runtime.h>
#include <zephyr/logging/log.h>
#inclu... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> F75303_REMOTE1_TEMP_L 0x10
#define F75303_REMOTE2_TEMP_H 0x23
#define F75303_REMOTE2_TEMP_L 0x24
#define F75303_LOCAL_TEMP_L 0x29
struct f75303_data {
uint16_t sample_local;
uint16_t sample_remote1;
uint16_t sample_remote2;
};
struct f75303_config {
struct i2c_dt_spec i2c;
};
#endif
<|fim_prefix|>... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>reg, msgs->buf[0]);
}
break;
default:
LOG_ERR("Invalid number of messages: %d", num_msgs);
return -EIO;
}
return 0;
}
static int f75303_emul_init(const struct emul *target, const struct device *parent)
{
f75303_emul_reset(target);
return 0;
}
static int f75303_emul_set_channel(const struct... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Prevas A/S
*
* SPDX-License-Identifier: Apache-2.0
*
* Datasheet:
* https://sensorsandpower.angst-pfister.com/fileadmin/products/datasheets/272/Manual-FCX-MLD_1620-21914-0033-E-0821.pdf
*
*/
#define DT_DRV_COMPAT ap_fcx_mldx5
#include <ctype.h>
<|fim_suffix|>urn -EIO;
}
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>("Upload to host controller");
} else {
LOG_ERR("Error uploading template 0x%X",
rx_packet.buf[R502A_CC_IDX]);
ret = -EIO;
goto unlock;
}
do {
ret = transceive_packet(dev, NULL, &rx_packet, 0);
if (ret != 0) {
goto unlock;
}
ret = r502a_validate_rx_packet(&rx_packet);
if (ret ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>nst struct device *dev, const struct sensor_trigger *trig,
sensor_trigger_handler_t handler);
int grow_r502a_init_interrupt(const struct device *dev);
#endif /* CONFIG_GROW_R502A_TRIGGER */
#endif /*_GROW_R502A_H_*/
<|fim_prefix|>/*
* Copyright (c) 2021 Linumiz
*
* SPDX-License-Identifier: Apac... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2021 Linumiz
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT hzgrow_r502a
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/sens... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Adrien Leravat
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT hc_sr04
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(HC_SR04, CONFIG_SENSOR_LOG_LEVEL);
#def... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT honeywell_hmc5883l
#include <zephyr/drivers/i2c.h>
#include <zephyr/init.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/drivers/sensor.h>
#include <string.h>
#include ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>fdef CONFIG_HMC5883L_TRIGGER
const struct device *dev;
struct gpio_callback gpio_cb;
const struct sensor_trigger *data_ready_trigger;
sensor_trigger_handler_t data_ready_handler;
#if defined(CONFIG_HMC5883L_TRIGGER_OWN_THREAD)
K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_HMC5883L_THREAD_STACK_SIZE);
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>g = drv_data->dev->config;
ARG_UNUSED(pins);
gpio_pin_interrupt_configure_dt(&config->int_gpio, GPIO_INT_DISABLE);
#if defined(CONFIG_HMC5883L_TRIGGER_OWN_THREAD)
k_sem_give(&drv_data->gpio_sem);
#elif defined(CONFIG_HMC5883L_TRIGGER_GLOBAL_THREAD)
k_work_submit(&drv_data->work);
#endif
}
static v... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* mpr.c - Driver for Honeywell MPR pressure sensor series */
/*
* Copyright (c) 2020 Sven Herrmann
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT honeywell_mpr
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/drivers/sensor.h>
#inclu... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2020 Sven Herrmann
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_MPR_H_
#define ZEPHYR_DRIVERS_SENSOR_MPR_H_
#include <zephyr/drivers/i2c.h>
/* MPR output measurement command */
#define MPR_OUTPUT_MEASUREMENT_COMMAND (0xAA)
/* MPR status byte masks */
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2020 Sven Herrmann
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_MPR_CONFIGURATION_H_
#define ZEPHYR_DRIVERS_SENSOR_MPR_CONFIGURATION_H_
/*
* Pressure Range
*
* MIN is always 0
*/
#define MPR_P_MIN (0)
#if defined(CONFIG_MPR_PRESSURE_RANGE_0001)
#de... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2020, Laird Connectivity
*
* SPDX-License-I<|fim_suffix|>sensor_trigger_handler_t handler)
{
const struct sm351lt_config *const config = dev->config;
struct sm351lt_data *data = dev->data;
int ret = -ENOTSUP;
if (trig->chan == SENSOR_CHAN_PROX) {
data->changed_handler = handle... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2020, Laird Connectivity
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_SM351LT_SM351LT_H_
#define ZEPHYR_DRIVERS_SENSOR_SM351LT_SM351LT_H_
#include <stdint.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/kernel.h>
#define SENSO... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> the following code translates OSR values to an index */
for (i = 0U; i < 6 && BIT(12 - i) != osr; i++) {
}
if (i == 6U) {
return -ENOTSUP;
}
hp206c->osr = i;
return 0;
}
static int hp206c_altitude_offs_set(const struct device *dev, int16_t offs)
{
uint8_t reg_val;
reg_val = offs & 0xff;
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* HopeRF Electronic HP206C precision barometer and altimeter header
*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_HP206C_HP206C_H_
#define ZEPHYR_DRIVERS_SENSOR_HP206C_HP206C_H_
#include <zephyr/sys/util.h>
#define HP206C_I2C_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 Zephyr Project Developers
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT avia_hx711_spi
#include <zephyr/drivers/sensor/hx711.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/__assert.h>
#include "h... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2026 Zephyr Project Developers
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_HX711_SPI_HX711_SPI_H_
#define ZEPHYR_DRIVERS_SENSOR_HX711_SPI_HX711_SPI_H_
#include <zephyr/types.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/sens... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/devicetree.h>
#define DT_DRV_COMPAT iclegend_s3km1110
#include <errno.h>
#include <zephyr/device.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor/s3km... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>temperature measurement configuration */
tmp_coef_srce |= IFX_DPS310_TMP_CFG;
/* set complete configuration in one write */
const uint8_t config_seq[] = {
IFX_DPS310_REG_ADDR_PRS_CFG, /* start register address */
IFX_DPS310_PSR_CFG, /* PSR_CFG */
tmp_coef_srce, /* TMP_CFG */
0x00, /* MEA... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 SILA Embedded Solutions GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT infineon_tle9104_diagnostics
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sensor/tle9104.h>
#include <zephyr/logging/log.h>
#include "tle9104_diagnostics.h"
LOG_MODU... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>04_DIAGNOSTICS_H_ */
<|fim_prefix|>/*
* Copyright (c) 2023 SILA Embedded Solutions GmbH<|fim_middle|>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_INFINEON_TLE9104_TLE9104_DIAGNOSTICS_H_
#define ZEPHYR_DRIVERS_SENSOR_INFINEON_TLE9104_TLE9104_DIAGNOSTICS_H_
#include <stdin... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>p_dev_data_##inst; \
\
SENSOR_DEVICE_DT_INST_DEFINE(inst, xmc4xxx_temp_init, NULL, \
&xmc4xxx_temp_dev_data_##inst, NULL, \
POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \
&xmc4xxx_temp_driver_api); \
DT_INST_FOREACH_STATUS_OKAY(XMC4XXX_TEMP_DEFINE)
<|f... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>x * (1.0f / 1320));
sensor_value_from_float(val + 1, drv_data->sample_y * (1.0f / 1320));
sensor_value_from_float(val + 2, drv_data->sample_z * (1.0f / 1320));
break;
default:
return -EINVAL;
}
return 0;
}
static DEVICE_API(sensor, ist8310_api_funcs) = {
.sample_fetch = ist8310_sample_fetch,... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/* ist8310.h - header file for IST8310 Geomagnetic sensor driver */
/*
* Copyright (c) 2023 NXP Semiconductors
* Copyright (c) 2023 Cognipilot Foundation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_IST8310_IST8310_H_
#define ZEPHYR_DRIVERS_SENSOR_IST8310_IST8310_H_
#in... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>nt8_t reg, uint8_t val)
{
return i2c_reg_write_byte_dt(&bus->i2c, reg, val);
}
const struct ist8310_bus_io ist8310_bus_io_i2c = {
.check = ist8310_bus_check_i2c,
.read = ist8310_reg_read_i2c,
.write = ist8310_reg_write_i2c,
};
<|fim_prefix|>/*
* Copyright (c) 2023 NXP Semiconductors
* Copyright (c)... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> |
* | Sample Rate = TACH_FREQ / 128
* | |
* | Tachometer 2 | T2A (GPJ0)
* | | | +-----------+ |
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_PROP(inst, channel), \
.pulses_per_round = DT_INST_PROP(inst, pulses_per_round), \
}; \
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 ITE Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ite_it8xxx2_vcmp
#include <zephyr/device.h>
#include <zephyr/devicetree/io-channels.h>
#include <zephyr/drivers/adc.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/sens... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> \
IF_ENABLED(CONFIG_JC42_TRIGGER, \
(.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, int_gpios, {0}),))}; \
\
SENS... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
* Copyright (c) 2016 Intel Corporation
* Copyright (c) 2024 Vogl Electronic GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_JEDEC_JC42_H_
#define ZEPHYR_DRIVERS_SENSOR_JEDEC_JC42_H_
#include <errno.h>
#include <zeph... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019 Peter Bigot Consulting, LLC
* Copyright (c) 2024 Vogl Electronic GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/l... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>S_RATE_REG(n) \
COND_CODE_1(DT_NODE_HAS_PROP(n, measurement_rate), (DT_PROP(n, measurement_rate)), \
(DT_ENUM_IDX_OR(n, als_measurement_rate, 3)))
#define DEFINE_LTRXXX(node_id, partid) ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_SHIFT 0
#define LTR55X_MEAS_RATE_INT_TIME_MASK GENMASK(5, 3)
#define LTR55X_MEAS_RATE_INT_TIME_SHIFT 3
/* Bit masks and shift for PS_CONTR register */
#define LTR55X_PS_CONTR_MODE_MASK GENMASK(1, 0)
#define LTR55X_PS_CONTR_MODE_SHIFT 0
#define LTR55X_PS_CONTR_SAT_IND_MASK BIT(5)
#define LTR55... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>lude <zephyr/drivers/i2c.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util_macro.h>
LOG_MODULE_REGISTER(ltrf216a, CONFIG_SENSOR_LOG_LEVEL);
/*
* Driver for I2C illuminance sensor LiteOn LTR-... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>AL;
}
adc_channel_setup(cfg->adc, &cfg->ch_cfg);
return 0;
}
#define LM35_INST(inst) \
static struct lm35_data lm35_data_##inst; \
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2021 Leica Geosystems AG
* Copyright (c) 2023 Centralp
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT lm75
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/sensor.... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_SUPPORT */
#define LM77_INIT(n) \
static struct lm77_data lm77_data_##n; \
\
static const struct lm77_config lm77_config_##n = { \
.i2c = I2C_DT_SPEC_INST_GET(n), \
.config_dt = { \
.shutdown = 0, \
.int_mode = DT_INST_NODE_HAS_PROP(n, int_gpios), \
.tcrita_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_is_ready(cfg->bus) == 0) {
LOG_ERR_DEVICE_NOT_READY(cfg->bus);
return -ENODEV;
}
w1_uint64_to_rom(0ULL, &data->config.rom);
data->lazy_loaded = false;
/* in multidrop configurations the rom is need, but is not set during
* driver initialization, therefore do lazy initialization in all cases.
... | fim | zephyrproject-rtos/zephyr | c |
/* ds3231.c - Driver for Maxim DS3231 temperature sensor */
/*
* Copyright (c) 2024 Gergo Vari <work@gergovari.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/rtio/work.h>
#include <zephyr/drivers/mfd/ds3231.... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>H_
#define ZEPHYR_DRIVERS_SENSOR_DS3231_DS3231_H_
/* Temperature registers */
#define DS3231_REG_TEMP_MSB 0x11
#define DS3231_REG_TEMP_LSB 0x12
/* Temperature bitmasks */
#define DS3231_BITS_TEMP_LSB GENMASK(7, 6) /* fractional portion */
#endif
<|fim_prefix|>/*
* Copy<|fim_middle|>right (c) 2024 Gerg... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2020 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(max17055, CONFIG_SENSOR_LOG_LEVEL);
#include ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_empty;
};
#endif
<|fim_prefix|>/*
* Copyright 2020 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BATTERY_MAX17055_H_
#define ZEPHYR_DRIVERS_SENSOR_BATTERY_MAX17055_H_
#include <zephyr/drivers/i2c.h>
/* Register addresses */
enum {
STATUS = 0x0,
REP... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2021 Matija Tudan
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/sensor.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(max17262, CONFIG_SENSOR_LOG_LEVEL);
#include "max17262.h"
#define DT_DRV_COM... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>e;
/* Defined charge voltage value in mV */
uint16_t charge_voltage;
};
#endif
<|fim_prefix|>/*
* Copyright 2021 Matija Tudan
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_SENSOR_BATTERY_MAX17262_H_
#define ZEPHYR_DRIVERS_SENSOR_BATTERY_MAX17262_H_
#include <zephyr/drivers/i2c... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2017, NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT maxim_max30101
#include <zephyr/logging/log.h>
#include "max30101.h"
LOG_MODULE_REGISTER(MAX30101, CONFIG_SENSOR_LOG_LEVEL);
static int max30101_sample_fetch(const struct device *dev,
enum sensor_ch... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>ASK (1 << 4)
#define MAX30101_MODE_CFG_SHDN_MASK (1 << 7)
#define MAX30101_MODE_CFG_RESET_MASK (1 << 6)
#define MAX30101_SPO2_ADC_RGE_SHIFT 5
#define MAX30101_SPO2_SR_SHIFT 2
#define MAX30101_SPO2_PW_SHIFT 0
#define MAX30101_PART_ID 0x15
#define MAX30101_BYTES_PER_CHANNEL 3
#define MAX30101_MAX_NUM... | fim | zephyrproject-rtos/zephyr | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.