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