mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

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