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