Entrega 3er corte - sistemas embebidos

Committer:
Bethory
Date:
Wed May 30 00:01:50 2018 +0000
Revision:
0:6ad07c9019fd
Codigo de tales para todos los pasculaes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Bethory 0:6ad07c9019fd 1
Bethory 0:6ad07c9019fd 2 /** \addtogroup hal */
Bethory 0:6ad07c9019fd 3 /** @{*/
Bethory 0:6ad07c9019fd 4 /* mbed Microcontroller Library
Bethory 0:6ad07c9019fd 5 * Copyright (c) 2006-2013 ARM Limited
Bethory 0:6ad07c9019fd 6 *
Bethory 0:6ad07c9019fd 7 * Licensed under the Apache License, Version 2.0 (the "License");
Bethory 0:6ad07c9019fd 8 * you may not use this file except in compliance with the License.
Bethory 0:6ad07c9019fd 9 * You may obtain a copy of the License at
Bethory 0:6ad07c9019fd 10 *
Bethory 0:6ad07c9019fd 11 * http://www.apache.org/licenses/LICENSE-2.0
Bethory 0:6ad07c9019fd 12 *
Bethory 0:6ad07c9019fd 13 * Unless required by applicable law or agreed to in writing, software
Bethory 0:6ad07c9019fd 14 * distributed under the License is distributed on an "AS IS" BASIS,
Bethory 0:6ad07c9019fd 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Bethory 0:6ad07c9019fd 16 * See the License for the specific language governing permissions and
Bethory 0:6ad07c9019fd 17 * limitations under the License.
Bethory 0:6ad07c9019fd 18 */
Bethory 0:6ad07c9019fd 19 #ifndef MBED_ANALOGOUT_API_H
Bethory 0:6ad07c9019fd 20 #define MBED_ANALOGOUT_API_H
Bethory 0:6ad07c9019fd 21
Bethory 0:6ad07c9019fd 22 #include "device.h"
Bethory 0:6ad07c9019fd 23
Bethory 0:6ad07c9019fd 24 #if DEVICE_ANALOGOUT
Bethory 0:6ad07c9019fd 25
Bethory 0:6ad07c9019fd 26 #ifdef __cplusplus
Bethory 0:6ad07c9019fd 27 extern "C" {
Bethory 0:6ad07c9019fd 28 #endif
Bethory 0:6ad07c9019fd 29
Bethory 0:6ad07c9019fd 30 /** Analogout hal structure. dac_s is declared in the target's hal
Bethory 0:6ad07c9019fd 31 */
Bethory 0:6ad07c9019fd 32 typedef struct dac_s dac_t;
Bethory 0:6ad07c9019fd 33
Bethory 0:6ad07c9019fd 34 /**
Bethory 0:6ad07c9019fd 35 * \defgroup hal_analogout Analogout hal functions
Bethory 0:6ad07c9019fd 36 * @{
Bethory 0:6ad07c9019fd 37 */
Bethory 0:6ad07c9019fd 38
Bethory 0:6ad07c9019fd 39 /** Initialize the analogout peripheral
Bethory 0:6ad07c9019fd 40 *
Bethory 0:6ad07c9019fd 41 * Configures the pin used by analogout.
Bethory 0:6ad07c9019fd 42 * @param obj The analogout object to initialize
Bethory 0:6ad07c9019fd 43 * @param pin The analogout pin name
Bethory 0:6ad07c9019fd 44 */
Bethory 0:6ad07c9019fd 45 void analogout_init(dac_t *obj, PinName pin);
Bethory 0:6ad07c9019fd 46
Bethory 0:6ad07c9019fd 47 /** Release the analogout object
Bethory 0:6ad07c9019fd 48 *
Bethory 0:6ad07c9019fd 49 * Note: This is not currently used in the mbed-drivers
Bethory 0:6ad07c9019fd 50 * @param obj The analogout object
Bethory 0:6ad07c9019fd 51 */
Bethory 0:6ad07c9019fd 52 void analogout_free(dac_t *obj);
Bethory 0:6ad07c9019fd 53
Bethory 0:6ad07c9019fd 54 /** Set the output voltage, specified as a percentage (float)
Bethory 0:6ad07c9019fd 55 *
Bethory 0:6ad07c9019fd 56 * @param obj The analogin object
Bethory 0:6ad07c9019fd 57 * @param value The floating-point output voltage to be set
Bethory 0:6ad07c9019fd 58 */
Bethory 0:6ad07c9019fd 59 void analogout_write(dac_t *obj, float value);
Bethory 0:6ad07c9019fd 60
Bethory 0:6ad07c9019fd 61 /** Set the output voltage, specified as unsigned 16-bit
Bethory 0:6ad07c9019fd 62 *
Bethory 0:6ad07c9019fd 63 * @param obj The analogin object
Bethory 0:6ad07c9019fd 64 * @param value The unsigned 16-bit output voltage to be set
Bethory 0:6ad07c9019fd 65 */
Bethory 0:6ad07c9019fd 66 void analogout_write_u16(dac_t *obj, uint16_t value);
Bethory 0:6ad07c9019fd 67
Bethory 0:6ad07c9019fd 68 /** Read the current voltage value on the pin
Bethory 0:6ad07c9019fd 69 *
Bethory 0:6ad07c9019fd 70 * @param obj The analogin object
Bethory 0:6ad07c9019fd 71 * @return A floating-point value representing the current voltage on the pin,
Bethory 0:6ad07c9019fd 72 * measured as a percentage
Bethory 0:6ad07c9019fd 73 */
Bethory 0:6ad07c9019fd 74 float analogout_read(dac_t *obj);
Bethory 0:6ad07c9019fd 75
Bethory 0:6ad07c9019fd 76 /** Read the current voltage value on the pin, as a normalized unsigned 16bit value
Bethory 0:6ad07c9019fd 77 *
Bethory 0:6ad07c9019fd 78 * @param obj The analogin object
Bethory 0:6ad07c9019fd 79 * @return An unsigned 16-bit value representing the current voltage on the pin
Bethory 0:6ad07c9019fd 80 */
Bethory 0:6ad07c9019fd 81 uint16_t analogout_read_u16(dac_t *obj);
Bethory 0:6ad07c9019fd 82
Bethory 0:6ad07c9019fd 83 /**@}*/
Bethory 0:6ad07c9019fd 84
Bethory 0:6ad07c9019fd 85 #ifdef __cplusplus
Bethory 0:6ad07c9019fd 86 }
Bethory 0:6ad07c9019fd 87 #endif
Bethory 0:6ad07c9019fd 88
Bethory 0:6ad07c9019fd 89 #endif
Bethory 0:6ad07c9019fd 90
Bethory 0:6ad07c9019fd 91 #endif
Bethory 0:6ad07c9019fd 92
Bethory 0:6ad07c9019fd 93 /** @}*/