TizenRT Public API  v2.0 M2

Provides APIs for ADC (Analog to Digital Converters) More...

Collaboration diagram for ADC:

Files

file  iotbus_adc.h
 Iotbus APIs for ADC.
 

Typedefs

typedef struct _iotbus_adc_wrapper_s * iotbus_adc_context_h
 Pointer definition to the internal struct _iotbus_adc_wrapper_s. More...
 

Enumerations

Functions

iotbus_adc_context_h iotbus_adc_init (int bus, uint8_t channel)
 initializes adc_context. More...
 
int iotbus_adc_deinit (iotbus_adc_context_h hnd)
 deinitializes adc_context. More...
 
int iotbus_adc_set_channel (iotbus_adc_context_h hnd, uint8_t channel)
 set the ADC channel. More...
 
int iotbus_adc_get_channel (iotbus_adc_context_h hnd)
 get the ADC channel. More...
 
int iotbus_adc_get_state (iotbus_adc_context_h hnd)
 get the ADC state. More...
 
int iotbus_adc_start (iotbus_adc_context_h hnd, const adc_read_cb read_cb)
 start adc asynchronous read. More...
 
int iotbus_adc_stop (iotbus_adc_context_h hnd)
 stop adc asynchronous read. More...
 
int32_t iotbus_adc_get_sample (iotbus_adc_context_h hnd, int timeout)
 adc synchronous read. More...
 

Detailed Description

Provides APIs for ADC (Analog to Digital Converters)

Typedef Documentation

typedef struct _iotbus_adc_wrapper_s* iotbus_adc_context_h

Pointer definition to the internal struct _iotbus_adc_wrapper_s.

Definition at line 42 of file iotbus_adc.h.

Enumeration Type Documentation

Enumeration of ADC state.

Enumeration Details: IOTBUS_ADC_RDY = 0, adc device is ready IOTBUS_ADC_BUSY = 1, adc device is busy

Enumerator
IOTBUS_ADC_BUSY 

adc device is ready to use

IOTBUS_ADC_STOP 

adc device is busy

Definition at line 53 of file iotbus_adc.h.

Function Documentation

int iotbus_adc_deinit ( iotbus_adc_context_h  hnd)

deinitializes adc_context.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of i2c_context
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
int iotbus_adc_get_channel ( iotbus_adc_context_h  hnd)

get the ADC channel.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
Returns
On success, the ADC channel is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
int32_t iotbus_adc_get_sample ( iotbus_adc_context_h  hnd,
int  timeout 
)

adc synchronous read.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
[in]timeouttimeout value (ms).
Returns
On success, ADC sample value is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
int iotbus_adc_get_state ( iotbus_adc_context_h  hnd)

get the ADC state.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
Returns
On success, IOTBUS_ADC_RDY or IOTBUS_ADC_BUSY is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
iotbus_adc_context_h iotbus_adc_init ( int  bus,
uint8_t  channel 
)

initializes adc_context.

#include <iotbus/iotbus_adc.h>

Parameters
[in]busADC bus number
[in]channelThe 8-bit ADC Channel
Returns
On success, handle of adc_context is returned. On failure, NULL is returned.
Since
TizenRT v2.0
int iotbus_adc_set_channel ( iotbus_adc_context_h  hnd,
uint8_t  channel 
)

set the ADC channel.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
[in]channelThe 8-bit ADC Channel
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
int iotbus_adc_start ( iotbus_adc_context_h  hnd,
const adc_read_cb  read_cb 
)

start adc asynchronous read.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
[in]read_cbcallback function called adc read is done.
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
TizenRT v2.0
int iotbus_adc_stop ( iotbus_adc_context_h  hnd)

stop adc asynchronous read.

#include <iotbus/iotbus_adc.h>

Parameters
[in]hndhandle of adc_context
Returns
On success, 0 is returned. On failure, a negative value is returned.
Since
TizenRT v2.0