[374] | 1 |
|
---|
| 2 | /** \addtogroup hal */
|
---|
| 3 | /** @{*/
|
---|
| 4 | /* mbed Microcontroller Library
|
---|
| 5 | * Copyright (c) 2006-2013 ARM Limited
|
---|
| 6 | *
|
---|
| 7 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 8 | * you may not use this file except in compliance with the License.
|
---|
| 9 | * You may obtain a copy of the License at
|
---|
| 10 | *
|
---|
| 11 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 12 | *
|
---|
| 13 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 14 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 16 | * See the License for the specific language governing permissions and
|
---|
| 17 | * limitations under the License.
|
---|
| 18 | */
|
---|
| 19 | #ifndef MBED_ANALOGIN_API_H
|
---|
| 20 | #define MBED_ANALOGIN_API_H
|
---|
| 21 |
|
---|
| 22 | #include "device.h"
|
---|
| 23 |
|
---|
| 24 | #if DEVICE_ANALOGIN
|
---|
| 25 |
|
---|
| 26 | #ifdef __cplusplus
|
---|
| 27 | extern "C" {
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | /** Analogin hal structure. analogin_s is declared in the target's hal
|
---|
| 31 | */
|
---|
| 32 | typedef struct analogin_s analogin_t;
|
---|
| 33 |
|
---|
| 34 | /**
|
---|
| 35 | * \defgroup hal_analogin Analogin hal functions
|
---|
| 36 | * @{
|
---|
| 37 | */
|
---|
| 38 |
|
---|
| 39 | /** Initialize the analogin peripheral
|
---|
| 40 | *
|
---|
| 41 | * Configures the pin used by analogin.
|
---|
| 42 | * @param obj The analogin object to initialize
|
---|
| 43 | * @param pin The analogin pin name
|
---|
| 44 | */
|
---|
| 45 | void analogin_init(analogin_t *obj, PinName pin);
|
---|
| 46 |
|
---|
| 47 | /** Read the input voltage, represented as a float in the range [0.0, 1.0]
|
---|
| 48 | *
|
---|
| 49 | * @param obj The analogin object
|
---|
| 50 | * @return A floating value representing the current input voltage
|
---|
| 51 | */
|
---|
| 52 | float analogin_read(analogin_t *obj);
|
---|
| 53 |
|
---|
| 54 | /** Read the value from analogin pin, represented as an unsigned 16bit value
|
---|
| 55 | *
|
---|
| 56 | * @param obj The analogin object
|
---|
| 57 | * @return An unsigned 16bit value representing the current input voltage
|
---|
| 58 | */
|
---|
| 59 | uint16_t analogin_read_u16(analogin_t *obj);
|
---|
| 60 |
|
---|
| 61 | /**@}*/
|
---|
| 62 |
|
---|
| 63 | #ifdef __cplusplus
|
---|
| 64 | }
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|
| 67 | #endif
|
---|
| 68 |
|
---|
| 69 | #endif
|
---|
| 70 |
|
---|
| 71 | /** @}*/
|
---|