I2C Analog-to-Digital Converter device driver.  
More...
I2C Analog-to-Digital Converter device driver. 
This driver works with adc081c, adc101c and adc121c versions.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities. 
|  | 
| typedef struct adcxx1c_params | adcxx1c_params_t | 
|  | ADCxx1C params. 
 | 
|  | 
| typedef void(* | adcxx1c_cb_t) (void *) | 
|  | ADCxx1C alert callback. 
 | 
|  | 
| typedef struct adcxx1c | adcxx1c_t | 
|  | ADCxx1C device descriptor. 
 | 
|  | 
|  | 
| enum | { ADCXX1C_RES_8BITS = 8
, ADCXX1C_RES_10BITS = 10
, ADCXX1C_RES_12BITS = 12
 } | 
|  | ADC resolution.  More... 
 | 
|  | 
| enum | { ADCXX1C_CYCLE_DISABLED = 0
, ADCXX1C_CYCLE_32
, ADCXX1C_CYCLE_64
, ADCXX1C_CYCLE_128
,
 ADCXX1C_CYCLE_256
, ADCXX1C_CYCLE_512
, ADCXX1C_CYCLE_1024
, ADCXX1C_CYCLE_2048
 }
 | 
|  | Conversion interval configuration value.  More... 
 | 
|  | 
| enum | { ADCXX1C_OK = 0
, ADCXX1C_NOI2C = -1
, ADCXX1C_NODEV = -2
, ADCXX1C_NODATA = -3
 } | 
|  | Named return values.  More... 
 | 
|  | 
| enum | { ADCXX1C_ALERT_UNDER_RANGE = 1
, ADCXX1C_ALERT_OVER_RANGE = 2
 } | 
|  | Alert values.  More... 
 | 
|  | 
◆ ADCXX1C_I2C_ADDRESS
      
        
          | #define ADCXX1C_I2C_ADDRESS   (0x54) | 
      
 
ADCxx1C default address (ADCxx1C021 address) 
Definition at line 39 of file adcxx1c.h.
 
 
◆ ADCXX1C_RES_DEFAULT
      
        
          | #define ADCXX1C_RES_DEFAULT   (-1) | 
      
 
ADC default resolution for device variants. 
Definition at line 61 of file adcxx1c.h.
 
 
◆ adcxx1c_cb_t
      
        
          | typedef void(* adcxx1c_cb_t) (void *) | 
      
 
ADCxx1C alert callback. 
Definition at line 114 of file adcxx1c.h.
 
 
◆ anonymous enum
Named return values. 
| Enumerator | 
|---|
| ADCXX1C_OK | everything was fine  | 
| ADCXX1C_NOI2C | I2C communication failed.  | 
| ADCXX1C_NODEV | no ADCXX1C device found on the bus  | 
| ADCXX1C_NODATA | no data available  | 
Definition at line 82 of file adcxx1c.h.
 
 
◆ anonymous enum
Alert values. 
| Enumerator | 
|---|
| ADCXX1C_ALERT_UNDER_RANGE | Measured voltage fell below Vlow.  | 
| ADCXX1C_ALERT_OVER_RANGE | Measured voltage exceeded Vhigh.  | 
Definition at line 92 of file adcxx1c.h.
 
 
◆ anonymous enum
Conversion interval configuration value. 
| Enumerator | 
|---|
| ADCXX1C_CYCLE_DISABLED | No cycle conversion.  | 
| ADCXX1C_CYCLE_32 | Conversion cycle = Tconvert x 32.  | 
| ADCXX1C_CYCLE_64 | Conversion cycle = Tconvert x 64.  | 
| ADCXX1C_CYCLE_128 | Conversion cycle = Tconvert x 128.  | 
| ADCXX1C_CYCLE_256 | Conversion cycle = Tconvert x 256.  | 
| ADCXX1C_CYCLE_512 | Conversion cycle = Tconvert x 512.  | 
| ADCXX1C_CYCLE_1024 | Conversion cycle = Tconvert x 1024.  | 
| ADCXX1C_CYCLE_2048 | Conversion cycle = Tconvert x 2048.  | 
Definition at line 68 of file adcxx1c.h.
 
 
◆ anonymous enum
ADC resolution. 
| Enumerator | 
|---|
| ADCXX1C_RES_8BITS | 8 bits resolution (ADC081C family)  | 
| ADCXX1C_RES_10BITS | 10 bits resolution (ADC101C family)  | 
| ADCXX1C_RES_12BITS | 12 bits resolution (ADC121C family)  | 
Definition at line 45 of file adcxx1c.h.
 
 
◆ adcxx1c_enable_alert()
Enable alert interrupt. 
- Parameters
- 
  
    | [in] | dev | device descriptor |  | [in] | cb | callback called when the alert fires |  | [in] | arg | callback argument |  
 
- Returns
- zero on success, non zero on error 
 
 
◆ adcxx1c_get_and_clear_alert()
      
        
          | int adcxx1c_get_and_clear_alert | ( | const adcxx1c_t * | dev | ) |  | 
      
 
Get alert source and clear it. 
- Parameters
- 
  
    | [in,out] | dev | device descriptor |  
 
- Returns
- a combination of ADCXX1C_ALERT_OVER_RANGE and ADCXX1C_ALERT_UNDER_RANGE on success 
- 
negative error code on error 
 
 
◆ adcxx1c_init()
Initialize an ADCxx1C ADC device. 
- Parameters
- 
  
    | [in,out] | dev | device descriptor |  | [in] | params | device configuration |  
 
- Returns
- zero on successful initialization, non zero on error 
 
 
◆ adcxx1c_read_raw()
      
        
          | int adcxx1c_read_raw | ( | const adcxx1c_t * | dev, | 
        
          |  |  | int16_t * | raw ) | 
      
 
Read a raw ADC value. 
- Parameters
- 
  
    | [in] | dev | device descriptor |  | [out] | raw | read value |  
 
- Returns
- zero on successful read, non zero on error 
 
 
◆ adcxx1c_set_alert_parameters()
      
        
          | int adcxx1c_set_alert_parameters | ( | const adcxx1c_t * | dev, | 
        
          |  |  | int16_t | low_limit, | 
        
          |  |  | int16_t | high_limit, | 
        
          |  |  | int16_t | hysteresis ) | 
      
 
Set the alert parameters. 
- Parameters
- 
  
    | [in,out] | dev | device descriptor |  | [in] | low_limit | alert low limit |  | [in] | high_limit | alert high limit |  | [in] | hysteresis | alert hysteresis |  
 
- Returns
- zero on success, non zero on error