Library to handle the X_NUCLEO_IHM02A1 Motor Control Expansion Board based on the L6470 component.

Dependencies:   X_NUCLEO_COMMON ST_INTERFACES

Dependents:   HelloWorld_IHM02A1 ConcorsoFinal HelloWorld_IHM02A1_mbedOS HelloWorld_IHM02A1-Serialinterpreter ... more

Fork of X_NUCLEO_IHM02A1 by ST Expansion SW Team

Motor Control Library

Introduction

Library to handle the X-NUCLEO-IHM02A1 Motor Control Expansion Board based on the the L6470 component.

Daisy-Chain Configuration

The two L6470 components mounted on this board are connected in daisy-chain configuration. This board can be stacked up to four times so that the eight L6470 components will be connected two-by-two in daisy-chain configuration.

Concerning the SSEL pin of the SPI communication, each expansion board must be in one of the following configuration:

  • SB_23 resistor connected only: SSEL on pin A2;
  • SB_7 resistor connected only: SSEL on pin D2;
  • SB_8 resistor connected only: SSEL on pin D10;
  • SB_9 resistor connected only: SSEL on pin D5.

Arduino Connector Compatibility Warning

X-NUCLEO-IHM02A1 is Arduino compatible with one exception: instead of using D13 pin to drive the SPI clock, it uses D3 pin, hence the default configuration for this library is with the SPI clock on D3 pin.

To be fully Arduino compatible the following patch is required:

  • to remove the SB34 resistor;
  • to solder the SB12 resistor.

Alternatively, you can route the Nucleo board’s D13 pin directly to the expansion board’s D3 pin with a wire. In case you patch your expansion board or route the pin, the SPI clock will be driven on D13 pin rather than on D3 pin, and you have also to initialize the sclk PinName variable with D13 rather than D3. This patch is known to be required, for example, on the following boards: NUCLEO-F103RB, NUCLEO-F302RB, NUCLEO-F411RE, and NUCLEO-F429ZI.

If you use D13 pin for the SPI clock, please be aware that on STM32 Nucleo boards you may not drive the LED, otherwise you will get a conflict: the LED on STM32 Nucleo boards is connected to the D13 pin.

Example Applications

