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