Maxim mbed development library
Dependents: MAX34417_demo MAXREFDES1265 MAXREFDES1265
Fork of mbed-dev by
pwmout_api.h
00001 00002 /** \addtogroup hal */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2013 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 #ifndef MBED_PWMOUT_API_H 00020 #define MBED_PWMOUT_API_H 00021 00022 #include "device.h" 00023 00024 #if DEVICE_PWMOUT 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /** Pwmout hal structure. pwmout_s is declared in the target's hal 00031 */ 00032 typedef struct pwmout_s pwmout_t; 00033 00034 /** 00035 * \defgroup hal_pwmout Pwmout hal functions 00036 * @{ 00037 */ 00038 00039 /** Initialize the pwm out peripheral and configure the pin 00040 * 00041 * @param obj The pwmout object to initialize 00042 * @param pin The pwmout pin to initialize 00043 */ 00044 void pwmout_init(pwmout_t *obj, PinName pin); 00045 00046 /** Deinitialize the pwmout object 00047 * 00048 * @param obj The pwmout object 00049 */ 00050 void pwmout_free(pwmout_t *obj); 00051 00052 /** Set the output duty-cycle in range <0.0f, 1.0f> 00053 * 00054 * Value 0.0f represents 0 percentage, 1.0f represents 100 percent. 00055 * @param obj The pwmout object 00056 * @param percent The floating-point percentage number 00057 */ 00058 void pwmout_write(pwmout_t *obj, float percent); 00059 00060 /** Read the current float-point output duty-cycle 00061 * 00062 * @param obj The pwmout object 00063 * @return A floating-point output duty-cycle 00064 */ 00065 float pwmout_read(pwmout_t *obj); 00066 00067 /** Set the PWM period specified in seconds, keeping the duty cycle the same 00068 * 00069 * Periods smaller than microseconds (the lowest resolution) are set to zero. 00070 * @param obj The pwmout object 00071 * @param seconds The floating-point seconds period 00072 */ 00073 void pwmout_period(pwmout_t *obj, float seconds); 00074 00075 /** Set the PWM period specified in miliseconds, keeping the duty cycle the same 00076 * 00077 * @param obj The pwmout object 00078 * @param ms The milisecond period 00079 */ 00080 void pwmout_period_ms(pwmout_t *obj, int ms); 00081 00082 /** Set the PWM period specified in microseconds, keeping the duty cycle the same 00083 * 00084 * @param obj The pwmout object 00085 * @param us The microsecond period 00086 */ 00087 void pwmout_period_us(pwmout_t *obj, int us); 00088 00089 /** Set the PWM pulsewidth specified in seconds, keeping the period the same. 00090 * 00091 * @param obj The pwmout object 00092 * @param seconds The floating-point pulsewidth in seconds 00093 */ 00094 void pwmout_pulsewidth(pwmout_t *obj, float seconds); 00095 00096 /** Set the PWM pulsewidth specified in miliseconds, keeping the period the same. 00097 * 00098 * @param obj The pwmout object 00099 * @param ms The floating-point pulsewidth in miliseconds 00100 */ 00101 void pwmout_pulsewidth_ms(pwmout_t *obj, int ms); 00102 00103 /** Set the PWM pulsewidth specified in microseconds, keeping the period the same. 00104 * 00105 * @param obj The pwmout object 00106 * @param us The floating-point pulsewidth in microseconds 00107 */ 00108 void pwmout_pulsewidth_us(pwmout_t *obj, int us); 00109 00110 /**@}*/ 00111 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif 00117 00118 #endif 00119 00120 /** @}*/
Generated on Tue Jul 12 2022 20:41:23 by 1.7.2