1 /* 2 * Copyright (c) 2020, Laird Connectivity 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_DRIVERS_SENSOR_SM351LT_SM351LT_H_ 8 #define ZEPHYR_DRIVERS_SENSOR_SM351LT_SM351LT_H_ 9 10 #include <stdint.h> 11 #include <zephyr/drivers/gpio.h> 12 #include <zephyr/drivers/sensor.h> 13 #include <zephyr/kernel.h> 14 15 #define SENSOR_ATTR_SM351LT_TRIGGER_TYPE SENSOR_ATTR_PRIV_START 16 17 struct sm351lt_config { 18 struct gpio_dt_spec int_gpio; 19 }; 20 21 struct sm351lt_data { 22 bool sample_status; 23 24 #ifdef CONFIG_SM351LT_TRIGGER 25 const struct device *dev; 26 struct gpio_callback gpio_cb; 27 28 uint32_t trigger_type; 29 sensor_trigger_handler_t changed_handler; 30 const struct sensor_trigger *changed_trigger; 31 32 #if defined(CONFIG_SM351LT_TRIGGER_OWN_THREAD) 33 K_KERNEL_STACK_MEMBER(thread_stack, CONFIG_SM351LT_THREAD_STACK_SIZE); 34 struct k_thread thread; 35 struct k_sem gpio_sem; 36 #elif defined(CONFIG_SM351LT_TRIGGER_GLOBAL_THREAD) 37 struct k_work work; 38 #endif 39 40 #endif /* CONFIG_SM351LT_TRIGGER */ 41 }; 42 43 #endif /* ZEPHYR_DRIVERS_SENSOR_SM351LT_SM351LT_H_ */ 44