Line data Source code
1 1 : /* 2 : * Copyright (c) 2020 Vestas Wind Systems A/S 3 : * Copyright 2024 NXP 4 : * 5 : * SPDX-License-Identifier: Apache-2.0 6 : */ 7 : 8 : /** 9 : * @file 10 : * @brief Data structure for the NXP MCUX low-power analog comparator (LPCMP) 11 : */ 12 : 13 : #ifndef ZEPHYR_INCLUDE_DRIVERS_SENSOR_MCUX_LPCMP_H_ 14 : #define ZEPHYR_INCLUDE_DRIVERS_SENSOR_MCUX_LPCMP_H_ 15 : 16 : #ifdef __cplusplus 17 : extern "C" { 18 : #endif 19 : 20 : #include <zephyr/drivers/sensor.h> 21 : 22 : /** 23 : * @brief lpcmp channels. 24 : */ 25 1 : enum sensor_channel_mcux_lpcmp { 26 : /** LPCMP output. */ 27 : SENSOR_CHAN_MCUX_LPCMP_OUTPUT = SENSOR_CHAN_PRIV_START, 28 : }; 29 : 30 : /** 31 : * @brief lpcmp trigger types. 32 : */ 33 1 : enum sensor_trigger_type_mcux_lpcmp { 34 : /** LPCMP output rising event trigger. */ 35 : SENSOR_TRIG_MCUX_LPCMP_OUTPUT_RISING = SENSOR_TRIG_PRIV_START, 36 : /** LPCMP output falling event trigger. */ 37 : SENSOR_TRIG_MCUX_LPCMP_OUTPUT_FALLING, 38 : }; 39 : 40 : /** 41 : * @brief lpcmp attribute types. 42 : */ 43 1 : enum sensor_attribute_mcux_lpcmp { 44 : /** LPCMP positive input mux. */ 45 : SENSOR_ATTR_MCUX_LPCMP_POSITIVE_MUX_INPUT = SENSOR_ATTR_COMMON_COUNT, 46 : /** LPCMP negative input mux. */ 47 : SENSOR_ATTR_MCUX_LPCMP_NEGATIVE_MUX_INPUT, 48 : 49 : /** 50 : * LPCMP internal DAC enable. 51 : * 0b: disable 52 : * 1b: enable 53 : */ 54 : SENSOR_ATTR_MCUX_LPCMP_DAC_ENABLE, 55 : /** 56 : * LPCMP internal DAC high power mode disabled. 57 : * 0b: disable 58 : * 1b: enable 59 : */ 60 : SENSOR_ATTR_MCUX_LPCMP_DAC_HIGH_POWER_MODE_ENABLE, 61 : /** LPCMP internal DAC voltage reference source. */ 62 : SENSOR_ATTR_MCUX_LPCMP_DAC_REFERENCE_VOLTAGE_SOURCE, 63 : /** LPCMP internal DAC output voltage value. */ 64 : SENSOR_ATTR_MCUX_LPCMP_DAC_OUTPUT_VOLTAGE, 65 : 66 : /** LPCMP internal filter sample enable. */ 67 : SENSOR_ATTR_MCUX_LPCMP_SAMPLE_ENABLE, 68 : /** LPCMP internal filter sample count. */ 69 : SENSOR_ATTR_MCUX_LPCMP_FILTER_COUNT, 70 : /** LPCMP internal filter sample period. */ 71 : SENSOR_ATTR_MCUX_LPCMP_FILTER_PERIOD, 72 : 73 : /** LPCMP window signal invert. */ 74 : SENSOR_ATTR_MCUX_LPCMP_COUTA_WINDOW_ENABLE, 75 : /** LPCMP window signal invert. */ 76 : SENSOR_ATTR_MCUX_LPCMP_COUTA_WINDOW_SIGNAL_INVERT_ENABLE, 77 : /** 78 : * LPCMP COUTA signal value when a window is closed: 79 : * 00b: latched 80 : * 01b: set to low 81 : * 11b: set to high 82 : */ 83 : SENSOR_ATTR_MCUX_LPCMP_COUTA_SIGNAL, 84 : /** 85 : * LPCMP COUT event to close an active window: 86 : * xx0b: COUT event cannot close an active window 87 : * 001b: COUT rising edge event close an active window 88 : * 011b: COUT falling edge event close an active window 89 : * 1x1b: COUT both edges event close an active window 90 : */ 91 : SENSOR_ATTR_MCUX_LPCMP_COUT_EVENT_TO_CLOSE_WINDOW 92 : }; 93 : 94 : #ifdef __cplusplus 95 : } 96 : #endif 97 : 98 : #endif /* ZEPHYR_INCLUDE_DRIVERS_SENSOR_MCUX_LPCMP_H_ */