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
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 pinA2
;SB_7
resistor connected only: SSEL on pinD2
;SB_8
resistor connected only: SSEL on pinD10
;SB_9
resistor connected only: SSEL on pinD5
.
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
BSP/XNucleoIhm02a1.cpp@23:cf489f2ab072, 2017-03-10 (annotated)
- Committer:
- Davidroid
- Date:
- Fri Mar 10 15:23:54 2017 +0000
- Revision:
- 23:cf489f2ab072
- Parent:
- 22:ba7f4131a5e0
Aligned to ARM mbed coding style.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 1 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 2 | ****************************************************************************** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 3 | * @file XNucleoIhm02a1.cpp |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 4 | * @author AST / Software Platforms and Cloud |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 5 | * @version V1.0 |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 6 | * @date November 3rd, 2015 |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 7 | * @brief Implementation file for the X_NUCLEO_IHM02A1 expansion board. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 8 | ****************************************************************************** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 9 | * @attention |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 10 | * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 12 | * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 14 | * are permitted provided that the following conditions are met: |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 16 | * this list of conditions and the following disclaimer. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 18 | * this list of conditions and the following disclaimer in the documentation |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 19 | * and/or other materials provided with the distribution. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 21 | * may be used to endorse or promote products derived from this software |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 22 | * without specific prior written permission. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 23 | * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 34 | * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 35 | ****************************************************************************** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 36 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 37 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 38 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 39 | /* Generated with STM32CubeTOO -----------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 40 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 41 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 42 | /* Includes ------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 43 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 44 | /* ACTION 1 ------------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 45 | * Include here platform specific header files. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 46 | *----------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 47 | #include "mbed.h" |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 48 | #include "DevSPI.h" |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 49 | /* ACTION 2 ------------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 50 | * Include here expansion board specific header files. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 51 | *----------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 52 | #include "XNucleoIhm02a1.h" |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 53 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 54 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 55 | /* Variables -----------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 56 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 57 | /* Number of expansion boards. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 58 | uint8_t XNucleoIhm02a1::number_of_boards = 0; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 59 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 60 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 61 | /* Methods -------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 62 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 63 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 64 | * @brief Constructor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 65 | * @param init_0 pointer to the initialization structure of the first motor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 66 | * @param init_1 pointer to the initialization structure of the second motor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 67 | * @param flag_irq pin name of the FLAG pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 68 | * @param busy_irq pin name of the BUSY pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 69 | * @param standby_reset pin name of the STBY\RST pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 70 | * @param ssel pin name of the SSEL pin of the SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 71 | * @param spi SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 72 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 73 | XNucleoIhm02a1::XNucleoIhm02a1(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) |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 74 | { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 75 | /* Checking stackability. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 76 | if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 77 | error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 78 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 79 | instance_id = number_of_boards++; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 80 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 81 | /* SPI communication. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 82 | if (dev_spi == NULL) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 83 | dev_spi = new DevSPI(X_NUCLEO_IHM02A1_PIN_SPI_MOSI, X_NUCLEO_IHM02A1_PIN_SPI_MISO, X_NUCLEO_IHM02A1_PIN_SPI_SCLK); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 84 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 85 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 86 | /* Instantiating the components. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 87 | /* ACTION 3 --------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 88 | * Instantiate here the expansion board's components. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 89 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 90 | * Example: * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 91 | * component_1 = new COMPONENT_1(ssel, *dev_spi); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 92 | * component_2 = new COMPONENT_2(ssel, *dev_spi); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 93 | *------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 94 | components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 95 | components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 96 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 97 | /* Initializing the components. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 98 | init_components[0] = init_0; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 99 | init_components[1] = init_1; |
Davidroid | 23:cf489f2ab072 | 100 | if (!init()) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 101 | error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n"); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 102 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 103 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 104 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 105 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 106 | * @brief Constructor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 107 | * @param init_0 pointer to the initialization structure of the first motor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 108 | * @param init_1 pointer to the initialization structure of the second motor. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 109 | * @param flag_irq pin name of the FLAG pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 110 | * @param busy_irq pin name of the BUSY pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 111 | * @param standby_reset pin name of the STBY\RST pin of the component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 112 | * @param ssel pin name of the SSEL pin of the SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 113 | * @param mosi pin name of the MOSI pin of the SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 114 | * @param miso pin name of the MISO pin of the SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 115 | * @param sclk pin name of the SCLK pin of the SPI device to be used for communication. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 116 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 117 | XNucleoIhm02a1::XNucleoIhm02a1(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) |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 118 | { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 119 | /* Checking stackability. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 120 | if (!(number_of_boards < EXPBRD_MOUNTED_NR_MAX)) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 121 | error("Instantiation of the X_NUCLEO_IHM02A1 expansion board failed: it can be stacked up to %d times.\r\n", EXPBRD_MOUNTED_NR_MAX); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 122 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 123 | instance_id = number_of_boards++; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 124 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 125 | /* SPI communication. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 126 | dev_spi = new DevSPI(mosi, miso, sclk); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 127 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 128 | /* Instantiating the components. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 129 | /* ACTION 3 --------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 130 | * Instantiate here the expansion board's components. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 131 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 132 | * Example: * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 133 | * component_1 = new COMPONENT_1(ssel, *dev_spi); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 134 | * component_2 = new COMPONENT_2(ssel, *dev_spi); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 135 | *------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 136 | components[0] = l6470_0 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 137 | components[1] = l6470_1 = new L6470(flag_irq, busy_irq, standby_reset, ssel, *dev_spi); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 138 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 139 | /* Initializing the components. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 140 | init_components[0] = init_0; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 141 | init_components[1] = init_1; |
Davidroid | 23:cf489f2ab072 | 142 | if (!init()) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 143 | error("Initialization of the X_NUCLEO_IHM02A1 expansion board failed.\r\n"); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 144 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 145 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 146 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 147 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 148 | * @brief Initializing the X_NUCLEO_IHM02A1 board. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 149 | * @retval true if initialization is successful, false otherwise. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 150 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 151 | bool XNucleoIhm02a1::init(void) |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 152 | { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 153 | /* Initializing the components. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 154 | /* ACTION 4 --------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 155 | * Initialize here the expansion board's components. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 156 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 157 | * Example: * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 158 | * return (init_COMPONENT_1() && init_COMPONENT_2()); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 159 | *------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 160 | return (init_L6470_0() && init_L6470_1()); |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 161 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 162 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 163 | /* ACTION 5 ------------------------------------------------------------------* |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 164 | * Implement here an initialization method for each expansion board's * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 165 | * component. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 166 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 167 | * Example: * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 168 | * bool ExpansionBoard::init_COMPONENT_1(void) * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 169 | * { * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 170 | * // Verifying identity. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 171 | * uint8_t id = 0; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 172 | * int ret = component_1->read_id(&id); * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 173 | * if ((ret != COMPONENT_OK) || (id != I_AM_COMPONENT_1)) * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 174 | * { * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 175 | * delete component_1; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 176 | * component_1 = NULL; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 177 | * return true; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 178 | * } * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 179 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 180 | * // Configuration. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 181 | * COMPONENT_init_t init; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 182 | * init.property_1 = COMPONENT_1_PROPERY_1_INIT; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 183 | * init.property_N = COMPONENT_1_PROPERY_N_INIT; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 184 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 185 | * // Initialization. * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 186 | * if (component_1->init(&init) != COMPONENT_OK) * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 187 | * return false; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 188 | * * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 189 | * return true; * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 190 | * } * |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 191 | *----------------------------------------------------------------------------*/ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 192 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 193 | * @brief Initialize the L6470 component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 194 | * @retval true if initialization is successful, false otherwise. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 195 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 196 | bool XNucleoIhm02a1::init_L6470_0(void) |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 197 | { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 198 | /* Initialization. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 199 | if (l6470_0->init((void *) init_components[0]) != COMPONENT_OK) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 200 | return false; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 201 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 202 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 203 | return true; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 204 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 205 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 206 | /** |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 207 | * @brief Initialize the L6470 component. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 208 | * @retval true if initialization is successful, false otherwise. |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 209 | */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 210 | bool XNucleoIhm02a1::init_L6470_1(void) |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 211 | { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 212 | /* Initialization. */ |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 213 | if (l6470_1->init((void *) init_components[1]) != COMPONENT_OK) { |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 214 | return false; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 215 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 216 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 217 | return true; |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 218 | } |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 219 | |
davide.aliprandi@st.com | 22:ba7f4131a5e0 | 220 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |