Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Fri Jun 02 19:35:26 2017 +0000
Revision:
45:8b0bee6baf38
Parent:
18:6a4db94011d3
Final CAMM AAMC Working Code

Who changed what in which revision?

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