Library to handle the X_NUCLEO_IHM02A1 Motor Control Expansion Board based on the L6470 component.
Fork of X_NUCLEO_IHM02A1 by
Diff: BSP/x_nucleo_ihm02a1_class.cpp
- Revision:
- 14:e614697ebf34
- Parent:
- 11:1aca63b2f034
- Child:
- 15:31785d1acd4b
--- a/BSP/x_nucleo_ihm02a1_class.cpp Tue Jan 19 16:07:00 2016 +0000 +++ b/BSP/x_nucleo_ihm02a1_class.cpp Tue Feb 09 16:01:30 2016 +0000 @@ -43,12 +43,12 @@ /* ACTION 1 ------------------------------------------------------------------* * Include here platform specific header files. * - *----------------------------------------------------------------------------*/ + *----------------------------------------------------------------------------*/ #include "mbed.h" #include "DevSPI.h" /* ACTION 2 ------------------------------------------------------------------* * Include here expansion board specific header files. * - *----------------------------------------------------------------------------*/ + *----------------------------------------------------------------------------*/ #include "x_nucleo_ihm02a1_class.h" @@ -70,7 +70,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. */ -X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(L6470_InitTypeDef *init_0, L6470_InitTypeDef *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi) +X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, DevSPI *spi) : dev_spi(spi) { /* Checking stackability. */ if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) @@ -86,8 +86,8 @@ * Instantiate here the expansion board's components. * * * * Example: * - * component_1 = new COMPONENT_1(COMPONENT_1_SPI_SSEL, *dev_spi); * - * component_2 = new COMPONENT_2(COMPONENT_2_SPI_SSEL, *dev_spi); * + * 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); components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); @@ -111,7 +111,7 @@ * @param miso pin name of the MISO pin of the SPI device to be used for communication. * @param sclk pin name of the SCLK pin of the SPI device to be used for communication. */ -X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(L6470_InitTypeDef *init_0, L6470_InitTypeDef *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk) +X_NUCLEO_IHM02A1::X_NUCLEO_IHM02A1(L6470_Init_t *init_0, L6470_Init_t *init_1, PinName flag_irq, PinName busy_irq, PinName standby_reset, PinName ssel, PinName mosi, PinName miso, PinName sclk) { /* Checking stackability. */ if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) @@ -126,8 +126,8 @@ * Instantiate here the expansion board's components. * * * * Example: * - * component_1 = new COMPONENT_1(COMPONENT_1_SPI_SSEL, *dev_spi); * - * component_2 = new COMPONENT_2(COMPONENT_2_SPI_SSEL, *dev_spi); * + * 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); components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); @@ -173,7 +173,7 @@ * } * * * * // Configuration. * - * INTERFACE_InitTypeDef InitStructure; * + * COMPONENT_Init_t InitStructure; * * InitStructure.Property_1 = COMPONENT_1_PROPERY_1_INIT; * * InitStructure.Property_N = COMPONENT_1_PROPERY_N_INIT; * * * @@ -204,7 +204,7 @@ bool X_NUCLEO_IHM02A1::Init_L6470_1(void) { /* Initialization. */ - if (l6470_1->Init((void *) init_components[0]) != COMPONENT_OK) + if (l6470_1->Init((void *) init_components[1]) != COMPONENT_OK) return false; return true;