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.
Fork of X_NUCLEO_IHM01A1 by
Revision 22:ed3a6990a6eb, committed 2016-02-09
- Comitter:
- Davidroid
- Date:
- Tue Feb 09 10:53:31 2016 +0000
- Parent:
- 21:83138e702683
- Child:
- 23:58264db10a17
- Commit message:
- + Updated with the new template's syntax.
Changed in this revision
--- a/Components/Common/component.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/Common/component.h Tue Feb 09 10:53:31 2016 +0000
@@ -37,10 +37,10 @@
*/
-/* Prevent recursive inclusion -----------------------------------------------*/
+/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef __COMPONENT_H__
-#define __COMPONENT_H__
+#ifndef __COMPONENT_H
+#define __COMPONENT_H
/* Types ---------------------------------------------------------------------*/
@@ -75,7 +75,7 @@
/* -----------------------------------------------------------------------*/
/* Pointer to the Extended Virtual Table. */
void *pExtVTable;
-} DrvContextTypeDef;
+} Handle_t;
/**
* @brief Component's Status enumerator definition.
@@ -86,6 +86,8 @@
COMPONENT_ERROR,
COMPONENT_TIMEOUT,
COMPONENT_NOT_IMPLEMENTED
-} DrvStatusTypeDef;
+} Status_t;
-#endif
\ No newline at end of file
+#endif /* __COMPONENT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/Common/motor.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/Common/motor.h Tue Feb 09 10:53:31 2016 +0000
@@ -1,41 +1,43 @@
/**
- ******************************************************************************
- * @file motor.h
- * @author IPC Rennes
- * @version V1.3.0
- * @date November 12, 2014
- * @brief This file contains all the functions prototypes for motor drivers.
- ******************************************************************************
- * @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 motor.h
+ * @author IPC Rennes
+ * @version V1.3.0
+ * @date November 12, 2014
+ * @brief This file contains all the functions prototypes for motor drivers.
+ ******************************************************************************
+ * @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 __MOTOR_H
#define __MOTOR_H
@@ -43,26 +45,15 @@
extern "C" {
#endif
+
/* Includes ------------------------------------------------------------------*/
+
#include <stdint.h>
#include "component.h"
-/** @addtogroup BSP
- * @{
- */
-
-/** @addtogroup Components
- * @{
- */
-/** @defgroup Motor
- * @{
- */
-
-/** @defgroup Motor_Exported_Constants
- * @{
- */
-
+/* Definitions ---------------------------------------------------------------*/
+
/// boolean for false condition
#ifndef FALSE
#define FALSE (0)
@@ -72,18 +63,25 @@
#define TRUE (1)
#endif
-/**
- * @}
- */
-
-/** @defgroup Motor_Exported_Types
+
+/* Types ---------------------------------------------------------------------*/
+
+/** @addtogroup BSP
* @{
*/
-/**
- * @}
- */
-
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup MOTOR
+ * @{
+ */
+
+/** @defgroup MOTOR_Exported_Types
+ * @{
+ */
+
/** @defgroup Device_Direction_Options
* @{
*/
@@ -196,26 +194,37 @@
/** @defgroup Motor_Driver_Structure
* @{
*/
-/// Motor driver structure definition
+
+/**
+ * @brief MOTOR driver virtual table structure definition.
+ */
typedef struct
{
- /* Generic */
/* ACTION ----------------------------------------------------------------*
- * Declare here component's generic functions. *
+ * Declare here the component's generic functions. *
+ * Tag this group of functions with the " Generic " C-style comment. *
+ * A component's interface has to define at least the two generic *
+ * functions provided here below within the "Example" section, as the *
+ * first and second functions of its Virtual Table. They have to be *
+ * specified exactly in the given way. *
* *
* Example: *
- * DrvStatusTypeDef (*Init)(void *handle, void *init); *
+ * Status_t (*Init) (void *handle, void *init); *
+ * Status_t (*ReadID) (void *handle, uint8_t *id); *
*------------------------------------------------------------------------*/
- DrvStatusTypeDef (*Init)(void *handle, void *init);
- DrvStatusTypeDef (*ReadID)(void *handle, uint8_t *id);
+ /* Generic */
+ Status_t (*Init)(void *handle, void *init);
+ Status_t (*ReadID)(void *handle, uint8_t *id);
- /* Interrupts */
/* ACTION ----------------------------------------------------------------*
- * Declare here component's interrupts related functions. *
+ * Declare here the component's interrupts related functions. *
+ * Tag this group of functions with the " Interrupts " C-style comment. *
+ * Do not specify any function if not required. *
* *
* Example: *
- * void (*ConfigIT)(void *handle, uint16_t a); *
+ * void (*ConfigIT) (void *handle, int a); *
*------------------------------------------------------------------------*/
+ /* Interrupts */
/// Function pointer to AttachErrorHandler
void (*AttachErrorHandler)(void *handle, void (*callback)(void *handle, uint16_t error));
/// Function pointer to AttachFlagInterrupt
@@ -225,13 +234,15 @@
/// Function pointer to FlagInterruptHandler
void (*FlagInterruptHandler)(void *handle);
- /* Specific */
/* ACTION ----------------------------------------------------------------*
- * Declare here component's specific functions. *
+ * Declare here the component's specific functions. *
+ * Tag this group of functions with the " Specific " C-style comment. *
+ * Do not specify any function if not required. *
* *
* Example: *
- * DrvStatusTypeDef (*GetValue)(void *handle, float *pfData); *
+ * Status_t (*GetValue) (void *handle, float *f); *
*------------------------------------------------------------------------*/
+ /* Specific */
/// Function pointer to GetAcceleration
uint16_t (*GetAcceleration)(void *handle);
/// Function pointer to GetCurrentSpeed
@@ -265,9 +276,9 @@
/// Function pointer to Run
void (*Run)(void *handle, motorDir_t direction);
/// Function pointer to SetAcceleration
- bool(*SetAcceleration)(void *handle,uint16_t newAcc);
+ bool (*SetAcceleration)(void *handle, uint16_t newAcc);
/// Function pointer to SetDeceleration
- bool(*SetDeceleration)(void *handle, uint16_t newDec);
+ bool (*SetDeceleration)(void *handle, uint16_t newDec);
/// Function pointer to SetHome
void (*SetHome)(void *handle);
/// Function pointer to SetMark
@@ -346,7 +357,7 @@
void (*BusyInterruptHandler)(void *handle);
/// Function pointer to CmdSoftStop
void (*CmdSoftStop)(void *handle);
-} MOTOR_DrvVTableTypeDef;
+} MOTOR_VTable_t;
#ifdef __cplusplus
}
--- a/Components/Interfaces/Component_class.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/Interfaces/Component_class.h Tue Feb 09 10:53:31 2016 +0000
@@ -1,7 +1,7 @@
/**
******************************************************************************
* @file Component_class.h
- * @author Davide Aliprandi, STMicroelectronics
+ * @author AST
* @version V1.0.0
* @date April 13th, 2015
* @brief This file contains the abstract class describing the interface of a
@@ -37,7 +37,7 @@
*/
-/* Define to prevent from recursive inclusion --------------------------------*/
+/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __COMPONENT_CLASS_H
#define __COMPONENT_CLASS_H
@@ -56,20 +56,20 @@
{
public:
/**
- * @brief Initializing the component.
- * @param init Pointer to device specific initalization structure.
- * @retval "0" in case of success, an error code otherwise.
+ * @brief Initializing the component.
+ * @param[in] init pointer to device specific initalization structure.
+ * @retval "0" in case of success, an error code otherwise.
*/
virtual int Init(void *init) = 0;
/**
- * @brief Getting the ID of the component.
- * @param id Pointer to an allocated variable to store the ID into.
- * @retval "0" in case of success, an error code otherwise.
+ * @brief Getting the ID of the component.
+ * @param[out] id pointer to an allocated variable to store the ID into.
+ * @retval "0" in case of success, an error code otherwise.
*/
virtual int ReadID(uint8_t *id) = 0;
};
#endif /* __COMPONENT_CLASS_H */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6474/l6474.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/l6474/l6474.h Tue Feb 09 10:53:31 2016 +0000
@@ -1,42 +1,44 @@
/**
- ******************************************************************************
- * @file l6474.h
- * @author IPC Rennes
- * @version V1.5.0
- * @date November 12, 2014
- * @brief Header for L6474 driver (fully integrated microstepping motor driver)
- * @note (C) COPYRIGHT 2014 STMicroelectronics
- ******************************************************************************
- * @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 l6474.h
+ * @author IPC Rennes
+ * @version V1.5.0
+ * @date November 12, 2014
+ * @brief Header for L6474 driver (fully integrated microstepping motor driver)
+ * @note (C) COPYRIGHT 2014 STMicroelectronics
+ ******************************************************************************
+ * @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 __L6474_H
#define __L6474_H
@@ -44,23 +46,30 @@
extern "C" {
#endif
+
/* Includes ------------------------------------------------------------------*/
+
#include "l6474_target_config.h"
#include "../Common/motor.h"
+
+/* Definitions ---------------------------------------------------------------*/
+
/** @addtogroup BSP
- * @{
- */
-
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */
+
/** @addtogroup L6474
- * @{
- */
-
-/* Exported Constants --------------------------------------------------------*/
-
-/** @defgroup L6474_Exported_Constants
- * @{
- */
+ * @{
+ */
+
+/** @defgroup L6474_Exported_Defines L6474_Exported_Defines
+ * @{
+ */
/// Current FW version
#define L6474_FW_VERSION (5)
@@ -80,15 +89,8 @@
/// L6474 sign bit mask for ABS_POS register
#define L6474_ABS_POS_SIGN_BIT_MASK ((uint32_t) 0x00200000)
-/**
- * @}
- */
-
-/**
- * @}
- */
-/* Exported Types -------------------------------------------------------*/
+/* Types ---------------------------------------------------------------------*/
/** @defgroup L6474_Exported_Types
* @{
@@ -431,77 +433,94 @@
L6474_RESERVED_CMD1 = ((uint8_t) 0xEB),
L6474_RESERVED_CMD2 = ((uint8_t) 0xF8)
} L6474_Commands_t;
-/**
- * @}
- */
-/** @defgroup Motor_Driver_Initialization_Structure
- * @{
- */
-/// Motor driver initialization structure definition
+/**
+ * @brief L6474 driver initialization structure definition.
+ */
+/* ACTION --------------------------------------------------------------------*
+ * Declare here the component's initialization structure, if any, one *
+ * variable per line without initialization. *
+ * *
+ * Example: *
+ * typedef struct *
+ * { *
+ * int frequency; *
+ * int update_mode; *
+ * } COMPONENT_Init_t; *
+ *----------------------------------------------------------------------------*/
typedef struct
{
- /* Acceleration rate in step/s2. Range: (0..+inf). */
- int acceleration_step_s2;
+ /* Acceleration rate in step/s2. Range: (0..+inf). */
+ int acceleration_step_s2;
- /* Deceleration rate in step/s2. Range: (0..+inf). */
- int deceleration_step_s2;
+ /* Deceleration rate in step/s2. Range: (0..+inf). */
+ int deceleration_step_s2;
- /* Maximum speed in step/s. Range: (30..10000]. */
- int maximum_speed_step_s;
+ /* Maximum speed in step/s. Range: (30..10000]. */
+ int maximum_speed_step_s;
- /* Minimum speed in step/s. Range: [30..10000). */
- int minimum_speed_step_s;
+ /* Minimum speed in step/s. Range: [30..10000). */
+ int minimum_speed_step_s;
- /* Torque regulation current in mA. Range: 31.25mA to 4000mA. */
- float torque_regulation_current_mA;
+ /* Torque regulation current in mA. Range: 31.25mA to 4000mA. */
+ float torque_regulation_current_mA;
- /* Overcurrent threshold (OCD_TH register). */
- L6474_OCD_TH_t overcurrent_threshold;
+ /* Overcurrent threshold (OCD_TH register). */
+ L6474_OCD_TH_t overcurrent_threshold;
- /* Overcurrent shutwdown (OC_SD field of CONFIG register). */
- L6474_CONFIG_OC_SD_t overcurrent_shutwdown;
+ /* Overcurrent shutwdown (OC_SD field of CONFIG register). */
+ L6474_CONFIG_OC_SD_t overcurrent_shutwdown;
- /* Torque regulation method (EN_TQREG field of CONFIG register). */
- L6474_CONFIG_EN_TQREG_t torque_regulation_method;
-
- /* Step selection (STEP_SEL field of STEP_MODE register). */
- L6474_STEP_SEL_t step_selection;
+ /* Torque regulation method (EN_TQREG field of CONFIG register). */
+ L6474_CONFIG_EN_TQREG_t torque_regulation_method;
+
+ /* Step selection (STEP_SEL field of STEP_MODE register). */
+ L6474_STEP_SEL_t step_selection;
- /* Sync selection (SYNC_SEL field of STEP_MODE register). */
- L6474_SYNC_SEL_t sync_selection;
+ /* Sync selection (SYNC_SEL field of STEP_MODE register). */
+ L6474_SYNC_SEL_t sync_selection;
- /* Fall time value (T_FAST field of T_FAST register). Range: 2us to 32us. */
- L6474_FAST_STEP_t fall_time;
+ /* Fall time value (T_FAST field of T_FAST register). Range: 2us to 32us. */
+ L6474_FAST_STEP_t fall_time;
- /* Maximum fast decay time (T_OFF field of T_FAST register). Range: 2us to 32us. */
- L6474_TOFF_FAST_t maximum_fast_decay_time;
+ /* Maximum fast decay time (T_OFF field of T_FAST register). Range: 2us to 32us. */
+ L6474_TOFF_FAST_t maximum_fast_decay_time;
- /* Minimum ON time in us (TON_MIN register). Range: 0.5us to 64us. */
- float minimum_ON_time_us;
-
- /* Minimum OFF time in us (TOFF_MIN register). Range: 0.5us to 64us. */
- float minimum_OFF_time_us;
+ /* Minimum ON time in us (TON_MIN register). Range: 0.5us to 64us. */
+ float minimum_ON_time_us;
- /* Target Swicthing Period (field TOFF of CONFIG register). */
- L6474_CONFIG_TOFF_t target_swicthing_period;
+ /* Minimum OFF time in us (TOFF_MIN register). Range: 0.5us to 64us. */
+ float minimum_OFF_time_us;
- /* Slew rate (POW_SR field of CONFIG register). */
- L6474_CONFIG_POW_SR_t slew_rate;
+ /* Target Swicthing Period (field TOFF of CONFIG register). */
+ L6474_CONFIG_TOFF_t target_swicthing_period;
- /* Clock setting (OSC_CLK_SEL field of CONFIG register). */
- L6474_CONFIG_OSC_MGMT_t clock;
+ /* Slew rate (POW_SR field of CONFIG register). */
+ L6474_CONFIG_POW_SR_t slew_rate;
- /* Alarm (ALARM_EN register). */
- int alarm;
-} L6474_InitTypeDef;
-/**
- * @}
- */
+ /* Clock setting (OSC_CLK_SEL field of CONFIG register). */
+ L6474_CONFIG_OSC_MGMT_t clock;
+
+ /* Alarm (ALARM_EN register). */
+ int alarm;
+} L6474_Init_t;
/**
- * @brief L6474 driver data structure definition
- */
+ * @brief L6474 driver data structure definition.
+ */
+/* ACTION --------------------------------------------------------------------*
+ * Declare here the structure of component's data, if any, one variable per *
+ * line without initialization. *
+ * *
+ * Example: *
+ * typedef struct *
+ * { *
+ * int T0_out; *
+ * int T1_out; *
+ * float T0_degC; *
+ * float T1_degC; *
+ * } COMPONENT_Data_t; *
+ *----------------------------------------------------------------------------*/
typedef struct
{
/// Function pointer to flag interrupt call back
@@ -516,30 +535,36 @@
uint8_t device_instance;
uint8_t spiTxBursts[L6474_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
uint8_t spiRxBursts[L6474_CMD_ARG_MAX_NB_BYTES][MAX_NUMBER_OF_DEVICES];
-} L6474_DrvDataTypeDef;
-/**
- * @}
- */
+} L6474_Data_t;
-/* Exported functions --------------------------------------------------------*/
+/* Functions -----------------------------------------------------------------*/
+
+/** @addtogroup BSP
+ * @{
+ */
-/** @defgroup L6474_Exported_Functions
- * @{
- */
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup L6474
+ * @{
+ */
+
+/** @defgroup L6474_Imported_Functions L6474_Imported_Functions
+ * @{
+ */
/* ACTION --------------------------------------------------------------------*
* Declare here extern I/O and interrupt related functions you might need, *
* and implemented then in a glue logic file on the target environment, for *
- * example within the "x_nucleo_<board>.c" file., e.g.: *
- * extern DrvStatusTypeDef COMPONENT_IO_Init (void *handle); *
- * extern DrvStatusTypeDef COMPONENT_IO_Read (handle, buf, regadd, bytes); *
- * extern DrvStatusTypeDef COMPONENT_IO_Write(handle, buf, regadd, bytes); *
- * extern void COMPONENT_IO_ITConfig(void); *
+ * example within the "x_nucleo_board.c" file., e.g.: *
+ * extern Status_t COMPONENT_IO_Init (void *handle); *
+ * extern Status_t COMPONENT_IO_Read (handle, buf, regadd, bytes); *
+ * extern Status_t COMPONENT_IO_Write(handle, buf, regadd, bytes); *
+ * extern void COMPONENT_IO_ITConfig(void); *
*----------------------------------------------------------------------------*/
-/** @defgroup MotorControl_Board_Linked_Functions
- * @{
- */
///Delay of the requested number of milliseconds
extern void L6474_Delay(void *handle, uint32_t delay);
///Enable Irq
@@ -565,27 +590,10 @@
///Write bytes to the L6474s via SPI
extern uint8_t L6474_SpiWriteBytes(void *handle, uint8_t *pByteToTransmit, uint8_t *pReceivedByte);
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
#ifdef __cplusplus
}
#endif
#endif /* #ifndef __L6474_H */
-
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
--- a/Components/l6474/l6474_class.cpp Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/l6474/l6474_class.cpp Tue Feb 09 10:53:31 2016 +0000
@@ -52,7 +52,6 @@
/* Includes ------------------------------------------------------------------*/
#include "l6474_class.h"
-#include "l6474.h"
/* Definitions ---------------------------------------------------------------*/
@@ -107,7 +106,7 @@
* @param init Initialization structure.
* @retval COMPONENT_OK in case of success.
**********************************************************/
-DrvStatusTypeDef L6474::L6474_Init(void *init)
+Status_t L6474::L6474_Init(void *init)
{
/* Initialise the PWMs used for the Step clocks ----------------------------*/
L6474_PwmInit();
@@ -128,7 +127,7 @@
L6474_SetRegisterToPredefinedValues();
else
/* Set device registers to the passed initialization values. */
- L6474_SetRegisterToInitializationValues((L6474_InitTypeDef *) init);
+ L6474_SetRegisterToInitializationValues((L6474_Init_t *) init);
/* Disable L6474 powerstage */
L6474_CmdDisable();
@@ -144,7 +143,7 @@
* @param id pointer to the identifier to be read.
* @retval COMPONENT_OK in case of success.
**********************************************************/
-DrvStatusTypeDef L6474::L6474_ReadID(uint8_t *id)
+Status_t L6474::L6474_ReadID(uint8_t *id)
{
*id = device_instance;
@@ -1098,7 +1097,7 @@
* @param init Initialization structure.
* @retval None.
**********************************************************/
-void L6474::L6474_SetRegisterToInitializationValues(L6474_InitTypeDef *init)
+void L6474::L6474_SetRegisterToInitializationValues(L6474_Init_t *init)
{
L6474_CmdSetParam(
L6474_ABS_POS,
--- a/Components/l6474/l6474_class.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/l6474/l6474_class.h Tue Feb 09 10:53:31 2016 +0000
@@ -693,13 +693,13 @@
* source files but not pointed by the component's virtual table (3). *
* *
* Example: *
- * DrvStatusTypeDef COMPONENT_GetValue(float* pfData); //(1) *
- * DrvStatusTypeDef COMPONENT_EnableFeature(void); //(2) *
- * DrvStatusTypeDef COMPONENT_ComputeAverage(void); //(3) *
+ * Status_t COMPONENT_GetValue(float *f); //(1) *
+ * Status_t COMPONENT_EnableFeature(void); //(2) *
+ * Status_t COMPONENT_ComputeAverage(void); //(3) *
*------------------------------------------------------------------------*/
void L6474_AttachErrorHandler(void (*callback)(uint16_t error));
- DrvStatusTypeDef L6474_Init(void *init);
- DrvStatusTypeDef L6474_ReadID(uint8_t *id);
+ Status_t L6474_Init(void *init);
+ Status_t L6474_ReadID(uint8_t *id);
uint16_t L6474_GetAcceleration(void);
uint16_t L6474_GetCurrentSpeed(void);
uint16_t L6474_GetDeceleration(void);
@@ -739,7 +739,7 @@
void L6474_ErrorHandler(uint16_t error);
void L6474_SendCommand(uint8_t param);
void L6474_SetRegisterToPredefinedValues(void);
- void L6474_SetRegisterToInitializationValues(L6474_InitTypeDef *init);
+ void L6474_SetRegisterToInitializationValues(L6474_Init_t *init);
void L6474_WriteBytes(uint8_t *pByteToTransmit, uint8_t *pReceivedByte);
void L6474_SetDeviceParamsToPredefinedValues(void);
void L6474_StartMovement(void);
@@ -758,7 +758,7 @@
* @param[in] NumBytesToRead number of bytes to read.
* @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
*/
- DrvStatusTypeDef Read(uint8_t* pBuffer, uint16_t NumBytesToRead)
+ Status_t Read(uint8_t* pBuffer, uint16_t NumBytesToRead)
{
if (dev_spi.spi_read(pBuffer, ssel, NumBytesToRead) != 0)
return COMPONENT_ERROR;
@@ -771,7 +771,7 @@
* @param[in] NumBytesToWrite number of bytes to write.
* @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
*/
- DrvStatusTypeDef Write(uint8_t* pBuffer, uint16_t NumBytesToWrite)
+ Status_t Write(uint8_t* pBuffer, uint16_t NumBytesToWrite)
{
if (dev_spi.spi_write(pBuffer, ssel, NumBytesToWrite) != 0)
return COMPONENT_ERROR;
@@ -785,7 +785,7 @@
* @param[in] NumBytes number of bytes to read and write.
* @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
*/
- DrvStatusTypeDef ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes)
+ Status_t ReadWrite(uint8_t* pBufferToRead, uint8_t* pBufferToWrite, uint16_t NumBytes)
{
if (dev_spi.spi_read_write(pBufferToRead, pBufferToWrite, ssel, NumBytes) != 0)
return COMPONENT_ERROR;
--- a/Components/l6474/l6474_target_config.h Tue Jan 19 15:57:24 2016 +0000
+++ b/Components/l6474/l6474_target_config.h Tue Feb 09 10:53:31 2016 +0000
@@ -1,42 +1,45 @@
-/**************************************************************************//**
- * @file l6474_target_config.h
- * @author IPC Rennes
- * @version V1.5.0
- * @date November 12, 2014
- * @brief Predefines values for the L6474 registers
- * and for the devices parameters
- * @note (C) COPYRIGHT 2014 STMicroelectronics
- ******************************************************************************
- * @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 l6474_target_config.h
+ * @author IPC Rennes
+ * @version V1.5.0
+ * @date November 12, 2014
+ * @brief Predefines values for the L6474 registers
+ * and for the devices parameters
+ * @note (C) COPYRIGHT 2014 STMicroelectronics
+ ******************************************************************************
+ * @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 __L6474_TARGET_CONFIG_H
#define __L6474_TARGET_CONFIG_H
@@ -44,10 +47,13 @@
extern "C" {
#endif
+
+/* Definitions ---------------------------------------------------------------*/
+
/** @addtogroup BSP
* @{
*/
-
+
/** @addtogroup L6474
* @{
*/
@@ -55,7 +61,7 @@
/** @addtogroup L6474_Exported_Constants
* @{
*/
-
+
/** @defgroup Predefined_L6474_Registers_Values
* @{
*/
@@ -214,9 +220,10 @@
/// Clock setting for device 2 (OSC_CLK_SEL field of CONFIG register)
#define L6474_CONF_PARAM_CLOCK_SETTING_DEVICE_2 (L6474_CONFIG_INT_16MHZ)
-
#ifdef __cplusplus
}
#endif
#endif /* __L6474_TARGET_CONFIG_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
