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