drivers: sensor: mcux_acmp: update mcux_acmp drivers
add MCUX_ACMP_HAS_HYSTCTR macro to adapt feature if IP don't exist HYSTCTR bit Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
This commit is contained in:
parent
2680c7d020
commit
62e5805c57
2 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Vestas Wind Systems A/S
|
||||
* Copyright 2022 NXP
|
||||
* Copyright 2022, 2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -107,6 +107,7 @@ static int mcux_acmp_attr_set(const struct device *dev,
|
|||
}
|
||||
break;
|
||||
#endif /* MCUX_ACMP_HAS_OFFSET */
|
||||
#if MCUX_ACMP_HAS_HYSTCTR
|
||||
case SENSOR_ATTR_MCUX_ACMP_HYSTERESIS_LEVEL:
|
||||
if (val1 >= kACMP_HysteresisLevel0 &&
|
||||
val1 <= kACMP_HysteresisLevel3) {
|
||||
|
@ -118,6 +119,7 @@ static int mcux_acmp_attr_set(const struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
#endif /* MCUX_ACMP_HAS_HYSTCTR */
|
||||
case SENSOR_ATTR_MCUX_ACMP_DAC_VOLTAGE_REFERENCE:
|
||||
if (val1 >= kACMP_VrefSourceVin1 &&
|
||||
val1 <= kACMP_VrefSourceVin2) {
|
||||
|
@ -271,9 +273,11 @@ static int mcux_acmp_attr_get(const struct device *dev,
|
|||
val->val1 = data->config.offsetMode;
|
||||
break;
|
||||
#endif /* MCUX_ACMP_HAS_OFFSET */
|
||||
#if MCUX_ACMP_HAS_HYSTCTR
|
||||
case SENSOR_ATTR_MCUX_ACMP_HYSTERESIS_LEVEL:
|
||||
val->val1 = data->config.hysteresisMode;
|
||||
break;
|
||||
#endif /* MCUX_ACMP_HAS_HYSTCTR */
|
||||
case SENSOR_ATTR_MCUX_ACMP_DAC_VOLTAGE_REFERENCE:
|
||||
val->val1 = data->dac.referenceVoltageSource;
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020 Vestas Wind Systems A/S
|
||||
* Copyright 2022 NXP
|
||||
* Copyright 2022, 2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -43,6 +43,12 @@ extern "C" {
|
|||
#define MCUX_ACMP_HAS_DISCRETE_MODE 0
|
||||
#endif
|
||||
|
||||
#if defined(FSL_FEATURE_ACMP_HAS_C0_HYSTCTR_BIT) && (FSL_FEATURE_ACMP_HAS_C0_HYSTCTR_BIT == 1U)
|
||||
#define MCUX_ACMP_HAS_HYSTCTR 1
|
||||
#else
|
||||
#define MCUX_ACMP_HAS_HYSTCTR 0
|
||||
#endif
|
||||
|
||||
enum sensor_channel_mcux_acmp {
|
||||
/** Analog Comparator Output. */
|
||||
SENSOR_CHAN_MCUX_ACMP_OUTPUT = SENSOR_CHAN_PRIV_START,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue