mbed library for STMicroelectronics' X-NUCLEO-IKA01A1 expansion board.
Dependents: HelloWorld_IKA01A1
Fork of X_NUCLEO_IKA01A1 by
Library for STMicroelectronics' X-NUCLEO-IKA01A1 multifunctional expansion board based on operational amplifiers.
Revision 0:8d2ff26a1946, committed 2016-02-24
- Comitter:
- hemddabral
- Date:
- Wed Feb 24 12:16:21 2016 +0000
- Child:
- 1:7fbcb56cc096
- Commit message:
- first version of IKA01A1 mbed library;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/component.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,94 @@
+/**
+ ******************************************************************************
+ * @file component.h
+ * @author AST
+ * @version V1.0.0
+ * @date 1 April 2015
+ * @brief Generic header file containing a generic component's definitions
+ * and I/O functions.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __COMPONENT_H
+#define __COMPONENT_H
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/**
+ * @brief Component's Context structure definition.
+ */
+typedef struct
+{
+ /* Identity. */
+ uint8_t who_am_i;
+
+ /* ACTION ----------------------------------------------------------------*/
+ /* There should be only a unique identifier for each component, which */
+ /* should be the "who_am_i" parameter, hence this parameter is optional. */
+ /* -----------------------------------------------------------------------*/
+ /* Type. */
+ uint8_t type;
+
+ /* Configuration. */
+ uint8_t address;
+
+ /* Pointer to the Data. */
+ void *pData;
+
+ /* Pointer to the Virtual Table. */
+ void *pVTable;
+
+ /* ACTION ----------------------------------------------------------------*/
+ /* There should be only a unique virtual table for each component, which */
+ /* should be the "pVTable" parameter, hence this parameter is optional. */
+ /* -----------------------------------------------------------------------*/
+ /* Pointer to the Extended Virtual Table. */
+ void *pExtVTable;
+} Handle_t;
+
+/**
+ * @brief Component's Status enumerator definition.
+ */
+typedef enum
+{
+ COMPONENT_OK = 0,
+ COMPONENT_ERROR,
+ COMPONENT_TIMEOUT,
+ COMPONENT_NOT_IMPLEMENTED
+} Status_t;
+
+#endif /* __COMPONENT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Common/instrumentation_amp.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,123 @@
+/**
+ ******************************************************************************
+ * @file instrumentation_amp.h
+ * @author Central Labs
+ * @version 1.0.0
+ * @date 11-February-2016
+ * @brief Portable architecture for TSZ124
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __INSTRUMENTATION_AMP_H
+#define __INSTRUMENTATION_AMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <stdint.h>
+#include "component.h"
+
+
+/* Types ---------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup INSTRUMENTATION_AMP
+ * @{
+ */
+
+/** @defgroup INSTRUMENTATION_AMP_Exported_Types
+ * @{
+ */
+
+/**
+ * @brief INSTRUMENTATION_AMP component identifier enumerator definition.
+ */
+typedef enum
+{
+ INSTRUMENTATION_AMP_NONE_COMPONENT = 0,
+ INSTRUMENTATION_AMP_TSZ124_COMPONENT = 1
+} INSTRUMENTATION_AMP_Component_t;
+
+/**
+ * @brief INSTRUMENTATION_AMP driver virtual table structure definition.
+ */
+typedef struct
+{
+ /* ACTION ----------------------------------------------------------------*
+ * Declare here the component's generic functions. *
+ * Tag this group of functions with the " Generic " C-style comment. *
+ * A component's interface has to define at least the two generic *
+ * functions provided here below within the "Example" section, as the *
+ * first and second functions of its Virtual Table. They have to be *
+ * specified exactly in the given way. *
+ * *
+ * Example: *
+ * Status_t (*Init) (void *handle, void *init); *
+ * Status_t (*ReadID) (void *handle, uint8_t *id); *
+ *------------------------------------------------------------------------*/
+ /* Generic */
+ Status_t (*Init) (void *handle, void *init);
+ Status_t (*ReadID) (void *handle, uint8_t *id);
+
+ /* ACTION ----------------------------------------------------------------*
+ * Declare here the component's specific functions. *
+ * Tag this group of functions with the " Specific " C-style comment. *
+ * Do not specify any function if not required. *
+ * *
+ * Example: *
+ * Status_t (*GetValue) (void *handle, float *f); *
+ *------------------------------------------------------------------------*/
+ /* Specific */
+ Status_t (*GetVoltage) (void *handle, unsigned int *ptrVoltage);
+ Status_t (*GetCurrent) (void *handle, unsigned int *ptrCurrent);
+} INSTRUMENTATION_AMP_VTable_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INSTRUMENTATION_AMP_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/Component_class.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,76 @@
+/**
+ ******************************************************************************
+ * @file Component_class.h
+ * @author AST
+ * @version V1.0.0
+ * @date April 13th, 2015
+ * @brief This file contains the abstract class describing the interface of a
+ * generic component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __COMPONENT_CLASS_H
+#define __COMPONENT_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <stdint.h>
+
+
+/* Classes ------------------------------------------------------------------*/
+
+/** An abstract class for Generic components.
+ */
+class Component
+{
+public:
+ /**
+ * @brief Initializing the component.
+ * @param[in] init pointer to device specific initalization structure.
+ * @retval "0" in case of success, an error code otherwise.
+ */
+ virtual int Init(void *init) = 0;
+
+ /**
+ * @brief Getting the ID of the component.
+ * @param[out] id pointer to an allocated variable to store the ID into.
+ * @retval "0" in case of success, an error code otherwise.
+ */
+ virtual int ReadID(uint8_t *id) = 0;
+};
+
+#endif /* __COMPONENT_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/Interfaces/Instrumentation_amp_class.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,88 @@
+/**
+ ******************************************************************************
+ * @file Instrumentation_amp_class.h
+ * @author AST
+ * @version V1.0.0
+ * @date April 13th, 2015
+ * @brief This file contains the abstract class describing the interface of a
+ * instrumentation_amp component.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Revision ------------------------------------------------------------------*/
+/*
+ Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
+ Branch/Trunk/Tag: trunk
+ Based on: X-CUBE-IKA01A1/trunk/Drivers/BSP/Components/Common/instrumentation_amp.h
+ Revision: 385
+*/
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __INSTRUMENTATION_AMP_CLASS_H
+#define __INSTRUMENTATION_AMP_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include <Component_class.h>
+
+
+/* Classes ------------------------------------------------------------------*/
+
+/** An abstract class for Instrumentation_amp components.
+ */
+class Instrumentation_amp : public Component
+{
+public:
+ /* ACTION 1 --------------------------------------------------------------*
+ * Declare here the interface's methods. *
+ * They should be: *
+ * + Methods with the same name of the C component's virtual table *
+ * (and extended virtual table, if any)'s functions, provided that *
+ * the component's driver implements them (i.e.: the corresponding *
+ * pointer to function is not "0"). *
+ * *
+ * Example: *
+ * virtual int GetValue(float *f) = 0; *
+ *------------------------------------------------------------------------*/
+ virtual int GetVoltage(unsigned int *ptrVoltage) = 0;
+ virtual int GetCurrent(unsigned int *ptrCurrent) = 0;
+};
+
+#endif /* __INSTRUMENTATION_AMP_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/tsz124/tsz124.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,112 @@
+/**
+ ******************************************************************************
+ * @file tsz124.h
+ * @author Central Labs
+ * @version 1.0.0
+ * @date 11-February-2016
+ * @brief Portable architecture for TSZ124
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __TSZ124_H
+#define __TSZ124_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION --------------------------------------------------------------------*
+ * Include here interface specific header files. *
+ *----------------------------------------------------------------------------*/
+#include "../Common/instrumentation_amp.h"
+
+
+/* Definitions ---------------------------------------------------------------*/
+
+/** @addtogroup BSP
+ * @{
+ */
+
+/** @addtogroup Components
+ * @{
+ */
+
+/** @addtogroup tsz124
+ * @{
+ */
+
+/** @defgroup tsz124_Exported_Defines tsz124_Exported_Defines
+ * @{
+ */
+#ifndef NULL
+ #define NULL (void *) 0
+#endif
+
+/**
+ * @brief Device Address
+ */
+#define TSZ124_ADDRESS (0x10)
+
+/* ACTION --------------------------------------------------------------------*
+ * Put here the component's registers' addresses. *
+ *----------------------------------------------------------------------------*/
+
+/**
+ * @brief Device identification register.
+ * \code
+ * Read
+ * Default value: 0xXX
+ * 7:0 This read-only register contains the device identifier.
+ * \endcode
+*/
+#define TSZ124_WHO_AM_I_ADDR (0x11)
+
+/**
+ * @brief Device Identifier. Default value of the WHO_AM_I register.
+ */
+#define I_AM_TSZ124 ((uint8_t) (0x24))
+
+extern Status_t TSZ124_IO_Init();
+extern Status_t TSZ124_IO_Read_Pin_A1();
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* __TSZ124_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/tsz124/tsz124_class.cpp Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,87 @@
+/**
+ ******************************************************************************
+ * @file TSZ124.c
+ * @author Central Labs
+ * @version 1.0.0
+ * @date 11-February-2016
+ * @brief Portable architecture for TSZ124
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Revision ------------------------------------------------------------------*/
+/*
+ Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
+ Branch/Trunk/Tag: trunk
+ Based on: X-CUBE-IKA01A1/trunk/Drivers/BSP/Components/tsz124/tsz124.c
+ Revision: 410
+*/
+
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "tsz124_class.h"
+#include "tsz124.h"
+
+
+/* Methods -------------------------------------------------------------------*/
+
+static Status_t GetVoltage(unsigned int *ptrVoltage);
+static Status_t GetCurrent(unsigned int *ptrCurrent);
+
+/* TSZ124's private functions. */
+
+
+Status_t TSZ124::TSZ124_Init(void *init) {
+
+}
+
+Status_t TSZ124::TSZ124_ReadID(void *init) {
+
+}
+
+Status_t TSZ124::TSZ124_ConfigIT(void *init) {
+
+}
+
+static Status_t GetVoltage(unsigned int *ptrVoltage) {
+ *ptrVoltage = 10;
+}
+
+static Status_t GetCurrent(unsigned int *ptrCurrent) {
+ *ptrCurrent = 20;
+
+}
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Components/tsz124/tsz124_class.h Wed Feb 24 12:16:21 2016 +0000
@@ -0,0 +1,318 @@
+/**
+ ******************************************************************************
+ * @file TSZ124.c
+ * @author Central Labs
+ * @version 1.0.0
+ * @date 11-February-2016
+ * @brief Portable architecture for TSZ124
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ ******************************************************************************
+ */
+
+
+/* Generated with STM32CubeTOO -----------------------------------------------*/
+
+
+/* Revision ------------------------------------------------------------------*/
+/*
+ Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
+ Branch/Trunk/Tag: trunk
+ Based on: X-CUBE-IKA01A1/trunk/Drivers/BSP/Components/tsz124/tsz124.h
+ Revision: 402
+*/
+
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+
+#ifndef __TSZ124_CLASS_H
+#define __TSZ124_CLASS_H
+
+
+/* Includes ------------------------------------------------------------------*/
+
+/* ACTION 1 ------------------------------------------------------------------*
+ * Include here platform specific header files. *
+ *----------------------------------------------------------------------------*/
+#include "mbed.h"
+#include "DevI2C.h"
+/* ACTION 2 ------------------------------------------------------------------*
+ * Include here component specific header files. *
+ *----------------------------------------------------------------------------*/
+#include "tsz124.h"
+/* ACTION 3 ------------------------------------------------------------------*
+ * Include here interface specific header files. *
+ * *
+ * Example: *
+ * #include "../Interfaces/Humidity_class.h" *
+ * #include "../Interfaces/Temperature_class.h" *
+ *----------------------------------------------------------------------------*/
+#include "../Interfaces/Instrumentation_amp_class.h"
+
+
+/* Classes -------------------------------------------------------------------*/
+
+/**
+ * @brief Class representing a TSZ124 component.
+ */
+class TSZ124 : public Instrumentation_amp
+{
+public:
+
+ /*** Constructor and Destructor Methods ***/
+
+ /**
+ * @brief Constructor.
+ * @param address I2C address of the component.
+ * @param i2c I2C device to be used for communication.
+ */
+ TSZ124(uint8_t address, DevI2C &i2c) : Instrumentation_amp(), address(address), dev_i2c(i2c)
+ {
+ /* ACTION 4 ----------------------------------------------------------*
+ * Initialize here the component's member variables, one variable per *
+ * line. *
+ * *
+ * Example: *
+ * measure = 0; *
+ * instance_id = number_of_instances++; *
+ *--------------------------------------------------------------------*/
+ }
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~TSZ124(void) {}
+
+
+ /*** Public Component Related Methods ***/
+
+ /* ACTION 5 --------------------------------------------------------------*
+ * Implement here the component's public methods, as wrappers of the C *
+ * component's functions. *
+ * They should be: *
+ * + Methods with the same name of the C component's virtual table's *
+ * functions (1); *
+ * + Methods with the same name of the C component's extended virtual *
+ * table's functions, if any (2). *
+ * *
+ * Example: *
+ * virtual int GetValue(float *f) //(1) *
+ * { *
+ * return COMPONENT_GetValue(float *f); *
+ * } *
+ * *
+ * virtual int EnableFeature(void) //(2) *
+ * { *
+ * return COMPONENT_EnableFeature(); *
+ * } *
+ *------------------------------------------------------------------------*/
+ virtual int Init(void *init = NULL)
+ {
+ return (int) TSZ124_Init((void *) init);
+ }
+
+ virtual int ReadID(uint8_t *id = NULL)
+ {
+ return (int) TSZ124_ReadID((uint8_t *) id);
+ }
+
+ virtual int GetVoltage(unsigned int *ptrVoltage)
+ {
+ return (int) GetVoltage((unsigned int *) ptrVoltage);
+ }
+
+ virtual int GetCurrent(unsigned int *ptrCurrent)
+ {
+ return (int) GetCurrent((unsigned int *) ptrCurrent);
+ }
+
+
+ /*** Public Interrupt Related Methods ***/
+
+ /* ACTION 6 --------------------------------------------------------------*
+ * Implement here interrupt related methods, if any. *
+ * Note that interrupt handling is platform dependent, e.g.: *
+ * + mbed: *
+ * InterruptIn feature_irq(pin); //Interrupt object. *
+ * feature_irq.fall(callback); //Attach a callback. *
+ * feature_irq.mode(PullNone); //Set interrupt mode. *
+ * feature_irq.enable_irq(); //Enable interrupt. *
+ * feature_irq.disable_irq(); //Disable interrupt. *
+ * + Arduino: *
+ * attachInterrupt(pin, callback, RISING); //Attach a callback. *
+ * detachInterrupt(pin); //Detach a callback. *
+ * *
+ * Example (mbed): *
+ * void AttachFeatureIRQ(void (*fptr) (void)) *
+ * { *
+ * feature_irq.fall(fptr); *
+ * } *
+ * *
+ * void EnableFeatureIRQ(void) *
+ * { *
+ * feature_irq.enable_irq(); *
+ * } *
+ * *
+ * void DisableFeatureIRQ(void) *
+ * { *
+ * feature_irq.disable_irq(); *
+ * } *
+ *------------------------------------------------------------------------*/
+
+
+protected:
+
+ /*** Protected Component Related Methods ***/
+
+ /* ACTION 7 --------------------------------------------------------------*
+ * Declare here the component's specific methods. *
+ * They should be: *
+ * + Methods with the same name of the C component's virtual table's *
+ * functions (1); *
+ * + Methods with the same name of the C component's extended virtual *
+ * table's functions, if any (2); *
+ * + Helper methods, if any, like functions declared in the component's *
+ * source files but not pointed by the component's virtual table (3). *
+ * *
+ * Example: *
+ * Status_t COMPONENT_GetValue(float *f); //(1) *
+ * Status_t COMPONENT_EnableFeature(void); //(2) *
+ * Status_t COMPONENT_ComputeAverage(void); //(3) *
+ *------------------------------------------------------------------------*/
+ /* TSZ124's generic functions. */
+ Status_t TSZ124_Init(void *init);
+ Status_t TSZ124_ReadID(void *id);
+
+ /* TSZ124's interrupts related functions. */
+ Status_t TSZ124_ConfigIT(void* a);
+
+
+ /*** Component's I/O Methods ***/
+
+ /**
+ * @brief Utility function to read data from TSZ124.
+ * @param[out] pBuffer pointer to the buffer to read data into.
+ * @param[in] RegisterAddr specifies the internal address register to read from.
+ * @param[in] NumBytesToRead number of bytes to read.
+ * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
+ */
+ Status_t Read(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumBytesToRead)
+ {
+ if (dev_i2c.i2c_read(pBuffer, address, RegisterAddr, NumBytesToRead) != 0)
+ return COMPONENT_ERROR;
+ return COMPONENT_OK;
+ }
+
+ /**
+ * @brief Utility function to write data to TSZ124.
+ * @param[in] pBuffer pointer to the buffer of data to send.
+ * @param[in] RegisterAddr specifies the internal address register to write to.
+ * @param[in] NumBytesToWrite number of bytes to write.
+ * @retval COMPONENT_OK in case of success, COMPONENT_ERROR otherwise.
+ */
+ Status_t Write(uint8_t* pBuffer, uint8_t RegisterAddr, uint16_t NumBytesToWrite)
+ {
+ if (dev_i2c.i2c_write(pBuffer, address, RegisterAddr, NumBytesToWrite) != 0)
+ return COMPONENT_ERROR;
+ return COMPONENT_OK;
+ }
+
+ /* ACTION 8 --------------------------------------------------------------*
+ * Implement here other I/O methods beyond those already implemented *
+ * above, which are declared extern within the component's header file. *
+ *------------------------------------------------------------------------*/
+ Status_t TSZ124_IO_Init(void *init = NULL)
+ {
+ /* TO BE IMPLEMENTED BY USING TARGET PLATFORM'S APIs. */
+ return (Status_t) 0;
+ }
+
+ Status_t TSZ124_IO_Read_Pin_A1(void *init = NULL)
+ {
+ /* TO BE IMPLEMENTED BY USING TARGET PLATFORM'S APIs. */
+ return (Status_t) 0;
+ }
+
+
+ /*** Component's Instance Variables ***/
+
+ /* ACTION 9 --------------------------------------------------------------*
+ * Declare here interrupt related variables, if needed. *
+ * Note that interrupt handling is platform dependent, see *
+ * "Interrupt Related Methods" above. *
+ * *
+ * Example: *
+ * + mbed: *
+ * InterruptIn feature_irq; *
+ *------------------------------------------------------------------------*/
+
+ /* ACTION 10 -------------------------------------------------------------*
+ * Declare here other pin related variables, if needed. *
+ * *
+ * Example: *
+ * + mbed: *
+ * DigitalOut standby_reset; *
+ *------------------------------------------------------------------------*/
+
+ /* ACTION 11 -------------------------------------------------------------*
+ * Declare here communication related variables, if needed. *
+ * *
+ * Example: *
+ * + mbed: *
+ * DigitalOut address; *
+ * DevI2C &dev_i2c; *
+ *------------------------------------------------------------------------*/
+ /* Configuration. */
+ uint8_t address;
+
+ /* IO Device. */
+ DevI2C &dev_i2c;
+
+ /* ACTION 12 -------------------------------------------------------------*
+ * Declare here identity related variables, if needed. *
+ * Note that there should be only a unique identifier for each component, *
+ * which should be the "who_am_i" parameter. *
+ *------------------------------------------------------------------------*/
+ /* Identity */
+ uint8_t who_am_i;
+
+ /* ACTION 13 -------------------------------------------------------------*
+ * Declare here the component's static and non-static data, one variable *
+ * per line. *
+ * *
+ * Example: *
+ * float measure; *
+ * int instance_id; *
+ * static int number_of_instances; *
+ *------------------------------------------------------------------------*/
+};
+
+#endif /* __TSZ124_CLASS_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/X_NUCLEO_COMMON.lib Wed Feb 24 12:16:21 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/ST/code/X_NUCLEO_COMMON/#216930edb6b7

X-NUCLEO-IKA01A1 Multifunctional board based on operational amplifiers.