Nicolas Borla / Mbed OS ROME2_Robot_Firmware
Committer:
boro
Date:
Tue Mar 09 13:10:40 2021 +0000
Revision:
3:6fe17b8a6d62
Parent:
0:4beb2ea291ec
SDBlockDevice added

Who changed what in which revision?

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