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

Dependencies:   X_NUCLEO_COMMON

Fork of X_NUCLEO_IHM02A1 by ST

Files at this revision

API Documentation at this revision

Comitter:
Isto
Date:
Wed Jul 27 09:15:53 2016 +0000
Parent:
19:591ef53bc983
Commit message:
+ fix

Changed in this revision

BSP/x_nucleo_ihm02a1_class.cpp Show annotated file Show diff for this revision Revisions of this file
Components/l6470/l6470_class.h Show annotated file Show diff for this revision Revisions of this file
diff -r 591ef53bc983 -r 9821a6a2ca62 BSP/x_nucleo_ihm02a1_class.cpp
--- a/BSP/x_nucleo_ihm02a1_class.cpp	Tue Jul 26 15:17:40 2016 +0000
+++ b/BSP/x_nucleo_ihm02a1_class.cpp	Wed Jul 27 09:15:53 2016 +0000
@@ -89,8 +89,8 @@
      *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
      *   component_2 = new COMPONENT_2(ssel, *dev_spi);                       *
      *------------------------------------------------------------------------*/
-    components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi, X_NUCLEO_IHM02A1_Id);
-    components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi, X_NUCLEO_IHM02A1_Id);
+    components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
+    components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
 
     /* Initializing the components. */
     init_components[0] = init_0;
@@ -129,8 +129,8 @@
      *   component_1 = new COMPONENT_1(ssel, *dev_spi);                       *
      *   component_2 = new COMPONENT_2(ssel, *dev_spi);                       *
      *------------------------------------------------------------------------*/
-    components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi, X_NUCLEO_IHM02A1_Id);
-    components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi, X_NUCLEO_IHM02A1_Id);
+    components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
+    components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi);
 
     /* Initializing the components. */
     init_components[0] = init_0;
diff -r 591ef53bc983 -r 9821a6a2ca62 Components/l6470/l6470_class.h
--- a/Components/l6470/l6470_class.h	Tue Jul 26 15:17:40 2016 +0000
+++ b/Components/l6470/l6470_class.h	Wed Jul 27 09:15:53 2016 +0000
@@ -113,7 +113,7 @@
      * @param ssel          pin name of the SSEL pin of the SPI device to be used for communication.
      * @param spi           SPI device to be used for communication.
      */
-    L6470(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI &spi, uint8_t ExpBrd_Id) : StepperMotor(), flag_irq(flag_irq), busy_irq(busy_irq), standby_reset(standby_reset), ssel(ssel), dev_spi(spi)
+    L6470(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI &spi) : StepperMotor(), flag_irq(flag_irq), busy_irq(busy_irq), standby_reset(standby_reset), ssel(ssel), dev_spi(spi)
     {
         /* ACTION 4 ----------------------------------------------------------*
          * Initialize here the component's member variables, one variable per *
@@ -129,7 +129,7 @@
         L6470_ACT = &_L6470_ACT[0];
         pL6470_StatusRegister = &L6470_StatusRegister;
         prepared_action = PREPARED_NO_ACTION;
-        L6470_Id = (number_of_devices++)/(ExpBrd_Id+1);
+        L6470_Id = (number_of_devices++)%(L6470DAISYCHAINSIZE);
         L6470_DaisyChain_HalfPrepared = ZERO_F;
         memset(L6470_AppCmdPkg, 0, L6470DAISYCHAINSIZE * sizeof(sL6470_AppCmdPkg_t));
         memset(L6470_DaisyChainSpiTxStruct, 0, L6470MAXSPICMDBYTESIZE * L6470DAISYCHAINSIZE * sizeof(uint8_t));