Tizen Native API  9.0

The ADC API provides functions to control ADC peripherals connected to the IoT device.

The ADC API provides functions to control ADC peripherals connected to the IoT device.

Required Header

#include <peripheral_io.h>

Overview

This ADC API provides functions to control ADC peripherals connected to the IoT device.

Realted Features

This API is related with the following feature:

It is recommended to use features in your application for reliability.

You can check if a IoT device supports the related features for this API
by using System Information, and control your application's actions accordingly.

To ensure your application is only running on the IoT device with specific features,
please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Functions

int peripheral_adc_open (int device, int channel, peripheral_adc_h *adc)
 Opens the ADC pin and returns a handle representing it.
int peripheral_adc_close (peripheral_adc_h adc)
 Closes the ADC pin and frees the resources associated with it.
int peripheral_adc_read (peripheral_adc_h adc, uint32_t *value)
 Gets the current value of the ADC peripherals pin.

Typedefs

typedef struct _peripheral_adc_s * peripheral_adc_h
 An opaque handle representing an ADC peripherals pin.

Typedef Documentation

typedef struct _peripheral_adc_s* peripheral_adc_h

An opaque handle representing an ADC peripherals pin.

A handle to a single ADC pin, for use with most ADC interfaces

Since :
5.0

Function Documentation

Closes the ADC pin and frees the resources associated with it.

Warning:
This is not for use by third-party applications.

This function should be called at the end of the object's lifetime to avoid a memleak.

Since :
5.0
Privilege Level:
platform
Privilege:
http://tizen.org/privilege/peripheralio
Parameters:
[in]adcThe ADC handle
Returns:
0 on success, otherwise a negative error value
Return values:
PERIPHERAL_ERROR_NONESuccessful
PERIPHERAL_ERROR_NOT_SUPPORTEDNot supported
PERIPHERAL_ERROR_PERMISSION_DENIEDPermission denied
PERIPHERAL_ERROR_INVALID_PARAMETERInvalid parameter
PERIPHERAL_ERROR_IO_ERRORI/O operation failed
PERIPHERAL_ERROR_NO_DEVICEDevice does not exist or is removed
PERIPHERAL_ERROR_UNKNOWNUnknown internal error
Precondition:
peripheral_adc_open()
int peripheral_adc_open ( int  device,
int  channel,
peripheral_adc_h adc 
)

Opens the ADC pin and returns a handle representing it.

Warning:
This is not for use by third-party applications.

Starts the lifetime of the handle and allocates its needed resources.

Since :
5.0
Privilege Level:
platform
Privilege:
http://tizen.org/privilege/peripheralio
Remarks:
adc should be released with peripheral_adc_close()
Parameters:
[in]deviceThe ADC device number
[in]channelThe ADC channel number to control
[out]adcThe ADC handle is created on success
Returns:
0 on success, otherwise a negative error value
Return values:
PERIPHERAL_ERROR_NONESuccessful
PERIPHERAL_ERROR_NOT_SUPPORTEDNot supported
PERIPHERAL_ERROR_PERMISSION_DENIEDPermission denied
PERIPHERAL_ERROR_INVALID_PARAMETERInvalid parameter
PERIPHERAL_ERROR_IO_ERRORI/O operation failed
PERIPHERAL_ERROR_NO_DEVICEDevice does not exist or is removed
PERIPHERAL_ERROR_OUT_OF_MEMORYMemory allocation failed
PERIPHERAL_ERROR_RESOURCE_BUSYDevice is in use
PERIPHERAL_ERROR_UNKNOWNUnknown internal error
Postcondition:
peripheral_adc_close()
int peripheral_adc_read ( peripheral_adc_h  adc,
uint32_t *  value 
)

Gets the current value of the ADC peripherals pin.

Warning:
This is not for use by third-party applications.

Gets the current value of the ADC peripherals pin.

Since :
5.0
Privilege Level:
platform
Privilege:
http://tizen.org/privilege/peripheralio
Parameters:
[in]adcThe ADC handle
[out]valueThe value to get
Returns:
0 on success, otherwise a negative error value
Return values:
PERIPHERAL_ERROR_NONESuccessful
PERIPHERAL_ERROR_NOT_SUPPORTEDNot supported
PERIPHERAL_ERROR_PERMISSION_DENIEDPermission denied
PERIPHERAL_ERROR_INVALID_PARAMETERInvalid parameter
PERIPHERAL_ERROR_IO_ERRORI/O operation failed
PERIPHERAL_ERROR_NO_DEVICEDevice does not exist or is removed
PERIPHERAL_ERROR_UNKNOWNUnknown internal error