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: BSP/x_nucleo_ihm02a1_class.h
- Revision:
- 1:b78dab6d2c58
- Parent:
- 0:92706998571a
- Child:
- 3:e3f6f4474d98
diff -r 92706998571a -r b78dab6d2c58 BSP/x_nucleo_ihm02a1_class.h
--- a/BSP/x_nucleo_ihm02a1_class.h Fri Nov 20 18:07:45 2015 +0000
+++ b/BSP/x_nucleo_ihm02a1_class.h Wed Nov 25 11:59:37 2015 +0000
@@ -79,16 +79,18 @@
/**
* @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
* @param flag_irq pin name of the FLAG pin of the component.
+ * @param busy_irq pin name of the BUSY pin of the component.
* @param standby_reset pin name of the STBY\RST pin of the component.
* @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.
* @retval a singleton instance of X_NUCLEO_IHM02A1 class.
*/
- static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi = NULL);
+ static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi = NULL);
/**
* @brief Getting a singleton instance of X_NUCLEO_IHM02A1 class.
* @param flag_irq pin name of the FLAG pin of the component.
+ * @param busy_irq pin name of the BUSY pin of the component.
* @param standby_reset pin name of the STBY\RST pin of the component.
* @param ssel pin name of the SSEL pin of the SPI device to be used for communication.
* @param mosi pin name of the MOSI pin of the SPI device to be used for communication.
@@ -96,7 +98,7 @@
* @param sclk pin name of the SCLK pin of the SPI device to be used for communication.
* @retval a singleton instance of X_NUCLEO_IHM02A1 class.
*/
- static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName standby_reset, PinName ssel, PinName miso, PinName mosi, PinName sclk);
+ static X_NUCLEO_IHM02A1 *Instance(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName miso, PinName mosi, PinName sclk);
/**
* @brief Initializing the X_NUCLEO_IHM02A1 board.
@@ -109,6 +111,47 @@
*/
~X_NUCLEO_IHM02A1(void) {}
+ /**
+ * @brief Getting the array of components.
+ * @param None.
+ * @retval The array of components.
+ */
+ L6470 **GetComponents(void)
+ {
+ return components;
+ }
+
+ /**
+ * @brief Performing the actions set on the motors with calls to a number of
+ * "Prepare<Action>()" methods, one for each motor of the daisy-chain.
+ * @param None.
+ * @retval A pointer to the results returned by the components, i.e. an
+ * integer value for each of them.
+ */
+ virtual uint32_t* PerformPreparedActions(void)
+ {
+ /* Performing pre-actions, if needed. */
+ for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
+ {
+ /*
+ "GetPosition()" is needed by "PrepareSetMark()" at the time when the
+ prepared actions get performed.
+ */
+ if (components[m]->GetPreparedAction() == L6470::PREPARED_SET_MARK)
+ components[m]->PrepareSetMark((uint32_t) components[m]->GetPosition());
+ }
+
+ /* Performing the prepared actions and getting back raw data. */
+ uint8_t *raw_data = components[0]->PerformPreparedActions();
+
+ /* Processing raw data. */
+ for (int m = 0; m < L6470DAISYCHAINSIZE; m++)
+ results[m] = components[m]->GetResult(raw_data);
+
+ /* Returning results. */
+ return results;
+ }
+
/*** Public Expansion Board Related Attributes ***/
@@ -135,11 +178,12 @@
/**
* @brief Constructor.
* @param flag_irq pin name of the FLAG pin of the component.
+ * @param busy_irq pin name of the BUSY pin of the component.
* @param standby_reset pin name of the STBY\RST pin of the component.
* @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.
*/
- X_NUCLEO_IHM02A1(PinName flag_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
+ X_NUCLEO_IHM02A1(PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi);
/*** Protected Expansion Board Related Initialization Methods ***/
@@ -164,6 +208,12 @@
/* IO Device. */
DevSPI *dev_spi;
+ /* Components. */
+ L6470 *components[L6470DAISYCHAINSIZE];
+
+ /* Results of prepared actions. */
+ uint32_t results[L6470DAISYCHAINSIZE];
+
/* Data. */
/* ACTION 11 -------------------------------------------------------------*
* Declare here the component's data, one variable per line. *
