CDY version that shares functionality with Counter

Dependencies:   SDFileSystem_HelloWorld mbed FATFileSystem

Committer:
Charles David Young
Date:
Mon Nov 05 09:52:17 2018 -0700
Revision:
3:c547dba5d39b
Parent:
0:aa13e1c335cd
debug

Who changed what in which revision?

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