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.
Dependencies: ST_INTERFACES X_NUCLEO_COMMON
Fork of X_NUCLEO_IHM02A1 by
Diff: Components/Common/microstepping_motor.h
- Revision:
- 14:e614697ebf34
- Parent:
- 11:1aca63b2f034
--- a/Components/Common/microstepping_motor.h Tue Jan 19 16:07:00 2016 +0000
+++ b/Components/Common/microstepping_motor.h Tue Feb 09 16:01:30 2016 +0000
@@ -1,42 +1,44 @@
/**
- ******************************************************************************
- * @file microstepping_motor.h
- * @author IPD SYSTEM LAB & TECH MKTG
- * @version V0.0.1
- * @date 04-June-2015
- * @brief This file contains all the functions prototypes for the microstepping
- * motor driver with motion engine.
- ******************************************************************************
- * @attention
- *
- * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of STMicroelectronics nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- ******************************************************************************
- */
+ ******************************************************************************
+ * @file microstepping_motor.h
+ * @author IPD SYSTEM LAB & TECH MKTG
+ * @version V0.0.1
+ * @date 04-June-2015
+ * @brief This file contains all the functions prototypes for the microstepping
+ * motor driver with motion engine.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
/* Define to prevent recursive inclusion -------------------------------------*/
+
#ifndef __MICROSTEPPINGMOTOR_H
#define __MICROSTEPPINGMOTOR_H
@@ -44,10 +46,15 @@
extern "C" {
#endif
+
/* Includes ------------------------------------------------------------------*/
+
#include <stdint.h>
#include "component.h"
+
+/* Types ---------------------------------------------------------------------*/
+
/** @addtogroup BSP
* @{
*/
@@ -92,7 +99,7 @@
L6470_STEP_MODE_ID, //!< Step mode
L6470_ALARM_EN_ID, //!< Alarm enable
L6470_CONFIG_ID, //!< IC configuration
- L6470_STATUS_ID //!< Status, (the reset value is according to startup conditions)
+ L6470_STATUS_ID //!< Status, (the reset value is according to startup conditions)
} eL6470_RegId_t;
/**
@@ -305,9 +312,9 @@
uint16_t STATUS; //!< Status Register
} StepperMotorRegister_t;
-/**
- * @brief Stepper Motor Driver Structure
- */
+/**
+ * @brief MICROSTEPPING_MOTOR driver virtual table structure definition.
+ */
typedef struct
{
/* ACTION ----------------------------------------------------------------*
@@ -319,12 +326,12 @@
* specified exactly in the given way. *
* *
* Example: *
- * DrvStatusTypeDef (*Init)(void *handle, void *init); *
- * DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id); *
+ * Status_t (*Init) (void *handle, void *init); *
+ * Status_t (*ReadID) (void *handle, uint8_t *id); *
*------------------------------------------------------------------------*/
/* Generic */
- DrvStatusTypeDef (*Init)(void *handle, void *init);
- DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id);
+ Status_t (*Init)(void *handle, void *init);
+ Status_t (*ReadID)(void *handle, uint8_t *id);
/* ACTION ----------------------------------------------------------------*
* Declare here the component's specific functions. *
@@ -332,7 +339,7 @@
* Do not specify any function if not required. *
* *
* Example: *
- * DrvStatusTypeDef (*GetValue)(void *handle, float *pfData); *
+ * Status_t (*GetValue) (void *handle, float *f); *
*------------------------------------------------------------------------*/
/* Specific */
void (*SetParam)(void *handle, eL6470_RegId_t L6470_RegId, uint32_t Value);
@@ -400,7 +407,8 @@
uint8_t (*mA_2_OcdTh)(void *handle, float mA);
float (*StallTh_2_mA)(void *handle, uint8_t StallTh);
uint8_t (*mA_2_StallTh)(void *handle, float mA);
-} MICROSTEPPING_MOTOR_DrvVTableTypeDef;
+ uint32_t (*ExtractReturnedData)(void *handle, uint8_t* pL6470_DaisyChainSpiRxStruct, uint8_t LengthByte);
+} MICROSTEPPING_MOTOR_VTable_t;
/**
* @brief Stepper Motor Board Driver Structure
@@ -427,7 +435,7 @@
uint16_t (*GetStatus)(uint8_t, uint8_t);
uint8_t (*CheckStatusRegisterFlag)(uint8_t, uint8_t, uint8_t);
uint8_t* (*PerformPreparedApplicationCommand)(uint8_t);
-} MICROSTEPPING_MOTOR_EB_DrvVTableTypeDef;
+} MICROSTEPPING_MOTOR_EB_VTable_t;
/**
* @brief Stepper Motor Handle Structure
@@ -435,7 +443,8 @@
typedef struct __StepperMotorDriver_HandleTypeDef
{
uint8_t DaisyChainPosition;
- MICROSTEPPING_MOTOR_DrvVTableTypeDef *Command;
+ void (*Config)(void*);
+ MICROSTEPPING_MOTOR_VTable_t *Command;
} StepperMotorDriverHandle_t;
/**
@@ -444,7 +453,8 @@
typedef struct __StepperMotorBoard_HandleTypeDef
{
uint8_t StackedPosition;
- MICROSTEPPING_MOTOR_EB_DrvVTableTypeDef *Command;
+ void (*Config)(void*);
+ MICROSTEPPING_MOTOR_EB_VTable_t *Command;
StepperMotorDriverHandle_t *StepperMotorDriverHandle[2];
uint8_t (*Select)(uint8_t);
} StepperMotorBoardHandle_t;
