Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
Data Structures | Macros | Typedefs | Functions
adc_device.h File Reference
#include <stdint.h>
#include "hdf.h"

Go to the source code of this file.

Data Structures

struct  ADC_Device_t
 A structure to represent ADC device. More...
 

Macros

#define ADC_MODE_STREAM   ((uint32_t)(1<<0))
 The enumeration of ADC mode. More...
 
#define ADC_MODE_SINGLE   ((uint32_t)(1<<1))
 
#define ADC_MODE_NORMAL   ((uint32_t)(1<<2))
 
#define ADC_MODE_CALIBRATION   ((uint32_t)(1<<3))
 
#define ADC_MODE_REF_VDD   ((uint32_t)(1<<4))
 
#define ADC_MODE_REF_BANDGAP   ((uint32_t)(1<<5))
 

Typedefs

typedef const struct ADC_Device_t ADC_Device_t
 A structure to represent ADC device. More...
 

Functions

int32_t ADC_devSelectChannel (ADC_Device_t *dev, uint8_t channel)
 Select ADC channel for a ADC device. More...
 
int32_t ADC_devRead (ADC_Device_t *dev, uint8_t *val)
 Read ADC result from a ADC device. More...
 
int32_t ADC_devTake (ADC_Device_t *dev, uint8_t channel, uint8_t *val)
 Start a ADC conversion, wait for its completion and read result back. More...
 
int32_t ADC_devStart (ADC_Device_t *dev)
 Start a ADC conversion. More...
 
int32_t ADC_devConversionInProgress (ADC_Device_t *dev)
 Check status of a ADC conversion. More...
 
int32_t ADC_devConfigReference (ADC_Device_t *dev, uint8_t refh, uint8_t refl, uint8_t refg)
 Initialize ADC reference settings. It sets the dynamic range and the gain. More...
 
int32_t ADC_devInit (ADC_Device_t *dev, uint8_t div, uint8_t cycle, uint32_t mode)
 Initialize ADC device. More...
 
ADC_Device_tADC_devRequest (const char *name)
 ADC Request Device. More...
 

Detailed Description

This file is proprietary to Indie Semiconductor. All rights reserved. Reproduction or distribution, in whole or in part, is forbidden except by express written permission of Indie Semiconductor.

Macro Definition Documentation

#define ADC_MODE_CALIBRATION   ((uint32_t)(1<<3))
#define ADC_MODE_NORMAL   ((uint32_t)(1<<2))
#define ADC_MODE_REF_BANDGAP   ((uint32_t)(1<<5))
#define ADC_MODE_REF_VDD   ((uint32_t)(1<<4))
#define ADC_MODE_SINGLE   ((uint32_t)(1<<1))
#define ADC_MODE_STREAM   ((uint32_t)(1<<0))

The enumeration of ADC mode.

Typedef Documentation

typedef const struct ADC_Device_t ADC_Device_t

A structure to represent ADC device.

Function Documentation

int32_t ADC_devConfigReference ( ADC_Device_t dev,
uint8_t  refh,
uint8_t  refl,
uint8_t  refg 
)

Initialize ADC reference settings. It sets the dynamic range and the gain.

Parameters
devThe pointer to ADC device
refhThe high watermark to the reference voltage.
reflThe low watermark to the reference voltage.
refgThe gain of the reference voltage.
Returns
0 for success or error code upon a failure.
int32_t ADC_devConversionInProgress ( ADC_Device_t dev)

Check status of a ADC conversion.

Parameters
devThe pointer to ADC device
Returns
1 for busy, 0 for idle or error code upon a failure.
int32_t ADC_devInit ( ADC_Device_t dev,
uint8_t  div,
uint8_t  cycle,
uint32_t  mode 
)

Initialize ADC device.

Parameters
devThe pointer to ADC device
divThe clock divider.
cycleThe ADC cycle.
modeThe ADC mode.
Returns
0 for success or error code upon a failure.
int32_t ADC_devRead ( ADC_Device_t dev,
uint8_t *  val 
)

Read ADC result from a ADC device.

Parameters
devThe pointer to ADC device
valThe pointer to the result.
Returns
0 for success or error code upon a failure.
ADC_Device_t* ADC_devRequest ( const char *  name)

ADC Request Device.

Parameters
nameThe name string of ADC device.
Returns
The pointer to the ADC device instance.
int32_t ADC_devSelectChannel ( ADC_Device_t dev,
uint8_t  channel 
)

Select ADC channel for a ADC device.

Parameters
devThe pointer to ADC device
channelThe enumeration of ADC channel. return 0 for success or error code upon a failure.
int32_t ADC_devStart ( ADC_Device_t dev)

Start a ADC conversion.

Parameters
devThe pointer to ADC device
Returns
0 for success or error code upon a failure.
int32_t ADC_devTake ( ADC_Device_t dev,
uint8_t  channel,
uint8_t *  val 
)

Start a ADC conversion, wait for its completion and read result back.

Parameters
devThe pointer to ADC device
channelThe enumeration of ADC channel.
valThe pointer to the result.
Returns
0 for success or error code upon a failure.