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

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.