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