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