text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* * Copyright (c) 2025 Ambiq Micro Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ambiq_sdio #include <zephyr/devicetree.h> #include <zephyr/kernel.h> #include <zephyr/cache.h> #include <zephyr/irq.h> #include <zephyr/drivers/sdhc.h> #include <zephyr/drivers/pinctrl.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Realtek Semiconductor Corp. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT realtek_ameba_sdhost /* Include <soc.h> before <ameba_soc.h> to avoid redefining unlikely() macro */ #include <soc.h> #include <ameba_soc.h> #include <ze<|fim_suffix|>resent(const st...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bflb_sdhc #include <zephyr/drivers/sdhc.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include <zephyr/sys/util....
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (C) 2023 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT cdns_sdhc #include <zephyr/drivers/sdhc.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/reset.h> #include "sdhc_cdns_ll.h" #define SDHC_C...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> SDR12 and SDR_BC */ if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_DS) || (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_UHS_SDR12) || (cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == EMMC_SDR_BC)) { sdclkfsval = 4; } else if ((cdn_sdmmc_dev_type_params->cdn_sdmmc_dev_type == SD_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (C) 2023 Intel Corporation * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/cache.h> #include <zephyr/drivers/sdhc.h> /* HRS09 */ #define CDNS_HRS09_PHY_SW_RESET BIT(0) #define CDNS_HRS09_PHY_INIT_COMP BIT(1) #define CDNS_HRS09_EXT_WR_MODE BIT(3) #define CDNS_HRS09_RDCMD_EN_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>!= NULL) { ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT); if (ret < 0) { LOG_ERR("Failed to configure SDHC I/O pins"); return -EINVAL; } } if (!device_is_ready(cfg->clock_dev)) { return -ENODEV; } ret = clock_control_on(cfg->clock_dev, cfg->clock_subsys); if (ret != 0)...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #define SDMMC_FREQ_DEFAULT 20000 /*!< SD/MMC Default speed (limited by clock divider) */ #define SDMMC_FREQ_HIGHSPEED 40000 /*!< SD High speed (limited by clock divider) */ #define SDMMC_FREQ_P...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SDHC_SDHC_HELPERS_H_ #define ZEPHYR_DRIVERS_SDHC_SDHC_HELPERS_H_ /** * @brief Convert enum sd_voltage to a human-readable string * * @param voltage Enum value ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; } } while ((result != 0) && (--retry > 0UL)); if (result == 0) { result = k_sem_take(&sdhc_data->transfer_sem, K_MSEC(data->timeout_ms)); if (result != 0U) { LOG_ERR("Cannot take sem!"); } #if defined(CONFIG_CPU_HAS_DCACHE) && defined(__DCACHE_PRESENT) && __DCACHE_PRESENT if (data_Confi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT litex_mmc #include <errno.h> #include <zephyr/drivers/sdhc.h> #include <zephyr/sys/util_macro.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>SDHC_LIB_CMD12; break; case SD_SEND_STATUS: *cmd = MXC_SDHC_LIB_CMD13; break; case SD_SET_BLOCK_SIZE: *cmd = MXC_SDHC_LIB_CMD16; break; case SD_READ_SINGLE_BLOCK: *cmd = MXC_SDHC_LIB_CMD17; break; case SD_READ_MULTIPLE_BLOCK: *cmd = MXC_SDHC_LIB_CMD18; break; case SD_SET_BLOCK_COUNT...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ \ static const struct sdhc_numaker_config sdhc_numaker_config_##inst = { \ .base = (SDH_T *)DT_INST_REG_ADDR(inst), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>cmd = true; } else { priv->app_cmd = false; } k_sem_give(&priv->thread_lock); return ret; } static int sdhc_ra_reset(const struct device *dev) { struct sdhc_ra_priv *priv = dev->data; const struct sdhc_ra_config *cfg = dev->config; k_sem_take(&priv->thread_lock, K_USEC(50)); /* Reset SDHI. ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>UCCESS: ret = 0; break; case FSP_ERR_TIMEOUT: ret = -ETIMEDOUT; break; case FSP_ERR_NOT_FOUND: ret = -ENODEV; /* SD card not inserted (requires CD signal) */ break; case FSP_ERR_INVALID_STATE: ret = -EACCES; /* SD card write-protected (requires WP signal) */ break; case FSP_ERR_RESPONS...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>or SPI SD card to stop sending busy signal */ static int sdhc_spi_wait_unbusy(const struct device *dev, int timeout_ms, int interval_ticks) { const struct sdhc_spi_config *config = dev->config; struct sdhc_spi_data *data = dev->data; int ret; uint8_t response; while (timeout_ms > 0) { ret = sdhc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 EXALT Technologies. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_stm32_sdmmc #include <stm32_bitops.h> #include <zephyr/cache.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/clock_control/stm32_clock_control.h> #include <zephyr/dri...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Advanced Micro Devices, Inc. (AMD) * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT xlnx_versal_8_9a #include <stdio.h> #include <zephyr/kernel.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/sdhc.h> #include <zephyr/sd/sd_spec.h> #include <zephyr/s...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>volatile uint16_t preset_val_1; /**< Preset Value 1 */ volatile uint16_t preset_val_2; /**< Preset Value 2 */ volatile uint16_t preset_val_3; /**< Preset Value 3 */ volatile uint16_t preset_val_4; /**< Preset Value 4 */ volatile uint16_t preset_val_5; /**< Preset Value 5 */ volatile uint16_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 SteadConnect * * SPDX-License-Identifier: Apache-2.0 * * Datasheet: * https://wiki.dfrobot.com/A01NYUB%20Waterproof%20Ultrasonic%20Sensor%20SKU:%20SEN0313 * */ #define DT_DRV_COMPAT dfrobot_a01nyub #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/dri...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>0000) / 65536 */ uint64_t scaled_pos = ((uint64_t)data->position * 360 * 1000000) >> AD2S1210_MAX_RESOLUTION_BITS; val->val1 = scaled_pos / 1000000; val->val2 = scaled_pos % 1000000; } break; case SENSOR_CHAN_RPM: { /* Get max range from lookup table */ int32_t range = table_velocity_rang...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Filip Stojanovic <filipembedded@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_ade7978 #include <zephyr/device.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include "ade7978.h" LOG_MOD...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Filip Stojanovic <filipembedded@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADE7978_H_ #define ZEPHYR_DRIVERS_SENSOR_ADE7978_H_ #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drive...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>sistor, 1), \ .pins_v1_v2.voltage_divider_resistors.v1_r1_r2 = \ DT_INST_PROP_OR(inst, pin_v1_voltage_divider_resistors, NULL), \ .pins_v1_v2.voltage_divider_resistors.v2_r1_r2 = \ DT_INST_PROP_OR...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>2990_NUM_REGS); } static int adltc2990_emul_handle_write(const struct emul *target, uint8_t regn, uint8_t value) { struct adltc2990_emul_data *data = target->data; switch (regn) { case ADLTC2990_REG_CONTROL: data->reg[ADLTC2990_REG_CONTROL] = value; break; case ADLTC2990_REG_TRIGGER: data->re...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2023 Carl Zeiss Meditec AG * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADLTC2990_ADLTC2990_EMUL_H #define ZEPHYR_DRIVERS_SENSOR_ADLTC2990_ADLTC2990_EMUL_H #include <zephyr/drivers/emul.h> #include <zephyr/drivers/i2c.h> void adltc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2023 Carl Zeiss Meditec AG * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADLTC2990<|fim_suffix|>2c.h> #include <zephyr/drivers/sensor.h> enum adltc2990_monitor_pins {...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ne ADLTC2990_VOLTAGE_DIFF_VALUES 1U #define ADLTC2990_TEMP_VALUES 1U #define ADLTC2990_CURRENT_VALUES 1U #define ADLTC2990_MICROOHM_CONVERSION_FACTOR 1000000U #define ADLTC2990_MODE_V1_V2_TR2 0U #define ADLTC2990_MODE_V1_MINUS_V2_TR2 1U #define ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Andriy Gelman <andriy.gelman@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_adt7310 #include <string.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Andriy Gelman * * SPDX-License-Identifier: Apache-2.0 */ #if<|fim_suffix|>struct device *dev; #ifdef CONFIG_ADT7310_TRIGGER_OWN_THREAD K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_ADT7310_THREAD_STACK_SIZE); struct k_sem gpio_sem; struct k_thread thread; #elif CONFIG_ADT7310...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Andriy Gelman <andriy.gelman@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel.h> #include <zephyr/sys/util.h> #include <z...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2018, 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/pm/device.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018, 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADT7420_ADT7420_H_ #define ZEPHYR_DRIVERS_SENSOR_ADT7420_ADT7420_H_ #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> /* ADT7420 registers *...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>gpio_pin_get_dt(&cfg->int_gpio); if (pv > 0) { handle_int(dev); } } } return 0; } int adt7420_init_interrupt(const struct device *dev) { struct adt7420_data *drv_data = dev->data; const struct adt7420_dev_config *cfg = dev->config; int rc; drv_data->dev = dev; /* INT GPIO */ if (c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>urn 0; } static DEVICE_API(sensor, adxl345_api_funcs) = { .attr_set = adxl345_attr_set, .sample_fetch = adxl345_sample_fetch, .channel_get = adxl345_channel_get, #ifdef CONFIG_ADXL345_TRIGGER .trigger_set = adxl345_trigger_set, #endif #ifdef CONFIG_SENSOR_ASYNC_API .submit = adxl345_submit, .get_de...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADX345_ADX345_H_ #define ZEPHYR_DRIVERS_SENSOR_ADX345_ADX345_H_ #include <zephyr/drivers/sensor.h> #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/driver...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "adxl345.h" /** The q-scale factor will always be the same, as the nominal LSB/g * changes at the same rate the selected shift parameter per range: * * - At 2G: 256 LSB/g, 10-bits resolution. * - At 4...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/rtio/work.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include "adxl345.h" LOG_MODULE_DECLARE(ADXL345, CONFIG_SENSOR_LOG_LEVEL); static void adxl345_submit_fetch(struct...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include "adxl345.h" LOG_MODULE_DECLARE(ADXL345, CONFIG_SENSOR_LOG_LEVEL); void adxl345_submit_stream(co...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_adxl345 #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include "adxl345.h" #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/pm/device.h> #include <string.h> #include <zephyr/init.h> #include <stdlib.h> #include <zephyr/logging/log.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADXL355_ADXL355_H_ #define ZEPHYR_DRIVERS_SENSOR_ADXL355_ADXL355_H_ #include <zephyr/drivers/sensor.h> #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/gp...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>umber of samples to decode * @param data_out Output data pointer * @return int count of decoded samples, negative error code otherwise */ static int adxl355_decoder_decode(const uint8_t *buffer, struct sensor_chan_spec channel, uint32_t *fit, uint16_t max_count, void *data_out) { #ifdef CONFIG_AD...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "adxl355.h" #include <zephyr/logging/log.h> #include <zephyr/rtio/work.h> #include <zephyr/drivers/sensor.h> LOG_MODULE_DECLARE(ADXL355); /** * @brief Submit a fetch read request * * @param iodev_sqe ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>O_SQE_TRANSACTION; rtio_sqe_prep_read(read_fifo_data, data->iodev, RTIO_PRIO_NORM, &data->fifo_samples, 1, current_sqe); read_fifo_data->flags = RTIO_SQE_CHAINED; #ifdef CONFIG_I2C_RTIO read_fifo_data->iodev_flags |= RTIO_IODEV_I2C_STOP | RTIO_IODEV_I2C_RESTART; #endif rtio_sqe_prep_callback(com...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "adxl355.h" #include <zephyr/logging/log.h> LOG_MODULE_DECLARE(ADXL355); #if defined(CONFIG_ADXL355_TRIGGER_OWN_THREAD) || defined(CONFIG_ADXL355_TRIGGER_GLOBAL_THREAD) static void adxl355_thread_cb(cons...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ce and checks if the part is * present by reading the device id. * * @return 0 - the initialization was successful and the device is present; * -1 - an error occurred. * */ static int adxl362_init(const struct device *dev) { const struct adxl362_config *config = dev->config; uint8_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>decoder_api **decoder); void adxl362_accel_convert(struct sensor_value *val, int accel, int range); void adxl362_temp_convert(struct sensor_value *val, int temp); #endif /* CONFIG_SENSOR_ASYNC_API */ #ifdef CONFIG_ADXL362_STREAM int adxl362_fifo_setup(const struct device *dev, uint8_t mode, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "adxl362.h" #include <zephyr/sys/byteorder.h> #ifdef CONFIG_ADXL362_STREAM /* (2^31 / 2^8(shift) */ #define ADXL362_TEMP_QSCALE 8388608 #define ADXL362_TEMP_LSB_PER_C 15 #define ADXL362_COMPLEMENT ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>rtio_work_req_alloc(); __ASSERT_NO_MSG(req); rtio_work_req_submit(req, iodev_sqe, adxl362_submit_fetch); } else if (IS_ENABLED(CONFIG_ADXL362_STREAM)) { adxl362_submit_stream(dev, iodev_sqe); } else { rtio_iodev_sqe_err(iodev_sqe, -ENOTSUP); } } <|fim_prefix|>/* * Copyright (c) 2024 Analog D...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include "adxl362.h" LOG_MODULE_DECLARE(ADXL362, CONFIG_SENSOR_LOG_LEVEL); static void adxl362_irq_en_cb...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>urn -ENODEV; } ret = adxl362_set_interrupt_mode(dev, CONFIG_ADXL362_INTERRUPT_MODE); if (ret < 0) { return ret; } ret = gpio_pin_configure_dt(&cfg->interrupt, GPIO_INPUT); if (ret < 0) { return ret; } gpio_init_callback(&drv_data->gpio_cb, adxl362_gpio_callback, BIT(cfg->interru...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/sensor.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <string.h> #include <zephyr/init.h> #include <zephyr/sys/printk.h> #include <zephyr/sys/__assert.h> #include <stdlib...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>efine ADXL367_ACCEL_2G_LSB_PER_G 4000 #define ADXL367_ACCEL_4G_LSB_PER_G 2000 #define ADXL367_ACCEL_8G_LSB_PER_G 1000 enum adxl367_axis { ADXL367_X_AXIS = 0x0, ADXL367_Y_AXIS = 0x1, ADXL367_Z_AXIS = 0x2 }; enum adxl367_op_mode { ADXL367_STANDBY = 0, ADXL367_MEASURE = 2, }; enum adxl367_range { AD...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>R_CHAN_ACCEL_XYZ: data->readings[count].timestamp_delta = sample_num * period_ns; buff_offset = 0; samples_before = 0; if (enc_data->has_x) { if (packet_alignment == ADXL367_12B_PACKET_NOT_ALIGNED) { sample_aligned = 0; } samples_before++; adxl367_accel_convert_q31(&data->reading...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* adxl367_i2c.c - I2C routines for ADXL367 driver */ /* * Copyright (c) 2023 Analog Devices * * SPDX-License-Identifier: Apache-2.0 */ #include <string.h> #include <zephyr/logging/log.h> #include "adxl367.h" #ifdef ADXL367_BUS_I2C LOG_MODULE_DECLARE(ADXL367, CONFIG_SENSOR_LOG_LEVEL); static in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/rtio/work.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include "adxl367.h" LOG_MODULE_DECLARE(ADXL367, CONFIG_SENSOR_LOG_LEVEL); static void adxl367_submit_fetch(struct...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>r_function adxl367_spi_transfer_fn = { .read_reg_multiple = adxl367_spi_reg_read_multiple, .write_reg = adxl367_spi_reg_write, .read_reg = adxl367_spi_reg_read, .write_reg_mask = adxl367_spi_reg_write_mask, }; int adxl367_spi_init(const struct device *dev) { struct adxl367_data *data = dev->data; c...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include "adxl367.h" LOG_MODULE_DECLARE(ADXL367, CONFIG_SENSOR_LOG_LEVEL); static void adxl367_sqe_done(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> CONFIG_ADXL367_TRIGGER_GLOBAL_THREAD */ static void adxl367_gpio_callback(const struct device *dev, struct gpio_callback *cb, uint32_t pins) { struct adxl367_data *drv_data = CONTAINER_OF(cb, struct adxl367_data, gpio_cb); const struct adxl367_dev_config *cfg = drv_data->dev->config; gpio_pi...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>d_xyz(dev, ADXL372_X_THRESH_ACT_H, &cfg->activity_th); if (ret) { return ret; } ret = adxl372_set_activity_threshold_xyz(dev, ADXL372_X_THRESH_INACT_H, &cfg->inactivity_th); if (ret) { return ret; } ret = adxl372_set_activity_time(dev, cfg->activity_time); if (ret) { return re...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ADXL372_ADXL372_H_ #define ZEPHYR_DRIVERS_SENSOR_ADXL372_ADXL372_H_ #include <zephyr/drivers/sensor.h> #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/gp...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "adxl372.h" #ifdef CONFIG_ADXL372_STREAM /* (1.0 / 10 (sensor sensitivity)) * (2^31 / 2^11 (sensor shift) ) * SENSOR_G */ #define SENSOR_QSCALE_FACTOR UINT32_C(1027604) #define ADXL372_COMPLEMENT 0xf000 stat...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>hw_tf = &adxl372_i2c_transfer_fn; if (!device_is_ready(config->i2c.bus)) { return -ENODEV; } return 0; } #endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */ <|fim_prefix|>/* adxl372_i2c.c - I2C routines for ADXL372 driver */ /* * Copyright (c) 2018 STMicroelectronics * * SPDX-License-Identifier: ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/rtio/work.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include "adxl372.h" LOG_MODULE_DECLARE(ADXL372, CONFIG_SENSOR_LOG_LEVEL); static void adxl372_submit_fetch(struct...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> uint32_t mask, uint8_t data) { int ret; uint8_t tmp; ret = adxl372_spi_reg_read(dev, reg_addr, &tmp); if (ret) { return ret; } tmp &= ~mask; tmp |= data; return adxl372_spi_reg_write(dev, reg_addr, tmp); } static const struct adxl372_transfer_function adxl372_spi_transfer_f...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include "adxl372.h" LOG_MODULE_DECLARE(ADXL372, CONFIG_SENSOR_LOG_LEVEL); static void adxl372_irq_en_c...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Analog Devices Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_adxl372 #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/drivers/sensor.h> #include "adxl372.h" #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t = max30210_reg_update(dev, TEMP_ALARM_LOW_SETUP, TEMP_LO_TRIP_COUNTER_MASK, (val->val1) - 1); if (ret < 0) { LOG_ERR("Failed to set low trip count: %d\n", ret); return ret; } return 0; } /** * @brief Set High Trip Count Reset for MAX30210 * * @param dev Device Pointer * @param val Sens...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_spec i2c; #if defined(CONFIG_MAX30210_TRIGGER) struct gpio_dt_spec interrupt_gpio; /* GPIO for interrupt */ #endif int32_t alarm_high_setup; int32_t alarm_low_setup; uint8_t inc_fast_thresh; uint8_t dec_fast_thresh; uint8_t sampling_rate; uint8_t hi_trip_count; uint8_t lo_trip_count; bool hi_tr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ACK_SIZE, (k_thread_entry_t)max30210_thread, data, NULL, NULL, K_PRIO_COOP(CONFIG_MAX30210_THREAD_PRIORITY), 0, K_NO_WAIT); k_thread_name_set(&data->thread, dev->name); #elif defined(CONFIG_MAX30210_TRIGGER_GLOBAL_THREAD) data->work.handler = max30210_work_cb; #endif return 0; } <|fim_prefix|>/*...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025, Daniel Kampert * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/sys/byteorder.h> #include "max32664c.h" #define DT_DRV_COMPAT maxim_max32664c #if (DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0) #warning "max32664c driver enabled without any devices" #endif LOG_MODULE_REGISTER(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>#endif /* CONFIG_MAX32664C_USE_INTERRUPT */ <|fim_prefix|>/* * Copyright (c) 2025, Daniel Kampert * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/pm/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * External accelerometer driver for the MAX32664C biometric sensor hub. * * Copyright (c) 2025, Daniel Kampert * * SPDX-License-Identifier: Apache-2.0 */ #include "max32664c.h" LOG_MODULE_REGISTER(maxim_max32664c_acc, CONFIG_SENSOR_LOG_LEVEL); int max32664c_acc_enable(const struct device *dev,...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>f (rx_buf[1] != 8) { LOG_ERR("Device not in bootloader mode!"); return -EINVAL; } /* Read the bootloader information */ tx_buf[0] = 0x81; tx_buf[1] = 0x00; if (max32664c_bl_i2c_transmit(dev, tx_buf, 2, rx_buf, 4)) { return -EINVAL; } LOG_INF("Version: %d.%d.%d", rx_buf[1], rx_buf[2], rx_buf...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>else LOG_DBG("\tUsing static memory for queues and buffers"); #endif /* CONFIG_MAX32664C_USE_STATIC_MEMORY */ #ifdef CONFIG_MAX32664C_USE_EXTENDED_REPORTS LOG_DBG("\tUsing extended reports"); #else LOG_DBG("\tUsing normal reports"); #endif /* CONFIG_MAX32664C_USE_EXTENDED_REPORTS*/ LOG_DBG("\tReport...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Trigger code for the MAX32664C biometric sensor hub. * * Copyright (c) 2025, Daniel Kampert * * SPDX-License-Identifier: Apache-2.0 */ #include "max32664c.h" LOG_MODULE_REGISTER(maxim_max32664c_interrupt, CONFIG_SENSOR_LOG_LEVEL); #ifdef CONFIG_MAX32664C_USE_INTERRUPT static void max32664c_i...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Background worker for the MAX32664C biometric sensor hub. * * Copyright (c) 2025, Daniel Kampert * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/sys/byteorder.h> #include "max32664c.h" LOG_MODULE_REGISTER(maxim_max32664c_worker, CONFIG_SENSOR_LOG_LEVEL); /** @brief ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT allegro_als31300 #include "als31300.h" #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/logging/log.h> #include <zephyr/kernel.h> #include <zephyr/sys/util.h> #include <zephyr/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> /* 2^12 for 12-bit resolution */ #define ALS31300_12BIT_SIGN_BIT_INDEX 11 /* Sign bit position for 12-bit values (0-based) */ /* ALS31300 EEPROM Register 0x02 bit field definitions */ #define ALS31300_EEPROM_CUSTOMER_EE_MASK GENMASK(4, 0) /* Bits 4:0 */ #define ALS31300_EEPROM_CUSTOMER_EE_SHIFT 0 ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel * SPDX-License-Identifier: Apache-2.0 */ #include "als31300.h" #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor_clock.h> #include <zephyr/logging/log.h> #include <zephyr/rtio/rtio.h> #include <zephyr/drive<|fim_suffix|>e *dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t = data_out; out->header.base_timestamp_ns = edata->header.timestamp; out->header.reading_count = 1; out->shift = ALS31300_TEMP_SHIFT; als31300_convert_temp_to_q31(readings.temp, &out->readings[0].temperature); *fit = 1; return 1; } default: return -ENOTSUP; } } SENSOR_DECODER_API_DT_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT amd_sb_tsi #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/lo...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>I_TEMP_DEC_SCALE 8 #endif <|fim_prefix|>/* * Copyright (c) 2023 Google LLC * * S<|fim_middle|>PDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_SB_TSI_SB_TSI_H_ #define ZEPHYR_DRIVERS_SENSOR_SB_TSI_SB_TSI_H_ #define SB_TSI_TEMP_INT 0x01 #define SB_TSI_TEMP_DEC 0x10 #define SB_TSI_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT amd_sb_tsi #include <zephyr/device.h> #include <zephyr/drivers/emul.h> #include <zephyr/drivers/emul_sensor.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> #include <zephyr/loggin...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>US); if (i2c_reg_write_byte_dt(&config->i2c, AMG88XX_FPSC, AMG88XX_FPSC_10FPS)) { return -EIO; } LOG_DBG(""); return 0; } int amg88xx_init(const struct device *dev) { const struct amg88xx_config *config = dev->config; if (!device_is_ready(config->i2c.bus)) { LOG_ERR_DEVICE_NOT_REA...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ev); #endif /* CONFIG_AMG88XX_TRIGGER */ #endif <|fim_prefix|>/* * Copyright (c) 2017-2019 Phytec Messtechnik GmbH * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_AMG88XX_AMG88XX_H_ #define ZEPHYR_DRIVERS_SENSOR_AMG88XX_AMG88XX_H_ #include <zephyr/device.h> #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>*p3) { ARG_UNUSED(p2); ARG_UNUSED(p3); struct amg88xx_data *drv_data = p1; while (42) { k_sem_take(&drv_data->gpio_sem, K_FOREVER); amg88xx_thread_cb(drv_data->dev); } } #endif #ifdef CONFIG_AMG88XX_TRIGGER_GLOBAL_THREAD static void amg88xx_work_cb(struct k_work *work) { struct amg88xx_data *...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025, Felipe Neves * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_as5048 #include <errno.h> #include <zephyr/device.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/spi.h> #include <zephyr/init.h> #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> LOG_WRN("Magnet too weak."); return -ENODATA; } uint8_t buffer[2] = {0, 0}; err = i2c_burst_read_dt(&dev_cfg->i2c_port, AS5600_ANGLE_REGISTER_RAW_H, (uint8_t *) &buffer, sizeof(buffer)); /* invalid readings preserves the last good value */ if (!err) { dev_data->position = sys_get...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Alexander Wachter. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_iaqcore #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/sensor...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>RE_IAQCORE_H_ */ <|fim_prefix|>/* * Copyright (c) 2018 Alexander Wachter * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_AMS_IAQCORE_IAQCORE_H_ #define ZEPHYR_DRIVERS_SENSOR_AMS_IAQCORE_IAQCORE_H_ #include <zephyr/device.h> #include <zephyr/sys/util.h> struct iaq_registers ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2018 Peter Bigot Consulting, LLC * Copyright (c) 2018 Linaro Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_ccs811 #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h>...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Peter Bigot Consulting, LLC * Copyright (c) 2018 Linaro Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_CCS811_CCS811_H_ #define ZEPHYR_DRIVERS_SENSOR_CCS811_CCS811_H_ #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/d...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>le_irq(const struct device *dev) { struct ccs811_data *data = dev->data; setup_irq(dev, false); #if defined(CONFIG_CCS811_TRIGGER_OWN_THREAD) k_sem_give(&data->gpio_sem); #elif defined(CONFIG_CCS811_TRIGGER_GLOBAL_THREAD) k_work_submit(&data->work); #endif } static void process_irq(const struct dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Alexander Wachter. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_ens210 #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/sensor....
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ec i2c; }; #endif /* ZEPHYR_DRIVERS_SENSOR_ENS210_ENS210_H_ */ <|fim_prefix|>/* * Copyright (c) 2018 Alexander Wachter. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_ENS210_ENS210_H_ #define ZEPHYR_DRIVERS_SENSOR_ENS210_ENS210_H_ #include <zephyr/device.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ams_tcs3400 #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/sensor.h> #include <zephyr/drivers/sensor/tcs3400.h> #include <zephyr/sys/byteorder.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_gain = DT_INST_PROP(n, proximity_gain), \ .proximity_pulse_length = DT_INST_PROP(n, proximity_pulse_length), \ .proximity_pulse_count = DT_INST_PROP(n, proximity_pulse_count), \ .proximity_high_threshold = DT_INST_PROP(n, proximity_h...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>igger *p_th_trigger; struct k_work work; #else struct k_sem data_sem; #endif }; static void tmd2620_setup_int(const struct tmd2620_config *config, bool enable) { unsigned int flags = enable ? GPIO_INT_EDGE_TO_ACTIVE : GPIO_INT_DISABLE; gpio_pin_interrupt_configure_dt(&config->int_gpio, flags); } #i...
fim
zephyrproject-rtos/zephyr
c