Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers analogout_api.h Source File

analogout_api.h

00001 
00002 /** \addtogroup hal */
00003 /** @{*/
00004 /* mbed Microcontroller Library
00005  * Copyright (c) 2006-2013 ARM Limited
00006  *
00007  * Licensed under the Apache License, Version 2.0 (the "License");
00008  * you may not use this file except in compliance with the License.
00009  * You may obtain a copy of the License at
00010  *
00011  *     http://www.apache.org/licenses/LICENSE-2.0
00012  *
00013  * Unless required by applicable law or agreed to in writing, software
00014  * distributed under the License is distributed on an "AS IS" BASIS,
00015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016  * See the License for the specific language governing permissions and
00017  * limitations under the License.
00018  */
00019 #ifndef MBED_ANALOGOUT_API_H
00020 #define MBED_ANALOGOUT_API_H
00021 
00022 #include "device.h"
00023 
00024 #if DEVICE_ANALOGOUT
00025 
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029 
00030 /** Analogout hal structure. dac_s is declared in the target's hal
00031  */
00032 typedef struct dac_s dac_t;
00033 
00034 /**
00035  * \defgroup hal_analogout Analogout hal functions
00036  * @{
00037  */
00038 
00039 /** Initialize the analogout peripheral
00040  *
00041  * Configures the pin used by analogout.
00042  * @param obj The analogout object to initialize
00043  * @param pin The analogout pin name
00044  */
00045 void analogout_init(dac_t *obj, PinName pin);
00046 
00047 /** Release the analogout object
00048  *
00049  * Note: This is not currently used in the mbed-drivers
00050  * @param obj The analogout object
00051  */
00052 void analogout_free(dac_t *obj);
00053 
00054 /** Set the output voltage, specified as a percentage (float)
00055  *
00056  * @param obj The analogin object
00057  * @param value The floating-point output voltage to be set
00058  */
00059 void analogout_write(dac_t *obj, float value);
00060 
00061 /** Set the output voltage, specified as unsigned 16-bit
00062  *
00063  * @param obj The analogin object
00064  * @param value The unsigned 16-bit output voltage to be set
00065  */
00066 void analogout_write_u16(dac_t *obj, uint16_t value);
00067 
00068 /** Read the current voltage value on the pin
00069  *
00070  * @param obj The analogin object
00071  * @return A floating-point value representing the current voltage on the pin,
00072  *     measured as a percentage
00073  */
00074 float analogout_read(dac_t *obj);
00075 
00076 /** Read the current voltage value on the pin, as a normalized unsigned 16bit value
00077  *
00078  * @param obj The analogin object
00079  * @return An unsigned 16-bit value representing the current voltage on the pin
00080  */
00081 uint16_t analogout_read_u16(dac_t *obj);
00082 
00083 /**@}*/
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #endif
00090 
00091 #endif
00092 
00093 /** @}*/