Herzog Library 00.00.01  rel_libdev.herzog.00.00.01.10606
Functions | Variables
adc_device.c File Reference
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#include "adc_device.h"
#include "errno.h"

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_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_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_devInit (ADC_Device_t *dev, uint8_t div, uint8_t cycle, uint32_t mode)
 Initialize ADC device. 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...
 
ADC_Device_tADC_devRequest (const char *name)
 ADC Request Device. More...
 

Variables

static const ADC_Device_tADC_DeviceTable []
 The instance of ADC 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.

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.

Variable Documentation

const ADC_Device_t* ADC_DeviceTable[]
static
Initial value:
= {
NULL,
}

The instance of ADC device.

The table of ADC device instances supported by the platform.