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