mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
cmsis/BUILD/mbed/hal/pwmout_api.h@189:f392fc9709a3, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 22:31:08 2019 +0000
- Revision:
- 189:f392fc9709a3
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 189:f392fc9709a3 | 1 | |
AnnaBridge | 189:f392fc9709a3 | 2 | /** \addtogroup hal */ |
AnnaBridge | 189:f392fc9709a3 | 3 | /** @{*/ |
AnnaBridge | 189:f392fc9709a3 | 4 | /* mbed Microcontroller Library |
AnnaBridge | 189:f392fc9709a3 | 5 | * Copyright (c) 2006-2013 ARM Limited |
AnnaBridge | 189:f392fc9709a3 | 6 | * SPDX-License-Identifier: Apache-2.0 |
AnnaBridge | 189:f392fc9709a3 | 7 | * |
AnnaBridge | 189:f392fc9709a3 | 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
AnnaBridge | 189:f392fc9709a3 | 9 | * you may not use this file except in compliance with the License. |
AnnaBridge | 189:f392fc9709a3 | 10 | * You may obtain a copy of the License at |
AnnaBridge | 189:f392fc9709a3 | 11 | * |
AnnaBridge | 189:f392fc9709a3 | 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 189:f392fc9709a3 | 13 | * |
AnnaBridge | 189:f392fc9709a3 | 14 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 189:f392fc9709a3 | 15 | * distributed under the License is distributed on an "AS IS" BASIS, |
AnnaBridge | 189:f392fc9709a3 | 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 189:f392fc9709a3 | 17 | * See the License for the specific language governing permissions and |
AnnaBridge | 189:f392fc9709a3 | 18 | * limitations under the License. |
AnnaBridge | 189:f392fc9709a3 | 19 | */ |
AnnaBridge | 189:f392fc9709a3 | 20 | #ifndef MBED_PWMOUT_API_H |
AnnaBridge | 189:f392fc9709a3 | 21 | #define MBED_PWMOUT_API_H |
AnnaBridge | 189:f392fc9709a3 | 22 | |
AnnaBridge | 189:f392fc9709a3 | 23 | #include "device.h" |
AnnaBridge | 189:f392fc9709a3 | 24 | |
AnnaBridge | 189:f392fc9709a3 | 25 | #if DEVICE_PWMOUT |
AnnaBridge | 189:f392fc9709a3 | 26 | |
AnnaBridge | 189:f392fc9709a3 | 27 | #ifdef __cplusplus |
AnnaBridge | 189:f392fc9709a3 | 28 | extern "C" { |
AnnaBridge | 189:f392fc9709a3 | 29 | #endif |
AnnaBridge | 189:f392fc9709a3 | 30 | |
AnnaBridge | 189:f392fc9709a3 | 31 | /** Pwmout hal structure. pwmout_s is declared in the target's hal |
AnnaBridge | 189:f392fc9709a3 | 32 | */ |
AnnaBridge | 189:f392fc9709a3 | 33 | typedef struct pwmout_s pwmout_t; |
AnnaBridge | 189:f392fc9709a3 | 34 | |
AnnaBridge | 189:f392fc9709a3 | 35 | /** |
AnnaBridge | 189:f392fc9709a3 | 36 | * \defgroup hal_pwmout Pwmout hal functions |
AnnaBridge | 189:f392fc9709a3 | 37 | * @{ |
AnnaBridge | 189:f392fc9709a3 | 38 | */ |
AnnaBridge | 189:f392fc9709a3 | 39 | |
AnnaBridge | 189:f392fc9709a3 | 40 | /** Initialize the pwm out peripheral and configure the pin |
AnnaBridge | 189:f392fc9709a3 | 41 | * |
AnnaBridge | 189:f392fc9709a3 | 42 | * @param obj The pwmout object to initialize |
AnnaBridge | 189:f392fc9709a3 | 43 | * @param pin The pwmout pin to initialize |
AnnaBridge | 189:f392fc9709a3 | 44 | */ |
AnnaBridge | 189:f392fc9709a3 | 45 | void pwmout_init(pwmout_t *obj, PinName pin); |
AnnaBridge | 189:f392fc9709a3 | 46 | |
AnnaBridge | 189:f392fc9709a3 | 47 | /** Deinitialize the pwmout object |
AnnaBridge | 189:f392fc9709a3 | 48 | * |
AnnaBridge | 189:f392fc9709a3 | 49 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 50 | */ |
AnnaBridge | 189:f392fc9709a3 | 51 | void pwmout_free(pwmout_t *obj); |
AnnaBridge | 189:f392fc9709a3 | 52 | |
AnnaBridge | 189:f392fc9709a3 | 53 | /** Set the output duty-cycle in range <0.0f, 1.0f> |
AnnaBridge | 189:f392fc9709a3 | 54 | * |
AnnaBridge | 189:f392fc9709a3 | 55 | * Value 0.0f represents 0 percentage, 1.0f represents 100 percent. |
AnnaBridge | 189:f392fc9709a3 | 56 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 57 | * @param percent The floating-point percentage number |
AnnaBridge | 189:f392fc9709a3 | 58 | */ |
AnnaBridge | 189:f392fc9709a3 | 59 | void pwmout_write(pwmout_t *obj, float percent); |
AnnaBridge | 189:f392fc9709a3 | 60 | |
AnnaBridge | 189:f392fc9709a3 | 61 | /** Read the current float-point output duty-cycle |
AnnaBridge | 189:f392fc9709a3 | 62 | * |
AnnaBridge | 189:f392fc9709a3 | 63 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 64 | * @return A floating-point output duty-cycle |
AnnaBridge | 189:f392fc9709a3 | 65 | */ |
AnnaBridge | 189:f392fc9709a3 | 66 | float pwmout_read(pwmout_t *obj); |
AnnaBridge | 189:f392fc9709a3 | 67 | |
AnnaBridge | 189:f392fc9709a3 | 68 | /** Set the PWM period specified in seconds, keeping the duty cycle the same |
AnnaBridge | 189:f392fc9709a3 | 69 | * |
AnnaBridge | 189:f392fc9709a3 | 70 | * Periods smaller than microseconds (the lowest resolution) are set to zero. |
AnnaBridge | 189:f392fc9709a3 | 71 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 72 | * @param seconds The floating-point seconds period |
AnnaBridge | 189:f392fc9709a3 | 73 | */ |
AnnaBridge | 189:f392fc9709a3 | 74 | void pwmout_period(pwmout_t *obj, float seconds); |
AnnaBridge | 189:f392fc9709a3 | 75 | |
AnnaBridge | 189:f392fc9709a3 | 76 | /** Set the PWM period specified in miliseconds, keeping the duty cycle the same |
AnnaBridge | 189:f392fc9709a3 | 77 | * |
AnnaBridge | 189:f392fc9709a3 | 78 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 79 | * @param ms The milisecond period |
AnnaBridge | 189:f392fc9709a3 | 80 | */ |
AnnaBridge | 189:f392fc9709a3 | 81 | void pwmout_period_ms(pwmout_t *obj, int ms); |
AnnaBridge | 189:f392fc9709a3 | 82 | |
AnnaBridge | 189:f392fc9709a3 | 83 | /** Set the PWM period specified in microseconds, keeping the duty cycle the same |
AnnaBridge | 189:f392fc9709a3 | 84 | * |
AnnaBridge | 189:f392fc9709a3 | 85 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 86 | * @param us The microsecond period |
AnnaBridge | 189:f392fc9709a3 | 87 | */ |
AnnaBridge | 189:f392fc9709a3 | 88 | void pwmout_period_us(pwmout_t *obj, int us); |
AnnaBridge | 189:f392fc9709a3 | 89 | |
AnnaBridge | 189:f392fc9709a3 | 90 | /** Set the PWM pulsewidth specified in seconds, keeping the period the same. |
AnnaBridge | 189:f392fc9709a3 | 91 | * |
AnnaBridge | 189:f392fc9709a3 | 92 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 93 | * @param seconds The floating-point pulsewidth in seconds |
AnnaBridge | 189:f392fc9709a3 | 94 | */ |
AnnaBridge | 189:f392fc9709a3 | 95 | void pwmout_pulsewidth(pwmout_t *obj, float seconds); |
AnnaBridge | 189:f392fc9709a3 | 96 | |
AnnaBridge | 189:f392fc9709a3 | 97 | /** Set the PWM pulsewidth specified in miliseconds, keeping the period the same. |
AnnaBridge | 189:f392fc9709a3 | 98 | * |
AnnaBridge | 189:f392fc9709a3 | 99 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 100 | * @param ms The floating-point pulsewidth in miliseconds |
AnnaBridge | 189:f392fc9709a3 | 101 | */ |
AnnaBridge | 189:f392fc9709a3 | 102 | void pwmout_pulsewidth_ms(pwmout_t *obj, int ms); |
AnnaBridge | 189:f392fc9709a3 | 103 | |
AnnaBridge | 189:f392fc9709a3 | 104 | /** Set the PWM pulsewidth specified in microseconds, keeping the period the same. |
AnnaBridge | 189:f392fc9709a3 | 105 | * |
AnnaBridge | 189:f392fc9709a3 | 106 | * @param obj The pwmout object |
AnnaBridge | 189:f392fc9709a3 | 107 | * @param us The floating-point pulsewidth in microseconds |
AnnaBridge | 189:f392fc9709a3 | 108 | */ |
AnnaBridge | 189:f392fc9709a3 | 109 | void pwmout_pulsewidth_us(pwmout_t *obj, int us); |
AnnaBridge | 189:f392fc9709a3 | 110 | |
AnnaBridge | 189:f392fc9709a3 | 111 | /**@}*/ |
AnnaBridge | 189:f392fc9709a3 | 112 | |
AnnaBridge | 189:f392fc9709a3 | 113 | #ifdef __cplusplus |
AnnaBridge | 189:f392fc9709a3 | 114 | } |
AnnaBridge | 189:f392fc9709a3 | 115 | #endif |
AnnaBridge | 189:f392fc9709a3 | 116 | |
AnnaBridge | 189:f392fc9709a3 | 117 | #endif |
AnnaBridge | 189:f392fc9709a3 | 118 | |
AnnaBridge | 189:f392fc9709a3 | 119 | #endif |
AnnaBridge | 189:f392fc9709a3 | 120 | |
AnnaBridge | 189:f392fc9709a3 | 121 | /** @}*/ |