Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
adc_npcx_threshold.h File Reference
#include <zephyr/device.h>

Go to the source code of this file.

Data Structures

struct  adc_npcx_threshold_param
 

Enumerations

enum  adc_npcx_threshold_param_l_h { ADC_NPCX_THRESHOLD_PARAM_L_H_HIGHER , ADC_NPCX_THRESHOLD_PARAM_L_H_LOWER }
 
enum  adc_npcx_threshold_param_type {
  ADC_NPCX_THRESHOLD_PARAM_CHNSEL , ADC_NPCX_THRESHOLD_PARAM_L_H , ADC_NPCX_THRESHOLD_PARAM_THVAL , ADC_NPCX_THRESHOLD_PARAM_WORK ,
  ADC_NPCX_THRESHOLD_PARAM_MAX
}
 

Functions

int adc_npcx_threshold_mv_to_thrval (const struct device *dev, uint32_t val_mv, uint32_t *thrval)
 Convert input value in millivolts to corresponding threshold register value.
 
int adc_npcx_threshold_ctrl_set_param (const struct device *dev, const uint8_t th_sel, const struct adc_npcx_threshold_param *param)
 Set ADC threshold parameter.
 
int adc_npcx_threshold_ctrl_enable (const struct device *dev, uint8_t th_sel, const bool enable)
 Enables/Disables ADC threshold interruption.
 

Enumeration Type Documentation

◆ adc_npcx_threshold_param_l_h

Enumerator
ADC_NPCX_THRESHOLD_PARAM_L_H_HIGHER 
ADC_NPCX_THRESHOLD_PARAM_L_H_LOWER 

◆ adc_npcx_threshold_param_type

Enumerator
ADC_NPCX_THRESHOLD_PARAM_CHNSEL 
ADC_NPCX_THRESHOLD_PARAM_L_H 
ADC_NPCX_THRESHOLD_PARAM_THVAL 
ADC_NPCX_THRESHOLD_PARAM_WORK 
ADC_NPCX_THRESHOLD_PARAM_MAX 

Function Documentation

◆ adc_npcx_threshold_ctrl_enable()

int adc_npcx_threshold_ctrl_enable ( const struct device * dev,
uint8_t th_sel,
const bool enable )

Enables/Disables ADC threshold interruption.

Note
This function is available only if CONFIG_ADC_CMP_NPCX is selected.
Parameters
devPointer to the device structure for the driver instance.
th_selThreshold selected.
enableEnable or disables threshold interruption.
Returns
0 on success, negative error code otherwise. all parameters must be configure prior enabling threshold interruption, otherwise error will be returned.

◆ adc_npcx_threshold_ctrl_set_param()

int adc_npcx_threshold_ctrl_set_param ( const struct device * dev,
const uint8_t th_sel,
const struct adc_npcx_threshold_param * param )

Set ADC threshold parameter.

Note
This function is available only if CONFIG_ADC_CMP_NPCX is selected.
Parameters
devPointer to the device structure for the driver instance.
th_selThreshold selected.
paramPointer of parameter structure. See struct adc_npcx_threshold_param for supported parameters.
Returns
0 on success, negative error code otherwise.

◆ adc_npcx_threshold_mv_to_thrval()

int adc_npcx_threshold_mv_to_thrval ( const struct device * dev,
uint32_t val_mv,
uint32_t * thrval )

Convert input value in millivolts to corresponding threshold register value.

Note
This function is available only if CONFIG_ADC_CMP_NPCX is selected.
Parameters
devPointer to the device structure for the driver instance.
val_mvInput value in millivolts to be converted.
thrvalPointer of variable to hold the result of conversion.
Returns
0 on success, negative result if input cannot be converted due to overflow.