Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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