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