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