Committer:
Davidroid
Date:
Tue Feb 09 16:01:30 2016 +0000
Revision:
14:e614697ebf34
Parent:
11:1aca63b2f034
Child:
16:0d5be428b264
+ Updated with the new template's syntax.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Davidroid 0:92706998571a 1 /**
Davidroid 14:e614697ebf34 2 ******************************************************************************
Davidroid 14:e614697ebf34 3 * @file L6470.h
Davidroid 14:e614697ebf34 4 * @date 01/10/2014 12:00:00
Davidroid 14:e614697ebf34 5 * @brief This file contains definitions, exported variables and function
Davidroid 14:e614697ebf34 6 * prototypes related to the L6470.
Davidroid 14:e614697ebf34 7 ******************************************************************************
Davidroid 14:e614697ebf34 8 *
Davidroid 14:e614697ebf34 9 * COPYRIGHT(c) 2014 STMicroelectronics
Davidroid 14:e614697ebf34 10 *
Davidroid 14:e614697ebf34 11 * Redistribution and use in source and binary forms, with or without modification,
Davidroid 14:e614697ebf34 12 * are permitted provided that the following conditions are met:
Davidroid 14:e614697ebf34 13 * 1. Redistributions of source code must retain the above copyright notice,
Davidroid 14:e614697ebf34 14 * this list of conditions and the following disclaimer.
Davidroid 14:e614697ebf34 15 * 2. Redistributions in binary form must reproduce the above copyright notice,
Davidroid 14:e614697ebf34 16 * this list of conditions and the following disclaimer in the documentation
Davidroid 14:e614697ebf34 17 * and/or other materials provided with the distribution.
Davidroid 14:e614697ebf34 18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Davidroid 14:e614697ebf34 19 * may be used to endorse or promote products derived from this software
Davidroid 14:e614697ebf34 20 * without specific prior written permission.
Davidroid 14:e614697ebf34 21 *
Davidroid 14:e614697ebf34 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Davidroid 14:e614697ebf34 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Davidroid 14:e614697ebf34 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Davidroid 14:e614697ebf34 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Davidroid 14:e614697ebf34 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Davidroid 14:e614697ebf34 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Davidroid 14:e614697ebf34 28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Davidroid 14:e614697ebf34 29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Davidroid 14:e614697ebf34 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Davidroid 14:e614697ebf34 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Davidroid 14:e614697ebf34 32 *
Davidroid 14:e614697ebf34 33 ******************************************************************************
Davidroid 14:e614697ebf34 34 */
Davidroid 14:e614697ebf34 35
Davidroid 0:92706998571a 36
Davidroid 0:92706998571a 37 /* Define to prevent recursive inclusion -------------------------------------*/
Davidroid 14:e614697ebf34 38
Davidroid 0:92706998571a 39 #ifndef __L6470_H
Davidroid 0:92706998571a 40 #define __L6470_H
Davidroid 0:92706998571a 41
Davidroid 0:92706998571a 42 #ifdef __cplusplus
Davidroid 0:92706998571a 43 extern "C" {
Davidroid 0:92706998571a 44 #endif
Davidroid 0:92706998571a 45
Davidroid 14:e614697ebf34 46
Davidroid 0:92706998571a 47 /* Includes ------------------------------------------------------------------*/
Davidroid 14:e614697ebf34 48
Davidroid 0:92706998571a 49 #include "microstepping_motor.h"
Davidroid 0:92706998571a 50
Davidroid 14:e614697ebf34 51
Davidroid 14:e614697ebf34 52 /* Definitions ---------------------------------------------------------------*/
Davidroid 14:e614697ebf34 53
Davidroid 14:e614697ebf34 54 /** @addtogroup BSP
Davidroid 14:e614697ebf34 55 * @{
Davidroid 14:e614697ebf34 56 */
Davidroid 14:e614697ebf34 57
Davidroid 14:e614697ebf34 58 /** @addtogroup Components
Davidroid 14:e614697ebf34 59 * @{
Davidroid 14:e614697ebf34 60 */
Davidroid 14:e614697ebf34 61
Davidroid 14:e614697ebf34 62 /** @addtogroup L6470
Davidroid 14:e614697ebf34 63 * @{
Davidroid 14:e614697ebf34 64 */
Davidroid 14:e614697ebf34 65
Davidroid 14:e614697ebf34 66 /** @defgroup L6470_Exported_Defines L6470_Exported_Defines
Davidroid 14:e614697ebf34 67 * @{
Davidroid 14:e614697ebf34 68 */
Davidroid 14:e614697ebf34 69
Davidroid 14:e614697ebf34 70 /**
Davidroid 14:e614697ebf34 71 * @defgroup L6470_Exported_Constants
Davidroid 14:e614697ebf34 72 * @brief L6470 Exported Constants.
Davidroid 14:e614697ebf34 73 * @{
Davidroid 14:e614697ebf34 74 */
Davidroid 14:e614697ebf34 75
Davidroid 14:e614697ebf34 76 /**
Davidroid 14:e614697ebf34 77 * @defgroup L6470_Register_Max_Values
Davidroid 14:e614697ebf34 78 * @brief Maximum values for L6470 registers.
Davidroid 14:e614697ebf34 79 * @{
Davidroid 14:e614697ebf34 80 */
Davidroid 14:e614697ebf34 81
Davidroid 14:e614697ebf34 82 #define L6470_MAX_POSITION (0x1FFFFF) //!< Max position
Davidroid 14:e614697ebf34 83 #define L6470_MIN_POSITION (-(0x200000)) //!< Min position
Davidroid 14:e614697ebf34 84 #define L6470_POSITION_RANGE ((uint32_t)(L6470_MAX_POSITION - L6470_MIN_POSITION)) //!< Position range
Davidroid 14:e614697ebf34 85 #define L6470_MAX_SPEED (0xFFFFF) //!< max value of SPEED
Davidroid 14:e614697ebf34 86 #define L6470_MAX_ACC (0xFFF) //!< max value of ACC
Davidroid 14:e614697ebf34 87 #define L6470_MAX_DEC (0xFFF) //!< max value of DEC
Davidroid 14:e614697ebf34 88 #define L6470_MAX_MAX_SPEED (0x3FF) //!< max value of MAX_SPEED
Davidroid 14:e614697ebf34 89 #define L6470_MAX_MIN_SPEED (0xFFF) //!< max value of MIN_SPEED
Davidroid 14:e614697ebf34 90 #define L6470_MAX_FS_SPD (0x3FF) //!< max value of FS_SPD
Davidroid 14:e614697ebf34 91 #define L6470_MAX_INT_SPEED (0x3FFF) //!< max value of INT_SPEED
Davidroid 14:e614697ebf34 92 #define L6470_MAX_ST_SLP (0xFF) //!< max value of ST_SLP
Davidroid 14:e614697ebf34 93 #define L6470_MAX_FN_SLP_ACC (0xFF) //!< max value of FN_SLP_ACC
Davidroid 14:e614697ebf34 94 #define L6470_MAX_FN_SLP_DEC (0xFF) //!< max value of FN_SLP_DEC
Davidroid 14:e614697ebf34 95 #define L6470_MAX_OCD_TH (0xF) //!< max value of OCD_TH
Davidroid 14:e614697ebf34 96 #define L6470_MAX_STALL_TH (0x7F) //!< max value of STALL_TH
Davidroid 14:e614697ebf34 97
Davidroid 14:e614697ebf34 98 /**
Davidroid 14:e614697ebf34 99 * @}
Davidroid 14:e614697ebf34 100 */ /* End of L6470_Register_Max_Values */
Davidroid 14:e614697ebf34 101
Davidroid 14:e614697ebf34 102 #define L6470REGIDSIZE 25 //!< Max number of identifiers of L6470 Registers
Davidroid 14:e614697ebf34 103 #define L6470APPCMDIDSIZE 19 //!< Max number of identifiers of L6470 Application Commands
Davidroid 14:e614697ebf34 104 #define L6470DIRIDSIZE 2 //!< Max number of identifiers of L6470 directions
Davidroid 14:e614697ebf34 105 #define L6470ACTIDSIZE 2 //!< Max number of identifiers of actions to perform about ABS_POS register
Davidroid 14:e614697ebf34 106 #define L6470MAXSPICMDBYTESIZE 4 //!< Max number of byte to send via SPI to perform an application command
Davidroid 14:e614697ebf34 107 #define L6470DAISYCHAINSIZE 2 //!< Max number of identifiers of L6470 in daisy chain configuration
Davidroid 14:e614697ebf34 108
Davidroid 14:e614697ebf34 109 #define L6470_MAX_SPEED_VALUE ((float)15610) //!< max value for the speed in step/s
Davidroid 14:e614697ebf34 110 #define L6470_MAX_ACC_VALUE ((float)59590) //!< max value for the acceleration in step/s^2
Davidroid 14:e614697ebf34 111 #define L6470_MAX_DEC_VALUE ((float)59590) //!< max value for the acceleration in step/s^2
Davidroid 14:e614697ebf34 112 #define L6470_MAX_DEC_VALUE ((float)59590) //!< max value for the acceleration in step/s^2
Davidroid 14:e614697ebf34 113
Davidroid 14:e614697ebf34 114 #define OCD_TH_STEP ((float)375) //!< Minimum step for OCD_TH register in mAmpere
Davidroid 14:e614697ebf34 115 #define STALL_TH_STEP ((float)31.25) //!< Minimum step for STALL_TH register in mAmpere
Davidroid 14:e614697ebf34 116
Davidroid 14:e614697ebf34 117 #define L6470_ACC_CONV ((float)0.068719) //!< Conversion factor for acceleration value from step/s^2 to the right value
Davidroid 14:e614697ebf34 118 #define L6470_DEC_CONV ((float)0.068719) //!< Conversion factor for deceleration value from step/s^2 to the right value
Davidroid 14:e614697ebf34 119 #define L6470_MAXSPEED_CONV ((float)0.065536) //!< Conversion factor for max speed value from step/s to the right value
Davidroid 14:e614697ebf34 120 #define L6470_MINSPEED_CONV ((float)4.194304) //!< Conversion factor for min speed value from step/s to the right value
Davidroid 14:e614697ebf34 121 #define L6470_SPEED_CONV ((float)67.108864) //!< Conversion factor for speed value from step/s to the right value
Davidroid 14:e614697ebf34 122
Davidroid 14:e614697ebf34 123
Davidroid 14:e614697ebf34 124 /* Types ---------------------------------------------------------------------*/
Davidroid 14:e614697ebf34 125
Davidroid 0:92706998571a 126 /**
Davidroid 0:92706998571a 127 * @addtogroup BSP
Davidroid 0:92706998571a 128 * @{
Davidroid 0:92706998571a 129 */
Davidroid 0:92706998571a 130
Davidroid 0:92706998571a 131 /**
Davidroid 0:92706998571a 132 * @addtogroup Components
Davidroid 0:92706998571a 133 * @{
Davidroid 0:92706998571a 134 */
Davidroid 0:92706998571a 135
Davidroid 0:92706998571a 136 /**
Davidroid 0:92706998571a 137 * @defgroup L6470
Davidroid 0:92706998571a 138 * @brief Tools to manage the L6470 Stepper Motor Driver.
Davidroid 0:92706998571a 139 * @{
Davidroid 0:92706998571a 140 */
Davidroid 0:92706998571a 141
Davidroid 0:92706998571a 142 /**
Davidroid 0:92706998571a 143 * @defgroup L6470_Exported_Types
Davidroid 0:92706998571a 144 * @brief L6470 Exported Types.
Davidroid 0:92706998571a 145 * @{
Davidroid 0:92706998571a 146 */
Davidroid 0:92706998571a 147
Davidroid 0:92706998571a 148 /**
Davidroid 0:92706998571a 149 * @brief The structure to store some features of the L6470 Registers.
Davidroid 0:92706998571a 150 */
Davidroid 0:92706998571a 151 typedef struct {
Davidroid 0:92706998571a 152 uint8_t Address; //!< Register Address
Davidroid 0:92706998571a 153 uint8_t Name[12]; //!< Register Name
Davidroid 0:92706998571a 154 uint8_t LengthBit; //!< Register Length in bits
Davidroid 0:92706998571a 155 uint8_t LengthByte; //!< Register Length in bytes
Davidroid 0:92706998571a 156 uint32_t ResetValue; //!< Register Reset Value
Davidroid 0:92706998571a 157 } sL6470_Register_t;
Davidroid 0:92706998571a 158
Davidroid 0:92706998571a 159 /**
Davidroid 0:92706998571a 160 * @brief The structure to store some features of the L6470 Application Commands.
Davidroid 0:92706998571a 161 */
Davidroid 0:92706998571a 162 typedef struct {
Davidroid 0:92706998571a 163 uint8_t Mnemonic[12]; //!< AppCmd Mnemonic
Davidroid 0:92706998571a 164 uint8_t BinaryCode; //!< AppCmd Binary Code
Davidroid 0:92706998571a 165 uint8_t NrOfParameters; //!< AppCmd number of needed parameters
Davidroid 0:92706998571a 166 } sL6470_ApplicationCommand_t;
Davidroid 0:92706998571a 167
Davidroid 0:92706998571a 168 /**
Davidroid 0:92706998571a 169 * @brief The structure to store some features about the L6470 Motor Direction.
Davidroid 0:92706998571a 170 */
Davidroid 0:92706998571a 171 typedef struct {
Davidroid 0:92706998571a 172 uint8_t Mnemonic[8]; //!< L6470 Direction Mnemonic
Davidroid 0:92706998571a 173 uint8_t BinaryCode; //!< L6470 Direction Binary Code
Davidroid 0:92706998571a 174 } sL6470_Direction_t;
Davidroid 0:92706998571a 175
Davidroid 0:92706998571a 176 /**
Davidroid 0:92706998571a 177 * @brief The structure to store some features about the action taken with the L6470 ABS_POS register.
Davidroid 0:92706998571a 178 */
Davidroid 0:92706998571a 179 typedef struct {
Davidroid 0:92706998571a 180 uint8_t Mnemonic[4]; //!< ACT Mnemonic
Davidroid 0:92706998571a 181 uint8_t BinaryCode; //!< ACT Binary Code
Davidroid 0:92706998571a 182 } sL6470_ACT_t;
Davidroid 0:92706998571a 183
Davidroid 0:92706998571a 184 /**
Davidroid 0:92706998571a 185 * @brief The structure used to store the identifier of the L6470 application
Davidroid 0:92706998571a 186 * command and its the needed parameters.
Davidroid 0:92706998571a 187 * @note The data stored into this structure will be used to fill the matrix
Davidroid 0:92706998571a 188 * used by SPI to send the command to the L6470.
Davidroid 0:92706998571a 189 */
Davidroid 0:92706998571a 190 typedef struct {
Davidroid 0:92706998571a 191 eL6470_AppCmdId_t L6470_AppCmdId; //!< The identifier of the actual L6470 Application Command
Davidroid 0:92706998571a 192 uint32_t p1; //!< The 1st parameter if needed
Davidroid 0:92706998571a 193 uint32_t p2; //!< The 2nd parameter if needed
Davidroid 0:92706998571a 194 uint32_t p3; //!< The 3rd parameter if needed
Davidroid 0:92706998571a 195 } sL6470_AppCmdPkg_t;
Davidroid 0:92706998571a 196
Davidroid 0:92706998571a 197 /**
Davidroid 0:92706998571a 198 * @}
Davidroid 0:92706998571a 199 */ /* End of L6470_Exported_Types */
Davidroid 0:92706998571a 200
Davidroid 0:92706998571a 201 /**
Davidroid 14:e614697ebf34 202 * @brief L6470 driver initialization structure definition.
Davidroid 14:e614697ebf34 203 */
Davidroid 14:e614697ebf34 204 /* ACTION --------------------------------------------------------------------*
Davidroid 14:e614697ebf34 205 * Declare here the component's initialization structure, if any, one *
Davidroid 14:e614697ebf34 206 * variable per line without initialization. *
Davidroid 14:e614697ebf34 207 * *
Davidroid 14:e614697ebf34 208 * Example: *
Davidroid 14:e614697ebf34 209 * typedef struct *
Davidroid 14:e614697ebf34 210 * { *
Davidroid 14:e614697ebf34 211 * int frequency; *
Davidroid 14:e614697ebf34 212 * int update_mode; *
Davidroid 14:e614697ebf34 213 * } COMPONENT_Init_t; *
Davidroid 14:e614697ebf34 214 *----------------------------------------------------------------------------*/
Davidroid 11:1aca63b2f034 215 typedef struct
Davidroid 11:1aca63b2f034 216 {
Davidroid 11:1aca63b2f034 217 float motorvoltage; //!< motor supply voltage in V
Davidroid 11:1aca63b2f034 218 float fullstepsperrevolution; //!< min number of steps per revolution for the motor
Davidroid 11:1aca63b2f034 219 float phasecurrent; //!< max motor phase voltage in A
Davidroid 11:1aca63b2f034 220 float phasevoltage; //!< max motor phase voltage in V
Davidroid 11:1aca63b2f034 221 float speed; //!< motor initial speed [step/s]
Davidroid 11:1aca63b2f034 222 float acc; //!< motor acceleration [step/s^2] (comment for infinite acceleration mode)
Davidroid 11:1aca63b2f034 223 float dec; //!< motor deceleration [step/s^2] (comment for infinite deceleration mode)
Davidroid 11:1aca63b2f034 224 float maxspeed; //!< motor maximum speed [step/s]
Davidroid 11:1aca63b2f034 225 float minspeed; //!< motor minimum speed [step/s]
Davidroid 11:1aca63b2f034 226 float fsspd; //!< motor full-step speed threshold [step/s]
Davidroid 11:1aca63b2f034 227 float kvalhold; //!< holding kval [V]
Davidroid 11:1aca63b2f034 228 float kvalrun; //!< constant speed kval [V]
Davidroid 11:1aca63b2f034 229 float kvalacc; //!< acceleration starting kval [V]
Davidroid 11:1aca63b2f034 230 float kvaldec; //!< deceleration starting kval [V]
Davidroid 11:1aca63b2f034 231 float intspeed; //!< intersect speed for bemf compensation curve slope changing [step/s]
Davidroid 11:1aca63b2f034 232 float stslp; //!< start slope [s/step]
Davidroid 11:1aca63b2f034 233 float fnslpacc; //!< acceleration final slope [s/step]
Davidroid 11:1aca63b2f034 234 float fnslpdec; //!< deceleration final slope [s/step]
Davidroid 11:1aca63b2f034 235 uint8_t kterm; //!< thermal compensation factor (range [0, 15])
Davidroid 11:1aca63b2f034 236 float ocdth; //!< ocd threshold [ma] (range [375 ma, 6000 ma])
Davidroid 11:1aca63b2f034 237 float stallth; //!< stall threshold [ma] (range [31.25 ma, 4000 ma])
Davidroid 11:1aca63b2f034 238 uint8_t step_sel; //!< step mode selection
Davidroid 11:1aca63b2f034 239 uint8_t alarmen; //!< alarm conditions enable
Davidroid 11:1aca63b2f034 240 uint16_t config; //!< ic configuration
Davidroid 14:e614697ebf34 241 } L6470_Init_t;
Davidroid 11:1aca63b2f034 242
Davidroid 11:1aca63b2f034 243 /**
Davidroid 14:e614697ebf34 244 * @brief L6470 driver data structure definition.
Davidroid 14:e614697ebf34 245 */
Davidroid 0:92706998571a 246 /* ACTION --------------------------------------------------------------------*
Davidroid 0:92706998571a 247 * Declare here the structure of component's data, if any, one variable per *
Davidroid 0:92706998571a 248 * line without initialization. *
Davidroid 0:92706998571a 249 * *
Davidroid 0:92706998571a 250 * Example: *
Davidroid 0:92706998571a 251 * typedef struct *
Davidroid 0:92706998571a 252 * { *
Davidroid 0:92706998571a 253 * int T0_out; *
Davidroid 0:92706998571a 254 * int T1_out; *
Davidroid 0:92706998571a 255 * float T0_degC; *
Davidroid 0:92706998571a 256 * float T1_degC; *
Davidroid 14:e614697ebf34 257 * } COMPONENT_Data_t; *
Davidroid 14:e614697ebf34 258 *----------------------------------------------------------------------------*/
Davidroid 0:92706998571a 259 typedef struct
Davidroid 0:92706998571a 260 {
Davidroid 0:92706998571a 261 uint8_t L6470_Id; //!< The L6470 identifier inside the daisy chain
Davidroid 0:92706998571a 262 sL6470_Register_t *L6470_Register; //[L6470REGIDSIZE]; //!< Array whose elements are a structure in which store information about the L6470 Registers (the address, the names, the length in bits, the reset value)
Davidroid 0:92706998571a 263 sL6470_ApplicationCommand_t *L6470_ApplicationCommand; //[L6470APPCMDIDSIZE]; //!< Array whose elements are a structure in which store information about the L6470 Application Commands (the mnemonic name, the number of needed parameters, the related funtion to call)
Davidroid 0:92706998571a 264 sL6470_Direction_t *L6470_Direction; //[L6470DIRIDSIZE]; //!< The mnemonic names for the L6470 direction
Davidroid 0:92706998571a 265 sL6470_ACT_t *L6470_ACT; //[L6470ACTIDSIZE]; //!< Action taken about ABS_POS register
Davidroid 0:92706998571a 266 sL6470_AppCmdPkg_t L6470_AppCmdPkg[L6470DAISYCHAINSIZE]; //!< To store the identifier of the actual L6470 application command and its the needed parameters
Davidroid 0:92706998571a 267 uint8_t L6470_DaisyChainSpiTxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE]; //!< To store the matrix that contains the command data that are going to be sent by SPI to the L6470 daisy chain
Davidroid 0:92706998571a 268 uint8_t L6470_DaisyChainSpiRxStruct[L6470MAXSPICMDBYTESIZE][L6470DAISYCHAINSIZE]; //!< To store the matrix that contains the received data by SPI from the L6470 daisy chain
Davidroid 0:92706998571a 269 eFlagStatus_t L6470_DaisyChain_HalfPrepared; /* = ZERO_F; */ //!< Boolean variable used when more than one L6470 into the daisy chain is going to be addressed for commanding
Davidroid 0:92706998571a 270 sL6470_StatusRegister_t L6470_StatusRegister; //!< To store the received L6470_StatusRegister
Davidroid 0:92706998571a 271 sL6470_StatusRegister_t *pL6470_StatusRegister; /* = &L6470_StatusRegister; */ //!< Pointer to the L6470_StatusRegister variable
Davidroid 14:e614697ebf34 272 } L6470_Data_t;
Davidroid 0:92706998571a 273
Davidroid 0:92706998571a 274
Davidroid 0:92706998571a 275 /* Functions -----------------------------------------------------------------*/
Davidroid 0:92706998571a 276
Davidroid 0:92706998571a 277 /** @addtogroup BSP
Davidroid 0:92706998571a 278 * @{
Davidroid 0:92706998571a 279 */
Davidroid 0:92706998571a 280
Davidroid 0:92706998571a 281 /** @addtogroup Components
Davidroid 0:92706998571a 282 * @{
Davidroid 0:92706998571a 283 */
Davidroid 0:92706998571a 284
Davidroid 0:92706998571a 285 /** @addtogroup L6470
Davidroid 0:92706998571a 286 * @{
Davidroid 0:92706998571a 287 */
Davidroid 0:92706998571a 288
Davidroid 14:e614697ebf34 289 /** @defgroup L6470_Imported_Functions L6470_Imported_Functions
Davidroid 0:92706998571a 290 * @{
Davidroid 0:92706998571a 291 */
Davidroid 14:e614697ebf34 292
Davidroid 0:92706998571a 293 /* ACTION --------------------------------------------------------------------*
Davidroid 14:e614697ebf34 294 * Declare here extern platform-dependent APIs you might need (e.g.: I/O and *
Davidroid 14:e614697ebf34 295 * interrupt related functions), and implement them in a glue-logic file on *
Davidroid 14:e614697ebf34 296 * the target environment, for example within the "x_nucleo_board.c" file. *
Davidroid 14:e614697ebf34 297 * E.g.: *
Davidroid 14:e614697ebf34 298 * extern Status_t COMPONENT_IO_Init (void *handle); *
Davidroid 14:e614697ebf34 299 * extern Status_t COMPONENT_IO_Read (handle, buf, regadd, bytes); *
Davidroid 14:e614697ebf34 300 * extern Status_t COMPONENT_IO_Write(handle, buf, regadd, bytes); *
Davidroid 14:e614697ebf34 301 * extern void COMPONENT_IO_ITConfig(void); *
Davidroid 0:92706998571a 302 *----------------------------------------------------------------------------*/
Davidroid 0:92706998571a 303 extern void L6470_DISABLE(void);
Davidroid 0:92706998571a 304 extern void L6470_ENABLE(void);
Davidroid 0:92706998571a 305 extern void L6470_nCS_LOW(void);
Davidroid 0:92706998571a 306 extern void L6470_nCS_HIGH(void);
Davidroid 0:92706998571a 307 extern void L6470_SPI_Communication(uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout);
Davidroid 0:92706998571a 308
Davidroid 0:92706998571a 309 #ifdef __cplusplus
Davidroid 0:92706998571a 310 }
Davidroid 0:92706998571a 311 #endif
Davidroid 0:92706998571a 312
Davidroid 0:92706998571a 313 #endif /* __L6470_H */
Davidroid 0:92706998571a 314
Davidroid 0:92706998571a 315 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/