Use BDCMotor_class.h instead of motor_class.h
Dependents: HelloWorld_IHM04A1
Fork of X_NUCLEO_IHM04A1 by
Components/Interfaces/Motor_class.h@0:2cb6ce8e07bd, 2016-05-03 (annotated)
- Committer:
- brdirais
- Date:
- Tue May 03 11:16:57 2016 +0000
- Revision:
- 0:2cb6ce8e07bd
- Child:
- 1:2597a6165252
Initial version of X-NUCLEO-IHM04A1 library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
brdirais | 0:2cb6ce8e07bd | 1 | /** |
brdirais | 0:2cb6ce8e07bd | 2 | ****************************************************************************** |
brdirais | 0:2cb6ce8e07bd | 3 | * @file Motor_class.h |
brdirais | 0:2cb6ce8e07bd | 4 | * @author AST |
brdirais | 0:2cb6ce8e07bd | 5 | * @version V1.0.0 |
brdirais | 0:2cb6ce8e07bd | 6 | * @date April 13th, 2015 |
brdirais | 0:2cb6ce8e07bd | 7 | * @brief This file contains the abstract class describing the interface of a |
brdirais | 0:2cb6ce8e07bd | 8 | * motor component. |
brdirais | 0:2cb6ce8e07bd | 9 | ****************************************************************************** |
brdirais | 0:2cb6ce8e07bd | 10 | * @attention |
brdirais | 0:2cb6ce8e07bd | 11 | * |
brdirais | 0:2cb6ce8e07bd | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
brdirais | 0:2cb6ce8e07bd | 13 | * |
brdirais | 0:2cb6ce8e07bd | 14 | * Redistribution and use in source and binary forms, with or without modification, |
brdirais | 0:2cb6ce8e07bd | 15 | * are permitted provided that the following conditions are met: |
brdirais | 0:2cb6ce8e07bd | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
brdirais | 0:2cb6ce8e07bd | 17 | * this list of conditions and the following disclaimer. |
brdirais | 0:2cb6ce8e07bd | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
brdirais | 0:2cb6ce8e07bd | 19 | * this list of conditions and the following disclaimer in the documentation |
brdirais | 0:2cb6ce8e07bd | 20 | * and/or other materials provided with the distribution. |
brdirais | 0:2cb6ce8e07bd | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
brdirais | 0:2cb6ce8e07bd | 22 | * may be used to endorse or promote products derived from this software |
brdirais | 0:2cb6ce8e07bd | 23 | * without specific prior written permission. |
brdirais | 0:2cb6ce8e07bd | 24 | * |
brdirais | 0:2cb6ce8e07bd | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
brdirais | 0:2cb6ce8e07bd | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
brdirais | 0:2cb6ce8e07bd | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
brdirais | 0:2cb6ce8e07bd | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
brdirais | 0:2cb6ce8e07bd | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
brdirais | 0:2cb6ce8e07bd | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
brdirais | 0:2cb6ce8e07bd | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
brdirais | 0:2cb6ce8e07bd | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
brdirais | 0:2cb6ce8e07bd | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
brdirais | 0:2cb6ce8e07bd | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
brdirais | 0:2cb6ce8e07bd | 35 | * |
brdirais | 0:2cb6ce8e07bd | 36 | ****************************************************************************** |
brdirais | 0:2cb6ce8e07bd | 37 | */ |
brdirais | 0:2cb6ce8e07bd | 38 | |
brdirais | 0:2cb6ce8e07bd | 39 | |
brdirais | 0:2cb6ce8e07bd | 40 | /* Generated with STM32CubeTOO -----------------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 41 | |
brdirais | 0:2cb6ce8e07bd | 42 | |
brdirais | 0:2cb6ce8e07bd | 43 | /* Revision ------------------------------------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 44 | /* |
brdirais | 0:2cb6ce8e07bd | 45 | Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev |
brdirais | 0:2cb6ce8e07bd | 46 | Branch/Trunk/Tag: trunk |
brdirais | 0:2cb6ce8e07bd | 47 | Based on: X-CUBE-SPN4/trunk/Drivers/BSP/Components/Common/motor.h |
brdirais | 0:2cb6ce8e07bd | 48 | Revision: 0 |
brdirais | 0:2cb6ce8e07bd | 49 | */ |
brdirais | 0:2cb6ce8e07bd | 50 | |
brdirais | 0:2cb6ce8e07bd | 51 | |
brdirais | 0:2cb6ce8e07bd | 52 | /* Define to prevent recursive inclusion -------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 53 | |
brdirais | 0:2cb6ce8e07bd | 54 | #ifndef __MOTOR_CLASS_H |
brdirais | 0:2cb6ce8e07bd | 55 | #define __MOTOR_CLASS_H |
brdirais | 0:2cb6ce8e07bd | 56 | |
brdirais | 0:2cb6ce8e07bd | 57 | |
brdirais | 0:2cb6ce8e07bd | 58 | /* Includes ------------------------------------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 59 | |
brdirais | 0:2cb6ce8e07bd | 60 | #include "Component_class.h" |
brdirais | 0:2cb6ce8e07bd | 61 | |
brdirais | 0:2cb6ce8e07bd | 62 | |
brdirais | 0:2cb6ce8e07bd | 63 | /* Classes ------------------------------------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 64 | |
brdirais | 0:2cb6ce8e07bd | 65 | /** An abstract class for Motor components. |
brdirais | 0:2cb6ce8e07bd | 66 | */ |
brdirais | 0:2cb6ce8e07bd | 67 | class Motor : public Component |
brdirais | 0:2cb6ce8e07bd | 68 | { |
brdirais | 0:2cb6ce8e07bd | 69 | public: |
brdirais | 0:2cb6ce8e07bd | 70 | /* ACTION 1 --------------------------------------------------------------* |
brdirais | 0:2cb6ce8e07bd | 71 | * Declare here the interface's methods. * |
brdirais | 0:2cb6ce8e07bd | 72 | * They should be: * |
brdirais | 0:2cb6ce8e07bd | 73 | * + Methods with the same name of the C component's virtual table * |
brdirais | 0:2cb6ce8e07bd | 74 | * (and extended virtual table, if any)'s functions, provided that * |
brdirais | 0:2cb6ce8e07bd | 75 | * the component's driver implements them (i.e.: the corresponding * |
brdirais | 0:2cb6ce8e07bd | 76 | * pointer to function is not "0"). * |
brdirais | 0:2cb6ce8e07bd | 77 | * * |
brdirais | 0:2cb6ce8e07bd | 78 | * Example: * |
brdirais | 0:2cb6ce8e07bd | 79 | * virtual int GetValue(float *f) = 0; * |
brdirais | 0:2cb6ce8e07bd | 80 | *------------------------------------------------------------------------*/ |
brdirais | 0:2cb6ce8e07bd | 81 | virtual uint16_t GetCurrentSpeed(uint8_t motorId) = 0; |
brdirais | 0:2cb6ce8e07bd | 82 | virtual motorState_t GetDeviceState(uint8_t motorId) = 0; |
brdirais | 0:2cb6ce8e07bd | 83 | virtual uint8_t GetFwVersion(void) = 0; |
brdirais | 0:2cb6ce8e07bd | 84 | virtual uint16_t GetMaxSpeed(uint8_t motorId) = 0; |
brdirais | 0:2cb6ce8e07bd | 85 | virtual void HardStop(uint8_t motorId) = 0; |
brdirais | 0:2cb6ce8e07bd | 86 | virtual void Run(uint8_t stepCount, motorDir_t direction) = 0; |
brdirais | 0:2cb6ce8e07bd | 87 | virtual bool SetMaxSpeed(uint8_t motorId, uint16_t newMaxSpeed) = 0; |
brdirais | 0:2cb6ce8e07bd | 88 | virtual void CmdDisable(uint8_t bridgeId) = 0; |
brdirais | 0:2cb6ce8e07bd | 89 | virtual void CmdEnable(uint8_t bridgeId) = 0; |
brdirais | 0:2cb6ce8e07bd | 90 | virtual uint16_t CmdGetStatus(uint8_t bridgeId) = 0; |
brdirais | 0:2cb6ce8e07bd | 91 | virtual void CmdHardHiZ(uint8_t motorId) = 0; |
brdirais | 0:2cb6ce8e07bd | 92 | virtual void ErrorHandler(uint16_t error) = 0; |
brdirais | 0:2cb6ce8e07bd | 93 | virtual void SetDualFullBridgeConfig(uint8_t newConfig) = 0; |
brdirais | 0:2cb6ce8e07bd | 94 | virtual uint32_t GetBridgeInputPwmFreq(uint8_t bridgeId) = 0; |
brdirais | 0:2cb6ce8e07bd | 95 | virtual void SetBridgeInputPwmFreq(uint8_t bridgeId, uint32_t newFreq) = 0; |
brdirais | 0:2cb6ce8e07bd | 96 | virtual bool SetNbDevices(uint8_t nbDevices) = 0; |
brdirais | 0:2cb6ce8e07bd | 97 | }; |
brdirais | 0:2cb6ce8e07bd | 98 | |
brdirais | 0:2cb6ce8e07bd | 99 | #endif /* __MOTOR_CLASS_H */ |
brdirais | 0:2cb6ce8e07bd | 100 | |
brdirais | 0:2cb6ce8e07bd | 101 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
brdirais | 0:2cb6ce8e07bd | 102 |