John Alexander / VL53L3ExpansionBoard

Dependencies:   VL53L3_Lib

Dependents:  

Committer:
charlesmn
Date:
Fri Oct 16 15:04:28 2020 +0000
Revision:
0:293607457a02
Change typo in name

Who changed what in which revision?

UserRevisionLine numberNew contents of line
charlesmn 0:293607457a02 1 /**
charlesmn 0:293607457a02 2 ******************************************************************************
charlesmn 0:293607457a02 3 * @file BDCMotor.h
charlesmn 0:293607457a02 4 * @author IPC Rennes
charlesmn 0:293607457a02 5 * @version V1.0.0
charlesmn 0:293607457a02 6 * @date April 6th, 2016
charlesmn 0:293607457a02 7 * @brief This file contains the abstract class describing the interface of a
charlesmn 0:293607457a02 8 * Brush DC motor component.
charlesmn 0:293607457a02 9 ******************************************************************************
charlesmn 0:293607457a02 10 * @attention
charlesmn 0:293607457a02 11 *
charlesmn 0:293607457a02 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
charlesmn 0:293607457a02 13 *
charlesmn 0:293607457a02 14 * Redistribution and use in source and binary forms, with or without modification,
charlesmn 0:293607457a02 15 * are permitted provided that the following conditions are met:
charlesmn 0:293607457a02 16 * 1. Redistributions of source code must retain the above copyright notice,
charlesmn 0:293607457a02 17 * this list of conditions and the following disclaimer.
charlesmn 0:293607457a02 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
charlesmn 0:293607457a02 19 * this list of conditions and the following disclaimer in the documentation
charlesmn 0:293607457a02 20 * and/or other materials provided with the distribution.
charlesmn 0:293607457a02 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
charlesmn 0:293607457a02 22 * may be used to endorse or promote products derived from this software
charlesmn 0:293607457a02 23 * without specific prior written permission.
charlesmn 0:293607457a02 24 *
charlesmn 0:293607457a02 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
charlesmn 0:293607457a02 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
charlesmn 0:293607457a02 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
charlesmn 0:293607457a02 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
charlesmn 0:293607457a02 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
charlesmn 0:293607457a02 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
charlesmn 0:293607457a02 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
charlesmn 0:293607457a02 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
charlesmn 0:293607457a02 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
charlesmn 0:293607457a02 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
charlesmn 0:293607457a02 35 *
charlesmn 0:293607457a02 36 ******************************************************************************
charlesmn 0:293607457a02 37 */
charlesmn 0:293607457a02 38
charlesmn 0:293607457a02 39
charlesmn 0:293607457a02 40 /* Define to prevent from recursive inclusion --------------------------------*/
charlesmn 0:293607457a02 41
charlesmn 0:293607457a02 42 #ifndef __BDCMOTOR_CLASS_H
charlesmn 0:293607457a02 43 #define __BDCMOTOR_CLASS_H
charlesmn 0:293607457a02 44
charlesmn 0:293607457a02 45
charlesmn 0:293607457a02 46 /* Includes ------------------------------------------------------------------*/
charlesmn 0:293607457a02 47
charlesmn 0:293607457a02 48 #include <Component.h>
charlesmn 0:293607457a02 49
charlesmn 0:293607457a02 50
charlesmn 0:293607457a02 51 /* Classes ------------------------------------------------------------------*/
charlesmn 0:293607457a02 52
charlesmn 0:293607457a02 53 /**
charlesmn 0:293607457a02 54 * An abstract class for BDCMotor components.
charlesmn 0:293607457a02 55 */
charlesmn 0:293607457a02 56 class BDCMotor : public Component {
charlesmn 0:293607457a02 57 public:
charlesmn 0:293607457a02 58
charlesmn 0:293607457a02 59 /**
charlesmn 0:293607457a02 60 * @brief Rotation modes.
charlesmn 0:293607457a02 61 */
charlesmn 0:293607457a02 62 typedef enum {
charlesmn 0:293607457a02 63 BWD = 0, /* Backward. */
charlesmn 0:293607457a02 64 FWD = 1 /* Forward. */
charlesmn 0:293607457a02 65 } direction_t;
charlesmn 0:293607457a02 66
charlesmn 0:293607457a02 67 /**
charlesmn 0:293607457a02 68 * @brief Disabling the specified bridge.
charlesmn 0:293607457a02 69 * @param bridgeId from 0 for bridge A to 1 for bridge B.
charlesmn 0:293607457a02 70 * @retval None.
charlesmn 0:293607457a02 71 */
charlesmn 0:293607457a02 72 virtual void disable_bridge(unsigned int) = 0;
charlesmn 0:293607457a02 73
charlesmn 0:293607457a02 74 /**
charlesmn 0:293607457a02 75 * @brief Enabling the specified bridge.
charlesmn 0:293607457a02 76 * @param bridgeId from 0 for bridge A to 1 for bridge B
charlesmn 0:293607457a02 77 * @retval None.
charlesmn 0:293607457a02 78 */
charlesmn 0:293607457a02 79 virtual void enable_bridge(unsigned int) = 0;
charlesmn 0:293607457a02 80
charlesmn 0:293607457a02 81 /**
charlesmn 0:293607457a02 82 * @brief Getting the PWM frequency of the specified bridge;
charlesmn 0:293607457a02 83 * @param bridgeId from 0 for bridge A to 1 for bridge B.
charlesmn 0:293607457a02 84 * @retval The frequency in Hz of the specified bridge input PWM.
charlesmn 0:293607457a02 85 */
charlesmn 0:293607457a02 86 virtual unsigned int get_bridge_input_pwm_freq(unsigned int) = 0;
charlesmn 0:293607457a02 87
charlesmn 0:293607457a02 88 /**
charlesmn 0:293607457a02 89 * @brief Getting the bridge status.
charlesmn 0:293607457a02 90 * @param bridgeId from 0 for bridge A to 1 for bridge B.
charlesmn 0:293607457a02 91 * @retval The status.
charlesmn 0:293607457a02 92 */
charlesmn 0:293607457a02 93 virtual unsigned int get_bridge_status(unsigned int) = 0;
charlesmn 0:293607457a02 94
charlesmn 0:293607457a02 95 /**
charlesmn 0:293607457a02 96 * @brief Getting the device State.
charlesmn 0:293607457a02 97 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 98 * @retval The device state
charlesmn 0:293607457a02 99 */
charlesmn 0:293607457a02 100 virtual unsigned int get_device_state(unsigned int) = 0;
charlesmn 0:293607457a02 101
charlesmn 0:293607457a02 102 /**
charlesmn 0:293607457a02 103 * @brief Getting the current speed in % of the specified motor.
charlesmn 0:293607457a02 104 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 105 * @retval The current speed in %.
charlesmn 0:293607457a02 106 */
charlesmn 0:293607457a02 107 virtual unsigned int get_speed(unsigned int) = 0;
charlesmn 0:293607457a02 108
charlesmn 0:293607457a02 109 /**
charlesmn 0:293607457a02 110 * @brief Stopping the motor and disabling the power bridge immediately.
charlesmn 0:293607457a02 111 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 112 * @retval None.
charlesmn 0:293607457a02 113 */
charlesmn 0:293607457a02 114 virtual void hard_hiz(unsigned int) = 0;
charlesmn 0:293607457a02 115
charlesmn 0:293607457a02 116 /**
charlesmn 0:293607457a02 117 * @brief Stopping the motor immediately.
charlesmn 0:293607457a02 118 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 119 * @retval None.
charlesmn 0:293607457a02 120 */
charlesmn 0:293607457a02 121 virtual void hard_stop(unsigned int) = 0;
charlesmn 0:293607457a02 122
charlesmn 0:293607457a02 123 /**
charlesmn 0:293607457a02 124 * @brief Running the motor.
charlesmn 0:293607457a02 125 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 126 * @param direction The direction of rotation.
charlesmn 0:293607457a02 127 * @retval None.
charlesmn 0:293607457a02 128 */
charlesmn 0:293607457a02 129 virtual void run(unsigned int, direction_t) = 0;
charlesmn 0:293607457a02 130
charlesmn 0:293607457a02 131 /**
charlesmn 0:293607457a02 132 * @brief Setting the PWM frequency of the specified bridge.
charlesmn 0:293607457a02 133 * @param bridgeId from 0 for bridge A to 1 for bridge B.
charlesmn 0:293607457a02 134 * @param frequency of the PWM in Hz
charlesmn 0:293607457a02 135 * @retval None.
charlesmn 0:293607457a02 136 */
charlesmn 0:293607457a02 137 virtual void set_bridge_input_pwm_freq(unsigned int, unsigned int) = 0;
charlesmn 0:293607457a02 138
charlesmn 0:293607457a02 139 /**
charlesmn 0:293607457a02 140 * @brief Setting the dual bridge configuration mode.
charlesmn 0:293607457a02 141 * @param configuration. The bridge configuration.
charlesmn 0:293607457a02 142 * @retval None.
charlesmn 0:293607457a02 143 */
charlesmn 0:293607457a02 144 virtual void set_dual_full_bridge_config(unsigned int) = 0;
charlesmn 0:293607457a02 145
charlesmn 0:293607457a02 146 /**
charlesmn 0:293607457a02 147 * @brief Setting the speed in %.
charlesmn 0:293607457a02 148 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1).
charlesmn 0:293607457a02 149 * @param speed The new speed in %.
charlesmn 0:293607457a02 150 * @retval "true" in case of success, "false" otherwise.
charlesmn 0:293607457a02 151 */
charlesmn 0:293607457a02 152 virtual bool set_speed(unsigned int, unsigned int) = 0;
charlesmn 0:293607457a02 153
charlesmn 0:293607457a02 154 /**
charlesmn 0:293607457a02 155 * @brief Destructor.
charlesmn 0:293607457a02 156 */
charlesmn 0:293607457a02 157 virtual ~BDCMotor() {};
charlesmn 0:293607457a02 158 };
charlesmn 0:293607457a02 159
charlesmn 0:293607457a02 160 #endif /* __BDCMOTOR_CLASS_H */
charlesmn 0:293607457a02 161
charlesmn 0:293607457a02 162 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/