Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BDCMotor.h
00001 /** 00002 ****************************************************************************** 00003 * @file BDCMotor.h 00004 * @author IPC Rennes 00005 * @version V1.0.0 00006 * @date April 6th, 2016 00007 * @brief This file contains the abstract class describing the interface of a 00008 * Brush DC motor component. 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 00040 /* Define to prevent from recursive inclusion --------------------------------*/ 00041 00042 #ifndef __BDCMOTOR_CLASS_H 00043 #define __BDCMOTOR_CLASS_H 00044 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 00048 #include <Component.h> 00049 00050 00051 /* Classes ------------------------------------------------------------------*/ 00052 00053 /** 00054 * An abstract class for BDCMotor components. 00055 */ 00056 class BDCMotor : public Component { 00057 public: 00058 00059 /** 00060 * @brief Rotation modes. 00061 */ 00062 typedef enum { 00063 BWD = 0, /* Backward. */ 00064 FWD = 1 /* Forward. */ 00065 } direction_t; 00066 00067 /** 00068 * @brief Disabling the specified bridge. 00069 * @param bridgeId from 0 for bridge A to 1 for bridge B. 00070 * @retval None. 00071 */ 00072 virtual void disable_bridge(unsigned int) = 0; 00073 00074 /** 00075 * @brief Enabling the specified bridge. 00076 * @param bridgeId from 0 for bridge A to 1 for bridge B 00077 * @retval None. 00078 */ 00079 virtual void enable_bridge(unsigned int) = 0; 00080 00081 /** 00082 * @brief Getting the PWM frequency of the specified bridge; 00083 * @param bridgeId from 0 for bridge A to 1 for bridge B. 00084 * @retval The frequency in Hz of the specified bridge input PWM. 00085 */ 00086 virtual unsigned int get_bridge_input_pwm_freq(unsigned int) = 0; 00087 00088 /** 00089 * @brief Getting the bridge status. 00090 * @param bridgeId from 0 for bridge A to 1 for bridge B. 00091 * @retval The status. 00092 */ 00093 virtual unsigned int get_bridge_status(unsigned int) = 0; 00094 00095 /** 00096 * @brief Getting the device State. 00097 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00098 * @retval The device state 00099 */ 00100 virtual unsigned int get_device_state(unsigned int) = 0; 00101 00102 /** 00103 * @brief Getting the current speed in % of the specified motor. 00104 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00105 * @retval The current speed in %. 00106 */ 00107 virtual unsigned int get_speed(unsigned int) = 0; 00108 00109 /** 00110 * @brief Stopping the motor and disabling the power bridge immediately. 00111 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00112 * @retval None. 00113 */ 00114 virtual void hard_hiz(unsigned int) = 0; 00115 00116 /** 00117 * @brief Stopping the motor immediately. 00118 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00119 * @retval None. 00120 */ 00121 virtual void hard_stop(unsigned int) = 0; 00122 00123 /** 00124 * @brief Running the motor. 00125 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00126 * @param direction The direction of rotation. 00127 * @retval None. 00128 */ 00129 virtual void run(unsigned int, direction_t) = 0; 00130 00131 /** 00132 * @brief Setting the PWM frequency of the specified bridge. 00133 * @param bridgeId from 0 for bridge A to 1 for bridge B. 00134 * @param frequency of the PWM in Hz 00135 * @retval None. 00136 */ 00137 virtual void set_bridge_input_pwm_freq(unsigned int, unsigned int) = 0; 00138 00139 /** 00140 * @brief Setting the dual bridge configuration mode. 00141 * @param configuration. The bridge configuration. 00142 * @retval None. 00143 */ 00144 virtual void set_dual_full_bridge_config(unsigned int) = 0; 00145 00146 /** 00147 * @brief Setting the speed in %. 00148 * @param motorId from 0 to (MAX_NUMBER_OF_BRUSH_DC_MOTORS - 1). 00149 * @param speed The new speed in %. 00150 * @retval "true" in case of success, "false" otherwise. 00151 */ 00152 virtual bool set_speed(unsigned int, unsigned int) = 0; 00153 00154 /** 00155 * @brief Destructor. 00156 */ 00157 virtual ~BDCMotor() {}; 00158 }; 00159 00160 #endif /* __BDCMOTOR_CLASS_H */ 00161 00162 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 20:07:14 by
1.7.2