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