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