USB Serial application

Fork of USBSerial_HelloWorld by Samuel Mokrani

Committer:
Zaitsev
Date:
Tue Jan 10 20:42:26 2017 +0000
Revision:
10:41552d038a69
USB Serial bi-directional bridge

Who changed what in which revision?

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