mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

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