mbed library for STMicroelectronics' X-NUCLEO-IKA01A1 expansion board.

Dependents:   HelloWorld_IKA01A1

Fork of X_NUCLEO_IKA01A1 by ST Expansion SW Team

Library for STMicroelectronics' X-NUCLEO-IKA01A1 multifunctional expansion board based on operational amplifiers.

Committer:
Davidroid
Date:
Thu Jul 13 15:46:02 2017 +0000
Revision:
23:807f66b435d6
Parent:
22:ff8d071bf79e
Adapting to ARM mbed coding style.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hemddabral 2:19d1dcef0c0e 1 /**
hemddabral 2:19d1dcef0c0e 2 ******************************************************************************
Davidroid 22:ff8d071bf79e 3 * @file XNucleoIKA01A1.h
hemddabral 2:19d1dcef0c0e 4 * @author AST / Software Platforms and Cloud
hemddabral 2:19d1dcef0c0e 5 * @version V1.0
hemddabral 2:19d1dcef0c0e 6 * @date October 1st, 2015
hemddabral 2:19d1dcef0c0e 7 * @brief Class header file for the X_NUCLEO_IKA01A1 expansion board.
hemddabral 2:19d1dcef0c0e 8 ******************************************************************************
hemddabral 2:19d1dcef0c0e 9 * @attention
hemddabral 2:19d1dcef0c0e 10 *
hemddabral 2:19d1dcef0c0e 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
hemddabral 2:19d1dcef0c0e 12 *
hemddabral 2:19d1dcef0c0e 13 * Redistribution and use in source and binary forms, with or without modification,
hemddabral 2:19d1dcef0c0e 14 * are permitted provided that the following conditions are met:
hemddabral 2:19d1dcef0c0e 15 * 1. Redistributions of source code must retain the above copyright notice,
hemddabral 2:19d1dcef0c0e 16 * this list of conditions and the following disclaimer.
hemddabral 2:19d1dcef0c0e 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
hemddabral 2:19d1dcef0c0e 18 * this list of conditions and the following disclaimer in the documentation
hemddabral 2:19d1dcef0c0e 19 * and/or other materials provided with the distribution.
hemddabral 2:19d1dcef0c0e 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
hemddabral 2:19d1dcef0c0e 21 * may be used to endorse or promote products derived from this software
hemddabral 2:19d1dcef0c0e 22 * without specific prior written permission.
hemddabral 2:19d1dcef0c0e 23 *
hemddabral 2:19d1dcef0c0e 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
hemddabral 2:19d1dcef0c0e 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
hemddabral 2:19d1dcef0c0e 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
hemddabral 2:19d1dcef0c0e 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
hemddabral 2:19d1dcef0c0e 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
hemddabral 2:19d1dcef0c0e 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
hemddabral 2:19d1dcef0c0e 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
hemddabral 2:19d1dcef0c0e 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
hemddabral 2:19d1dcef0c0e 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
hemddabral 2:19d1dcef0c0e 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
hemddabral 2:19d1dcef0c0e 34 *
hemddabral 2:19d1dcef0c0e 35 ******************************************************************************
hemddabral 2:19d1dcef0c0e 36 */
hemddabral 2:19d1dcef0c0e 37
hemddabral 2:19d1dcef0c0e 38
hemddabral 2:19d1dcef0c0e 39 /* Generated with STM32CubeTOO -----------------------------------------------*/
hemddabral 2:19d1dcef0c0e 40
hemddabral 2:19d1dcef0c0e 41
hemddabral 2:19d1dcef0c0e 42 /* Define to prevent recursive inclusion -------------------------------------*/
hemddabral 2:19d1dcef0c0e 43
hemddabral 2:19d1dcef0c0e 44 #ifndef __X_NUCLEO_IKA01A1_CLASS_H
hemddabral 2:19d1dcef0c0e 45 #define __X_NUCLEO_IKA01A1_CLASS_H
hemddabral 2:19d1dcef0c0e 46
hemddabral 2:19d1dcef0c0e 47
hemddabral 2:19d1dcef0c0e 48 /* Includes ------------------------------------------------------------------*/
hemddabral 2:19d1dcef0c0e 49
hemddabral 2:19d1dcef0c0e 50 /* ACTION 1 ------------------------------------------------------------------*
hemddabral 2:19d1dcef0c0e 51 * Include here platform specific header files. *
hemddabral 2:19d1dcef0c0e 52 *----------------------------------------------------------------------------*/
hemddabral 2:19d1dcef0c0e 53 #include "mbed.h"
hemddabral 2:19d1dcef0c0e 54 /* ACTION 2 ------------------------------------------------------------------*
hemddabral 2:19d1dcef0c0e 55 * Include here expansion board configuration's header files. *
hemddabral 2:19d1dcef0c0e 56 *----------------------------------------------------------------------------*/
Davidroid 22:ff8d071bf79e 57 #include "XNucleoIKA01A1.h"
hemddabral 2:19d1dcef0c0e 58 /* ACTION 3 ------------------------------------------------------------------*
hemddabral 2:19d1dcef0c0e 59 * Include here expansion board's components' header files. *
hemddabral 2:19d1dcef0c0e 60 * *
hemddabral 2:19d1dcef0c0e 61 * Example: *
Davidroid 22:ff8d071bf79e 62 * #include "COMPONENT_1.h" *
Davidroid 22:ff8d071bf79e 63 * #include "COMPONENT_2.h" *
hemddabral 2:19d1dcef0c0e 64 *----------------------------------------------------------------------------*/
Davidroid 22:ff8d071bf79e 65 #include "TSZ124.h"
Davidroid 22:ff8d071bf79e 66 #include "TSU104.h"
Davidroid 22:ff8d071bf79e 67 #include "TSV734.h"
hemddabral 2:19d1dcef0c0e 68
hemddabral 2:19d1dcef0c0e 69
hemddabral 2:19d1dcef0c0e 70 /* Classes -------------------------------------------------------------------*/
hemddabral 2:19d1dcef0c0e 71
Davidroid 22:ff8d071bf79e 72 /** Class XNucleoIKA01A1 represents multifunctional expansion board based on operational amplifiers.
hemddabral 13:9cecc8d66cc1 73 * It provides an easy-to-use and affordable solution for different multifunctional use cases with your
hemddabral 13:9cecc8d66cc1 74 * STM32 Nucleo board. For current sensing configuration and the instrumentation amplifier configuration,
hemddabral 13:9cecc8d66cc1 75 * a highly accurate operational amplifier (TSZ124) is used. The expansion board also contains Nanopower (TSU104)
hemddabral 13:9cecc8d66cc1 76 * and Micropower (TSV734) operational amplifiers for mobile applications.
hemddabral 13:9cecc8d66cc1 77 * It is intentionally implemented as a singleton because only one
Davidroid 22:ff8d071bf79e 78 * XNucleoIKA01A1 at a time might be deployed in a HW component stack.\n
hemddabral 13:9cecc8d66cc1 79 * In order to get the singleton instance you have to call class method `Instance()`,
hemddabral 13:9cecc8d66cc1 80 * e.g.:
hemddabral 13:9cecc8d66cc1 81 * @code
hemddabral 13:9cecc8d66cc1 82 * // Inertial & Environmental expansion board singleton instance
Davidroid 22:ff8d071bf79e 83 * static XNucleoIKA01A1 *<TODO>_expansion_board = XNucleoIKA01A1::instance();
hemddabral 13:9cecc8d66cc1 84 * @endcode
hemddabral 13:9cecc8d66cc1 85 *
hemddabral 2:19d1dcef0c0e 86 */
Davidroid 22:ff8d071bf79e 87 class XNucleoIKA01A1
hemddabral 2:19d1dcef0c0e 88 {
hemddabral 2:19d1dcef0c0e 89 public:
hemddabral 2:19d1dcef0c0e 90
hemddabral 2:19d1dcef0c0e 91 /*** Instance, Initialization and Destructor Methods ***/
hemddabral 2:19d1dcef0c0e 92
hemddabral 2:19d1dcef0c0e 93 /**
Davidroid 22:ff8d071bf79e 94 * @brief Getting a singleton instance of XNucleoIKA01A1 class.
Davidroid 22:ff8d071bf79e 95 * @retval a singleton instance of XNucleoIKA01A1 class.
hemddabral 2:19d1dcef0c0e 96 */
Davidroid 22:ff8d071bf79e 97 static XNucleoIKA01A1 *instance(PinName instrumentAmpPin, PinName currentSensorPin, PinName photoSensorPin, PinName windCmpSignalPin_1,
Davidroid 22:ff8d071bf79e 98 PinName windCmpSignalPin_2, PinName ledDriverPin, double ledDriverPeriod_us);
hemddabral 2:19d1dcef0c0e 99
hemddabral 2:19d1dcef0c0e 100 /**
hemddabral 13:9cecc8d66cc1 101 * @brief Initialize the singleton's operational amplifiers to default settings
hemddabral 13:9cecc8d66cc1 102 * @retval true if initialization is successful
hemddabral 13:9cecc8d66cc1 103 * @retval false otherwise.
hemddabral 2:19d1dcef0c0e 104 */
Davidroid 22:ff8d071bf79e 105 bool init(void);
hemddabral 2:19d1dcef0c0e 106
hemddabral 2:19d1dcef0c0e 107 /**
hemddabral 2:19d1dcef0c0e 108 * @brief Destructor.
hemddabral 2:19d1dcef0c0e 109 */
Davidroid 22:ff8d071bf79e 110 ~XNucleoIKA01A1(void) {}
hemddabral 2:19d1dcef0c0e 111
hemddabral 2:19d1dcef0c0e 112
hemddabral 2:19d1dcef0c0e 113 /*** Public Expansion Board Related Attributes ***/
hemddabral 2:19d1dcef0c0e 114
hemddabral 2:19d1dcef0c0e 115 /* ACTION 4 --------------------------------------------------------------*
hemddabral 2:19d1dcef0c0e 116 * Declare here a public attribute for each expansion board's component. *
hemddabral 2:19d1dcef0c0e 117 * You will have to call these attributes' public methods within your *
hemddabral 2:19d1dcef0c0e 118 * main program. *
hemddabral 2:19d1dcef0c0e 119 * *
hemddabral 2:19d1dcef0c0e 120 * Example: *
hemddabral 2:19d1dcef0c0e 121 * COMPONENT_1 *component_1; *
hemddabral 2:19d1dcef0c0e 122 * COMPONENT_2 *component_2; *
hemddabral 2:19d1dcef0c0e 123 *------------------------------------------------------------------------*/
hemddabral 2:19d1dcef0c0e 124 TSZ124 *tsz124;
hemddabral 2:19d1dcef0c0e 125 TSU104 *tsu104;
hemddabral 2:19d1dcef0c0e 126 TSV734 *tsv734;
hemddabral 2:19d1dcef0c0e 127
hemddabral 2:19d1dcef0c0e 128
hemddabral 2:19d1dcef0c0e 129 protected:
hemddabral 2:19d1dcef0c0e 130
hemddabral 2:19d1dcef0c0e 131 /*** Protected Constructor Method ***/
hemddabral 2:19d1dcef0c0e 132
hemddabral 2:19d1dcef0c0e 133 /**
hemddabral 2:19d1dcef0c0e 134 * @brief Constructor.
hemddabral 2:19d1dcef0c0e 135 */
Davidroid 22:ff8d071bf79e 136 XNucleoIKA01A1(PinName instrumentAmpPin, PinName currentSensorPin, PinName photoSensorPin, PinName windCmpSignalPin_1,
Davidroid 22:ff8d071bf79e 137 PinName windCmpSignalPin_2, PinName ledDriverPin, double ledDriverPeriod_us);
hemddabral 2:19d1dcef0c0e 138
hemddabral 2:19d1dcef0c0e 139
hemddabral 2:19d1dcef0c0e 140 /*** Protected Expansion Board Related Initialization Methods ***/
hemddabral 2:19d1dcef0c0e 141
hemddabral 2:19d1dcef0c0e 142 /* ACTION 5 --------------------------------------------------------------*
hemddabral 2:19d1dcef0c0e 143 * Declare here a protected initialization method for each expansion *
hemddabral 2:19d1dcef0c0e 144 * board's component. *
hemddabral 2:19d1dcef0c0e 145 * *
hemddabral 2:19d1dcef0c0e 146 * Example: *
Davidroid 22:ff8d071bf79e 147 * bool init_COMPONENT_1(void); *
Davidroid 22:ff8d071bf79e 148 * bool init_COMPONENT_2(void); *
hemddabral 2:19d1dcef0c0e 149 *------------------------------------------------------------------------*/
Davidroid 22:ff8d071bf79e 150 bool init_TSZ124(void);
Davidroid 22:ff8d071bf79e 151 bool init_TSU104(void);
Davidroid 22:ff8d071bf79e 152 bool init_TSV734(void);
hemddabral 2:19d1dcef0c0e 153
hemddabral 2:19d1dcef0c0e 154
hemddabral 2:19d1dcef0c0e 155 /*** Component's Instance Variables ***/
hemddabral 2:19d1dcef0c0e 156
Davidroid 22:ff8d071bf79e 157 /* Singleton instance of XNucleoIKA01A1 class. */
Davidroid 22:ff8d071bf79e 158 static XNucleoIKA01A1 *_instance;
hemddabral 2:19d1dcef0c0e 159 };
hemddabral 2:19d1dcef0c0e 160
hemddabral 2:19d1dcef0c0e 161 #endif /* __X_NUCLEO_IKA01A1_CLASS_H */
hemddabral 2:19d1dcef0c0e 162
hemddabral 2:19d1dcef0c0e 163 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/