Elijah Stanger-Jones / mbed-dev-f303
Committer:
elijahsj
Date:
Mon Nov 09 00:02:47 2020 -0500
Revision:
1:8a094db1347f
test

Who changed what in which revision?

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