1 /** mbed Microcontroller Library
2  ******************************************************************************
3  * @file    analogin_api.h
4  * @author
5  * @version V1.0.0
6  * @brief   This file provides following mbed Analog_in API
7  ******************************************************************************
8  * @attention
9  *
10  * Copyright (c) 2006-2013 ARM Limited
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  *     http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24 #ifndef MBED_ANALOGIN_API_H
25 #define MBED_ANALOGIN_API_H
26 
27 #include "device.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /** @addtogroup analog_in ANALOG_IN
34  *  @ingroup    hal
35  *  @brief      analog_in functions
36  *  @{
37  */
38 
39 ///@name Ameba Common
40 ///@{
41 
42 typedef struct analogin_s analogin_t;
43 
44 
45 /**
46   * @brief  Initializes the ADC device, include clock/function/ADC registers.
47   * @param  obj: adc object define in application software.
48   * @param  pin: adc PinName according to pinmux spec.
49   * @retval none
50   */
51 void analogin_init(analogin_t *obj, PinName pin);
52 
53 /**
54   * @brief  Deinitializes the ADC device, include clock/function/ADC registers.
55   * @param  obj: adc object define in application software.
56   * @retval none
57   */
58 void analogin_deinit(analogin_t *obj);
59 
60 /**
61   * @brief  Reads data from the specified adc channel fifo.
62   * @param  obj: adc object define in application software.
63   * @retval : adc channel data(float)
64   */
65 float analogin_read(analogin_t *obj);
66 
67 /**
68   * @brief  Reads data from the specified adc channel fifo.
69   * @param  obj: adc object define in application software.
70   * @retval : 16bit adc channel data(int)
71   */
72 uint16_t analogin_read_u16(analogin_t *obj);
73 
74 ///@}
75 /*\@}*/
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif//MBED_ANALOGIN_API_H
82