text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* ST Microelectronics LSM6DSVXXX family IMU sensor * * Copyright (c) 2025 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/lsm6dsv320x.pdf */ #define DT_DRV_COMPAT st_lsm6dsvxxx #include <zephyr/kernel.h> #include <zephyr/drive...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* lsm9ds0_gyro.c - Driver for LSM9DS0 gyroscope sensor */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_lsm9ds0_gyro #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/init.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* sensor_lsm9ds0_gyro.h - header file for LSM9DS0 gyroscope sensor driver */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_LSM9DS0_GYRO_LSM9DS0_GYRO_H_ #define ZEPHYR_DRIVERS_SENSOR_LSM9DS0_GYRO_LSM9DS0_GYRO_H_ #include <zephyr/types...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>st struct lsm9ds0_gyro_config * const config = dev->config; struct lsm9ds0_gyro_data *data = dev->data; data->dev = dev; k_sem_init(&data->sem, 0, K_SEM_MAX_LIMIT); k_thread_create(&data->thread, data->thread_stack, CONFIG_LSM9DS0_GYRO_THREAD_STACK_SIZE, lsm9ds0_gyro_thread_main, (v...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>LSM9DS0_MFD_MASK_CTRL_REG1_XM_AZEN, (LSM9DS0_MFD_ACCEL_ENABLE_X << LSM9DS0_MFD_SHIFT_CTRL_REG1_XM_AXEN) | (LSM9DS0_MFD_ACCEL_ENABLE_Y << LSM9DS0_MFD_SHIFT_CTRL_REG1_XM_AYEN) | (LSM9DS0_MFD_ACCEL_ENABLE_Z << LSM9DS0_MFD_SHIFT_CTRL_REG1_XM_AZEN)) < 0) { LOG_DBG("f...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* sensor_lsm9ds0_mfd.h - header file for LSM9DS0 accelerometer, magnetometer * and temperature (MFD) sensor driver */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_LSM9DS0_MFD_LSM9DS0_MFD_H_ #define ZEPHYR_DRIVERS_SENSOR_LSM9DS0...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Bootlin * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_lsm9ds1 #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/pm/device.h> #include "lsm9ds1.h" #include <stmemsc.h> LOG_MODULE_REGISTER(LSM9DS1, CONFIG_SENSOR_LOG_LEVE...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ain; uint16_t accel_odr; uint16_t gyro_odr; #if defined(CONFIG_LSM9DS1_ENABLE_TEMP) int16_t temp_sample; #endif }; #endif /* ZEPHYR_DRIVERS_SENSOR_LSM9DS1_LSM9DS1_H_ */ <|fim_prefix|>/* * Copyright (c) 2024 Bootlin * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_LSM9DS1_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Bootlin * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_lsm9ds1_mag #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "lsm9ds1_mag.h" #include <stmemsc.h> LOG_MODULE_REGISTER(LSM9DS1_MAG, CONFIG_SENSOR_LOG_LEVEL); /* Sensitivity...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Bootlin * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_LSM9DS1_MAG_LSM9DS1_MAG_H_ #define ZEPHYR_DRIVERS_SENSOR_LSM9DS1_MAG_LSM9DS1_MAG_H_ #include "lsm9ds1_reg.h" #if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) #include <zephyr/drivers/spi.h> #endif /* DT_ANY_INST_ON_BU...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022, Valerio Setti <vsetti@baylibre.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_stm32_qdec /** @file * @brief STM32 family Quadrature Decoder (QDEC) driver. */ #include <errno.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/util.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>fig *cfg = dev->config; DTS_TypeDef *dts = cfg->base; /* Disable interrupt */ stm32_reg_clear_bits(&dts->ITENR, DTS_ITENR_TS1_ITEEN); /* Disable the sensor */ stm32_reg_clear_bits(&dts->CFGR1, DTS_CFGR1_TS1_EN); } #endif static int stm32_digi_temp_init(const struct device *dev) { const struct stm...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> = ADC_ACQ_TIME_MAX, .channel_id = DT_INST_IO_CHANNELS_INPUT(0), .differential = 0 }, #if defined(HAS_CALIBRATION) .ts_cal1 = INIT_PARAMETER(0, ts_cal1), .ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp), #if defined(HAS_SINGLE_CALIBRATION) .average_slope = ((float)DT_INST_STRING_UNQUOTED(0, avgslope)...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uffer_size = sizeof(data->sample_buffer), .resolution = 12U, #ifdef CONFIG_STM32_VBAT_INJECTED .priority = 1, #endif /* CONFIG_STM32_VBAT_INJECTED */ }; #ifdef CONFIG_STM32_VBAT_INJECTED int rc = adc_channel_setup(data->adc, &data->adc_cfg); if (rc != 0) { LOG_DBG("Setup AIN%u got %d", data->ad...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>AS_STM32_UNCACHED_ACCESS_ONLY_OTP)) { sys_cache_instr_disable(); } vrefint_cal = *cfg->vrefint_cal; if (IS_ENABLED(CONFIG_HAS_STM32_UNCACHED_ACCESS_ONLY_OTP)) { sys_cache_instr_enable(); } #endif /* CONFIG_STM32_VREF_READ_CALIB_VIA_NVMEM */ data->vrefint_cal_numerator = cfg->cal_mv * (vrefint_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STMEMS hal i/f * * Copyright (c) 2021 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * zephyrproject-rtos/modules/hal/st/sensor/stmemsc/ */ #ifndef ZEPHYR_DRIVERS_SENSOR_STMEMSC_STMEMSC_H_ #define ZEPHYR_DRIVERS_SENSOR_STMEMSC_STMEMSC_H_ #include <zephyr/kerne...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STMEMS hal i/f * * Copyright (c) 2021 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * zephyrproject-rtos/modules/hal/st/sensor/stmemsc/ */ #include "stmemsc.h" /* Enable address auto-increment on some stmemsc sensors */ #define STMEMSC_I2C_ADDR_AUTO_INCR BI...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STMEMS hal i/f * * Copyright (c) 2021 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * zephyrproject-rtos/modules/hal/st/sensor/stmemsc/ */ #include "stmemsc.h" int stmemsc_i3c_read(void *stmemsc, uint8_t reg_addr, uint8_t *value, uint8_t len) { struct...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STMEMS hal i/f * * Copyright (c) 2<|fim_suffix|>tifier: Apache-2.0 * * zephyrproject-rtos/modules/hal/st/sensor/stmemsc/ */ #include "stmemsc.h" void stmemsc_mdelay(uint32_t millisec) { k_msleep(millisec); } <|fim_middle|>024 STMicroelectronics * * SPDX-License-Iden<|endof...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> 0) * transaction #2: write "len" byte of data */ const struct spi_buf tx_buf[2] = { { .buf = buffer_tx, .len = 1, }, { .buf = value, .len = len, } }; const struct spi_buf_set tx = { .buffers = tx_buf, .count = 2 }; return spi_write_dt(stmemsc, &tx); } int stmemsc_spi_read_incr(const struc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STTS22H temperature sensor * * Copyright (c) 2024 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/stts22h.pdf */ #define DT_DRV_COMPAT st_stts22h #include <zephyr/drivers/sensor.h> #include <zephyr/kernel...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STTS22H temperature sensor * * Copyright (c) 2024 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/stts22h.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_STTS22H_STTS22H_H_ #define ZEPHYR_DRIVERS_SENSOR_STTS22H_STTS2...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STTS22H temperature sensor * * Copyright (c) 2024 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/stts22h.pdf */ #define DT_DRV_COMPAT st_stts22h #include <zephyr/kernel.h> #include <zephyr/drivers/sensor...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STTS751 temperature sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/stts751.pdf */ #define DT_DRV_COMPAT st_stts751 #include <zephyr/drivers/sensor.h> #include <zephyr/kernel...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* ST Microelectronics STTS751 temperature sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://www.st.com/resource/en/datasheet/stts751.pdf */ #ifndef ZEPHYR_DRIVERS_SENSOR_STTS751_STTS751_H_ #define ZEPHYR_DRIVERS_SENSOR_STTS751_STTS7...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>i2c.mdelay = (stmdev_mdelay_ptr) stmemsc_mdelay, data->ctx = &data->ctx_i2c; data->ctx->handle = (void *)dev; return 0; } #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ <|fim_prefix|>/* ST Microelectronics STTS751 temperature sensor * * Copyright (c) 2019 STMicroelectronics * * SPDX-License-Ide...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>>int_gpio.port, &stts751->gpio_cb) < 0) { LOG_DBG("Could not set gpio callback"); return -EIO; } /* Enable interrupt on high temperature */ float temp_hi = (float) CONFIG_STTS751_TEMP_HI_THRESHOLD; float temp_lo = (float) CONFIG_STTS751_TEMP_LO_THRESHOLD; stts751_high_temperature_threshold_set(...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l0x.c - Driver for ST VL53L0X time of flight sensor */ #define DT_DRV_COMPAT st_vl53l0x /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l0x_platform.c - Zephyr customization of ST vl53l0x library. * (library is located in ext/hal/st/lib/sensor/vl53l0x/) */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #include "vl53l0x_platform.h" #include <zephyr/drivers/sensor.h> #include <zephyr/k...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uccess * @return "Other error code" See ::VL53L0X_Error */ VL53L0X_Error VL53L0X_UpdateByte(VL53L0X_DEV Dev, uint8_t index, uint8_t AndData, uint8_t OrData); /** @} end of VL53L0X_registerAccess_group */ /** * @brief execute delay in all polling API call * * A typical multi-thread or RTOs...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>RGS__) #ifdef __cplusplus } #endif #endif /* ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_PLATFORM_LOG_H_ */ <|fim_prefix|>/* vl53l0x_platform_log.h - Zephyr customization of ST vl53l0x library, * logging functions, not implemented */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifie...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>oint1616_t; #endif /* ZEPHYR_DRIVERS_SENSOR_VL53L0X_VL53L0X_TYPES_H_ */ <|fim_prefix|>/* vl53l0x_types.h - Zephyr customization of ST vl53l0x library, * basic type definition. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifnd<|fim_middle|>ef ZEPHYR_DRI...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1.c - Driver for ST VL53L1X time of flight sensor */ /* * Copyright (c) 2023 Prosaris SOlutions Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_vl53l1x #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1_platform.c - Zephyr customization of ST vl53l1x library. */ /* * Copyright (c) 2023 Prosaris Solutions Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "vl53l1_platform.h" #include "vl53l1_platform_log.h" #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zep...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1_platform.h - Zephyr customization of ST vl53l1x library. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_PLATFORM_H_ #define ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_PLATFORM_H_ #include <string.h> #include ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ction(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL,\ "%6ld <E> %s %d\n", LOG_GET_TIME(), __func__, (int)status, ##__VA_ARGS__) #define _LOG_FUNCTION_END_FMT(module, status, fmt, ...)\ VL53L1_trace_print_module_function(module, _trace_level, VL53L1_TRACE_FUNCTION_ALL,\ "%6ld <E> %s %d "fmt"\n", ...
fim
zephyrproject-rtos/zephyr
c
/* vl53l1x_platform_user_config.h - Zephyr customization of ST vl53l1x library. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef _VL53L1_PLATFORM_USER_CONFIG_H_ #define _VL53L1_PLATFORM_USER_CONFIG_H_ #define VL53L1_BYTES_PER_WORD 2 #define VL53L...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1_platform_user_data.h - Zephyr customization of ST vl53l1x library. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_PLATFORM_USER_DATA_H_ #define ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_PLATFORM_USER_DATA_H_ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1x_platform_user_defines.h - Zephyr customization of ST vl53l1x library. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef _VL53L1_P<|fim_suffix|>NINGS() { \ __pragma(warning(pop)); \ } #else #define DISABLE_WARNINGS() #define ENABLE_WARNING...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* vl53l1_types.h - Zephyr customization of ST vl53l1x library, basic type definition. */ /* * Copyright (c) 2017 STMicroelectronics * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_TYPES_H_ #define ZEPHYR_DRIVERS_SENSOR_VL53L1X_VL53L1_TYPES_H_ /* Zephyr prov...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* sensor_sx9500.c - Driver for Semtech SX9500 SAR proximity chip */ /* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT semtech_sx9500 #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sens...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SX9500_SX9500_H_ #define ZEPHYR_DRIVERS_SENSOR_SX9500_SX9500_H_ #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #define SX9500_REG_IRQ_SRC 0x00 #d...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT semtech_sx9500 #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/util.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>n ret; } gpio_init_callback(&data->gpio_cb, tach_gpio_cb, BIT(config->gpio.pin)); ret = gpio_add_callback_dt(&config->gpio, &data->gpio_cb); if (ret < 0) { LOG_DBG("Add gpio callback failed: %d", ret); return ret; } data->dev = dev; k_sem_init(&data->data_ready, 0, 1); return 0; } #defin...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> struct icm40627_data *data = dev->data; const struct icm40627_config *cfg = dev->config; /* start up time for register read/write after POR is 1ms and supply ramp time is 3ms */ k_msleep(3); /* perform a soft reset to ensure a clean slate, reset bit will auto-clear */ res = cfg->bus_io->write(&cfg...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 PHYTEC America LLC * Author: Florijan Plohl <florijan.plohl@norik.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM40627_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM40627_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #include ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t8_t bank = FIELD_GET(REG_BANK_MASK, reg); uint8_t address = FIELD_GET(REG_ADDRESS_MASK, reg); res = i2c_read_bank(bus, address, bank, data, len); return res; } static inline int i2c_write_bank(const union icm40627_bus *bus, uint16_t reg, uint8_t bank, uint8_t buf) { int res = i2c_reg_write_by...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>EL_MODE_LNM 0x03 #define MASK_GYRO_MODE GENMASK(3, 2) #define BIT_GYRO_MODE_OFF 0x00 #define BIT_GYRO_MODE_STBY 0x01 #define BIT_GYRO_MODE_LNM 0x03 #define BIT_IDLE BIT(4) #define BIT_ACCEL_LP_CLK_SEL BIT(7) /* Bank0 REG_INT_SOURCE0 */ #define BIT_INT_AGC_RDY_INT1_EN BIT(0)...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 PHYTEC America LLC * Author: Florijan Plohl <florijan.plohl@norik.com> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/sys/util.h> #include "icm40627.h" #include "icm40627_reg.h" #include "icm40627_trig...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 PHYTEC America LLC * Author: Florijan Plohl <florijan.plohl@norik.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM40627_TRIGGER_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM40627_TRIGGER_H_ #include <zephyr/device.h> /** implement the trigger_set sen...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ SPI_MODE_CPHA | \ SPI_WORD_SET(8) | \ SPI_TRANSFER_MSB), \ .gpio_int = GPIO_DT_SPEC_INST_GET(index, int_gpios), \ .accel_hz = DT_INST_PROP(index, accel_hz), \ .gyro_hz = DT_INST_PROP(index, gyro_hz), \ .accel_fs = DT_INST_ENUM_IDX(index, accel_fs), \ .gyro_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_H_ #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel....
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_REG_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_REG_H_ /* BANK 0 */ #define REG_DEVICE_CONFIG 0x11 #define REG_DRIVE_CONFIG 0x13 #define REG_INT_CONFIG 0x14 #defi...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>urn result; } result = inv_spi_read(&cfg->spi, REG_INTF_CONFIG0, &v, 1); if (result) { LOG_ERR("Read REG_INTF_CONFIG0 failed"); return result; } LOG_DBG("Read REG_INTF_CONFIG0 0x%X", v); v |= BIT_UI_SIFS_DISABLE_I2C; result = inv_spi_single_write(&cfg->spi, REG_INTF_CONFIG0, &v); if (res...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #if<|fim_suffix|> device *dev); int icm42605_set_odr(const struct device *dev, int a_rate, int g_rate); #endif /* __SENSOR_ICM42605_ICM42605_SETUP__ */ <|fim_middle|>ndef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SETUP_H...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/sys/__assert.h> #include "icm42605_spi.h" LOG_MODULE_DECLARE(ICM42605, CONFIG_SENSOR_LOG_LEVEL); int inv_spi_single_write(const struct spi_dt_spec *bus, uint8_t reg, ui...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SPI_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM42605_ICM42605_SPI_H_ #include <zephyr/device.h> #include <zephyr/drivers/spi.h> int inv_spi_single_write(const struct spi_dt_<|f...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "icm42605.h" #include "icm42605_setup.h" ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2022 Esco Medical ApS * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT invensense_icm4268x #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/icm4268x.h> #include <zephyr/drivers/spi.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ues * * @param cfg icm4268x_cfg current device configuration * @param in raw data value in int32_t format * @param out_rads whole rad/s output in int32_t * @param out_urads microrad/s as int32_t */ static inline void icm4268x_gyro_rads(const struct icm4268x_cfg *cfg, int32_t in, int32_t *out_rads, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> = rtio_cqe_consume(ctx); if (cqe != NULL) { ret = cqe->result; rtio_cqe_release(ctx, cqe); } } while (cqe != NULL); return ret; } int icm4268x_reg_write_rtio(const struct icm4268x_bus *bus, uint8_t reg, const uint8_t *buf, int size) { struct rtio *ctx = bus->rtio.ctx; struct rtio_c...
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_ICM4268X_ICM4268X_BUS_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM4268X_ICM4268X_BUS_H_ #include <zephyr/kernel.h> #include <zephyr/rtio/rtio.h> struct i...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2022 Esco Medical ApS * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/icm4268x.h> #include <zephyr/drivers/spi.h> #include <zephyr/sys/byteorde...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>er = frame_end; continue; } data->readings[count].timestamp_delta = ts_delta; q31_t reading[3]; for (int i = 0; i < 3; i++) { rc |= icm4268x_read_imu_from_packet( buffer, true, edata->header.accel_fs, i, &reading[i]); } for (int i = 0; i < 3; i++) { data->readings[co...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DR<|fim_suffix|>header header; struct { uint8_t channels: 7; uint8_t reserved: 1; } __attribute__((__packed__)); int16_t readings[7]; }; int icm4268x_encode(const struct device *dev, const struct sen...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** This test is exclusive for icm42688 so let's restrict it for now. */ #define DT_DRV_COMPAT invensense_icm42688 #include <zephyr/device.h> #include <zephyr/drivers/emul.h> #include <zephyr/drivers/emul_sensor.h> #include <...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>UL_H */ <|fim_prefix|>/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #ifndef DRIVERS_SENSOR_ICM4268X_ICM4268X_EMUL_H #define DRIVERS_SENSOR_ICM4268X_ICM4268X_EMUL_H #include <zephyr/drivers/emul.h> /** * @brief Set one or more register values * * @param target The tar...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>-000347 */ #define MASK_ACCEL_AAF_DELTSQR_7_0 GENMASK(7, 0) /* Bank2 ACCEL_CONFIG_STATIC4 See section 5.x of DS-000347 */ #define MASK_ACCEL_AAF_BITSHIFT GENMASK(7, 4) #define MASK_ACCEL_AAF_DELTSQR_11_8 GENMASK(3, 0) /* Bank3 CLKDIV */ #define MASK_CLKDIV GENMASK(6, 0) /* misc. defines */ #define ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>icm4268x_encoded_data *edata; /* Get the buffer for the frame, it may be allocated dynamically by the rtio context */ rc = rtio_sqe_rx_buf(iodev_sqe, min_buf_len, min_buf_len, &buf, &buf_len); if (rc != 0) { LOG_ERR("Failed to get a read buffer of size %u bytes", min_buf_len); rtio_iodev_sqe_err(i...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM4268X_RTIO_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM4268X_RTIO_H_ #include <zephyr/device.h> #include <zephyr/rtio/rtio.h> void icm4268x_submit(const struct device *sensor, struct rtio_iodev_sqe *iodev_sqe);...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ig.interrupt1_fifo_full = true; break; default: LOG_DBG("Trigger (%d) not supported", cfg->triggers[i].trigger); rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); return; } } if (new_config.interrupt1_drdy != data->cfg.interrupt1_drdy || new_config.interrupt1_fifo_ths != data->cfg.interrupt...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>le_write(const struct spi_dt_spec *bus, uint16_t reg, uint8_t data) { int res = 0; uint8_t address = FIELD_GET(REG_ADDRESS_MASK, reg); res = spi_write_register(bus, address, data); return res; } <|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_spi_read(const struct spi_dt_spec *bus, uint16_t reg, uint8_t *data, size_t len); #endif /* ZEPHYR_DRIVERS_SENSOR_ICM4268X_SPI_H_ */ <|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM4268X_SPI_H_ #define ZEPHYR_DRIVER...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> #include <zephyr/sys/util.h> #include "icm4268x.h" #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>trigger_enable_interrupt(const struct device *dev, struct icm4268x_cfg *new_cfg); /** * @brief lock access to the icm4268x device driver * * @param dev icm4268x device pointer */ void icm4268x_lock(const struct device *dev); /** * @brief lock access to the icm4268x device driver * * @param dev ic...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include "icm42670.h" #include <zephyr/drivers/sensor/icm42x70.h> #include <zephyr/sys/byteorder.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(ICM42670, CONFIG_SENSOR_LOG_LEVEL); static uint32_t convert_gyr_fs_to_bitfield...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>st struct device *dev); uint16_t convert_bitfield_to_gyr_fs(uint8_t bitfield); #endif /* ZEPHYR_DRIVERS_SENSOR_ICM42670_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42670_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM426...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 TDK Invensense * Copyright (c) 2022 Esco Medical ApS * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/pm/dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 TDK Invensense * Copyright (c) 2022 Esco Medical ApS * Copyright (c) 2020 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM42X70_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM42X70_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>tus2, int_status3; /* Read APEX interrupt status */ rc |= inv_imu_read_reg(&data->driver, INT_STATUS2, 1, &int_status2); rc |= inv_imu_read_reg(&data->driver, INT_STATUS3, 1, &int_status3); /* Test Pedometer interrupt */ if (int_status3 & (INT_STATUS3_STEP_DET_INT_MASK)) { inv_imu_apex_step_activ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 TDK Invensense * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ /* * Bus-specific functionality for ICM42X70 accessed via I2C. */ #include "icm42x70.h" #if CONFIG_I2C static int icm42x70_bus_check_i2c(const union icm42...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> return ret; } return 0; } const struct icm42x70_bus_io icm42x70_bus_io_spi = { .check = icm42x70_bus_check_spi, .read = icm42x70_reg_read_spi, .write = icm42x70_reg_write_spi, }; #endif /* CONFIG_SPI */ <|fim_prefix|>/* * Copyright (c) 2024 TDK Invensense * Copyright (c) 2022 Esco Medical ApS ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>, struct icm42x70_data, work); icm42x70_thread_cb(data->dev); } #endif int icm42x70_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) { struct icm42x70_data *data = dev->data; const struct icm42x70_config *cfg = dev->config; if (!handler...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ce *dev); /** * @brief lock access to the icm42x70 device driver * * @param dev icm42x70 device pointer */ void icm42x70_unlock(const struct device *dev); #endif /* ZEPHYR_DRIVERS_SENSOR_ICM42X70_TRIGGER_H_ */ <|fim_prefix|>/* * Copyright (c) 2022 Esco Medical ApS * * SPDX-License-Identifier: Apa...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT invensense_icm45686 #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/i2c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>icm45686_apex_enable_tilt(inv_imu_device_t *s); int icm45686_apex_enable_smd(inv_imu_device_t *s); int icm45686_apex_enable_wom(inv_imu_device_t *s); #endif #endif /* ZEPHYR_DRIVERS_SENSOR_ICM45686_H_ */ <|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2025 Croxel Inc. * Copyrig...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>= icm456xx_adv_enable_wom(s); return rc; } int icm45686_apex_enable_tap(inv_imu_device_t *s) { int rc = 0; inv_imu_edmp_int_state_t apex_int_config; rc = icm456xx_edmp_get_config_int_apex(s, &apex_int_config); apex_int_config.INV_TAP = INV_IMU_ENABLE; /* Apply interrupt configuration */ rc |= ic...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>686_BUS_I3C) { write_buf_sqe->iodev_flags |= RTIO_IODEV_I3C_STOP; } else { /* SPI does not require setting additional flags to the write-buf SQE */ } /** Send back last SQE so it can be concatenated later. */ if (out) { *out = write_buf_sqe; } return 2; } int icm45686_reg_read_rtio(const st...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>*/ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM45686_ICM45686_BUS_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM45686_ICM45686_BUS_H_ #include <zephyr/kernel.h> #include <zephyr/rtio/rtio.h> #include <zephyr/drivers/i3c.h> enum icm45686_bus_type { ICM45686_BUS_I2C, ICM45686_BUS_SPI, ICM45686_BUS_I3C, }; struct icm45686...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>an_spec chan_spec, uint32_t *fit, uint16_t max_count, void *data_out) { struct icm45686_encoded_data *edata = (struct icm45686_encoded_data *)buffer; uint8_t channel_request; int err; if (*fit != 0) { return 0; } if (max_count == 0 || chan_spec.chan_idx != 0) { return -EINVAL; } swi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * Copyright (c) 2025 Croxel Inc. <|fim_suffix|>ODER_H_ #include <stdint.h> #include <zephyr/drivers/sensor.h> #include "icm45686.h" int icm45686_encode(const struct device *dev, const struct sensor_chan_spec *const channels, const size_t num_channels, uint8_t ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM45686_REG_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM45686_REG_H_ #include <zephyr/sys/util.h> #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; default: LOG_ERR("Unsupported trigger (%d)", read_cfg->triggers[i].trigger); rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); return; } } __ASSERT(stream.settings.enabled.drdy ^ ((stream.settings.enabled.fifo_ths || stream.settings.enabled.fifo_full)), "DRDY should not be enabled alongsid...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>STREAM_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICM45686_STREAM_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM45686_STREAM_H_ int icm45686_stream_init(const struct device *dev); ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * Copyright (c) 2023 Google LLC * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/gpio.h> #include "icm45686.h" #include "icm4...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2022 Intel Corporation * 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_ICM45686_TRIGGER_H_ #define ZEPHYR_DRIVERS_SENSOR_ICM45686_TRIGGER_H_ #include <zephyr/d...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t = { \ .i2c = I2C_DT_SPEC_INST_GET(inst), \ .mode = DT_INST_ENUM_IDX(inst, mode), \ }; \ S...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 TDK Invensense * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ICP101XXX_ICP101XXX_H_ #define ZEPHYR_DRIVERS_SENSOR_ICP101XXX_ICP101XXX_H_ #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/i2c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> if (rc < 0) { LOG_ERR("Failed to initialize interrupt."); return rc; } } /* successful init, return 0 */ return 0; } void icp201xx_mutex_lock(const struct device *dev) { #ifdef CONFIG_ICP201XX_TRIGGER const struct icp201xx_config *config = dev->config; if (config->gpio_int.port) { struc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>uct sensor_trigger *threshold_trigger; struct k_mutex mutex; #ifdef CONFIG_ICP201XX_TRIGGER_OWN_THREAD K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ICP201XX_THREAD_STACK_SIZE); struct k_thread thread; struct k_sem gpio_sem; #endif #ifdef CONFIG_ICP201XX_TRIGGER_GLOBAL_THREAD struct k_work work; #endif ...
fim
zephyrproject-rtos/zephyr
c