BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Committer:
gustavatmel
Date:
Tue May 01 15:47:08 2018 +0000
Revision:
1:9c5af431a1f1
sdf

Who changed what in which revision?

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