Skip to content

Commit

Permalink
Merge pull request #1 from cparata/master
Browse files Browse the repository at this point in the history
First release for X-NUCLEO-IKA01A1
  • Loading branch information
cparata committed Nov 23, 2017
2 parents a8f1aa9 + c34cce7 commit e3bd6e2
Show file tree
Hide file tree
Showing 27 changed files with 3,190 additions and 1 deletion.
23 changes: 23 additions & 0 deletions LICENSE.md
@@ -0,0 +1,23 @@
COPYRIGHT(c) 2017 STMicroelectronics

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.
42 changes: 41 additions & 1 deletion README.md
@@ -1,2 +1,42 @@
# X-NUCLEO-IKA01A1
Arduino library to support multi-functional expansion board based on operational amplifiers

Multifunctional expansion board based on operational amplifiers.
The X-NUCLEO-IKA01A1 is a multifunctional expansion board based on STMicroelectronics operational amplifiers.
It provides an affordable and easy-to-use solution for various use cases with your STM32 Nucleo board.
The X-NUCLEO-IKA01A1 is compatible with the Arduino™ UNO R3 connector, and supports the addition of other boards
that can be stacked for enhanced applications with an STM32 Nucleo board. It can be used as an analog front-end
by conditioning signals as actuator to drive LEDs or coils, or in a comparator architecture.
Thanks to its current-sensing configuration, it allows current measurement of any device that has a Micro-USB port.
A highly accurate TSZ124 Micropower operational amplifier is used for this configuration as well as for that of
the instrumentation amplifier. The expansion board also contains a TSU104 Nanopower op-amp and a TSV734 Micropower
op-amp for mobile applications.

Key Features:
* 7 predefined configurations:
* Instrumentation amplifier structure
* Current sensing with or without USB
* Photodiode/ultraviolet (UV) current sensing
* Buffer
* Full wave rectifier
* Constant current LED driver
* Window comparator
* One prototyping area
* Compatible with STM32 Nucleo boards
* Comprehensive free development firmware library (X-CUBE-ANALOG1)
* Powered through the Arduino UNO connectors
* RoHS compliant

# Examples

* X_NUCLEO_IKA01A1_HelloWorld: This application provides a simple example of usage of the X-NUCLEO-IKA01A1

## Documentation

You can find the source files at
https://github.com/stm32duino/X-NUCLEO-IKA01A1

The TSU104 datasheet is available at
http://www.st.com/content/st_com/en/products/amplifiers-and-comparators/operational-amplifiers-op-amps/precision-op-amps-lt50-mhz/low-power-op-amps-lt1-ma/tsu104.htm

The TSV734 datasheet is available at
http://www.st.com/content/st_com/en/products/amplifiers-and-comparators/operational-amplifiers-op-amps/precision-op-amps-lt50-mhz/low-power-op-amps-lt1-ma/tsv734.html
120 changes: 120 additions & 0 deletions examples/X_NUCLEO_IKA01A1_HelloWorld/X_NUCLEO_IKA01A1_HelloWorld.ino
@@ -0,0 +1,120 @@
/**
******************************************************************************
* @file X_NUCLEO_IKA01A1_HelloWorld.ino
* @author STMicroelectronics
* @version V1.0.0
* @date October 17h, 2017
* @brief Arduino test application for the STMicroelectronics X-NUCLEO-IKA01A1
* Analog expansion board.
******************************************************************************
* @attention
*
* <h2><center>&copy; 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.
*
******************************************************************************
*/


/* Includes ------------------------------------------------------------------*/

/* Arduino specific header files. */
#include "Arduino.h"

/* Board specific header files. */
#include "XNucleoIKA01A1.h"

#define SerialPort Serial

/* Variables -----------------------------------------------------------------*/

TSZ124 *instr_amp;
TSU104 *photo_sensor_wind_comp;
TSV734 *led_driver;
double duty_cycle;


/* Functions -----------------------------------------------------------------*/

/**
* @brief Initialization.
* @param None.
* @retval None.
*/
void setup()
{
/* Printing to the console. */
SerialPort.begin(115200);
SerialPort.print("Analog Application Example\r\n\n");

/* Initializing Analog Expansion Board. */
XNucleoIKA01A1 *analog_expansion_board = XNucleoIKA01A1::instance(
X_NUCLEO_IKA01A1_PIN_INSTRUMENTATION_AMP,
X_NUCLEO_IKA01A1_PIN_CURRENT_SENSING,
X_NUCLEO_IKA01A1_PIN_PHOTO_SENSOR,
X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_1,
X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_2,
X_NUCLEO_IKA01A1_PIN_PWM_LED_DRIVER_OUTPUT);
analog_expansion_board->init();
instr_amp = analog_expansion_board->tsz124;
photo_sensor_wind_comp = analog_expansion_board->tsu104;
led_driver = analog_expansion_board->tsv734;
duty_cycle = 0;
}

/**
* @brief Main loop.
* @param None.
* @retval None.
*/
void loop()
{
unsigned int op_amp_voltage = instr_amp->get_voltage();
unsigned int op_amp_current = instr_amp->get_current();
unsigned int photo_sensor_voltage = photo_sensor_wind_comp->get_voltage();
unsigned int wind_com_pin1 = photo_sensor_wind_comp->get_signal1();
unsigned int wind_com_pin2 = photo_sensor_wind_comp->get_signal2();

SerialPort.print("\r\nOpAmp measured Voltage(mV): ");
SerialPort.print(op_amp_voltage);
SerialPort.print("\r\nOpAmp measured Current(mA): ");
SerialPort.print(op_amp_current);
SerialPort.print("\r\nPhotodiode sensor output voltage(mV): ");
SerialPort.print(photo_sensor_voltage);
SerialPort.print("\r\nWindows comparator: signal 1 value(pin D2): ");
SerialPort.print(wind_com_pin1);
SerialPort.print("\r\nWindows comparator: signal 1 value(pin D4): ");
SerialPort.print(wind_com_pin2);
SerialPort.print("\r\nLED Driver: duty cycle: ");
SerialPort.print(led_driver->set_duty_cycle(duty_cycle));
SerialPort.print(" %%\r\n");

duty_cycle += 0.1;
if (duty_cycle >= 1) {
duty_cycle = 0;
}

delay(1000);
}

25 changes: 25 additions & 0 deletions keywords.txt
@@ -0,0 +1,25 @@
#######################################
# Syntax Coloring Map For x_nucleo_ika01a1
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################
TSZ124 KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################
TSZ124 KEYWORD2
Init KEYWORD2
ReadID KEYWORD2
GetVoltage KEYWORD2
GetCurrent KEYWORD2

#######################################
# Constants (LITERAL1)
#######################################
NULL LITERAL1
TSZ124_ADDRESS LITERAL1
TSZ124_WHO_AM_I_ADDR LITERAL1
I_AM_TSZ124 LITERAL1
9 changes: 9 additions & 0 deletions library.properties
@@ -0,0 +1,9 @@
name=STM32duino X-NUCLEO-IKA01A1
version=1.0.0
author=STMicroelectronics
maintainer=stm32duino
sentence=Allows controlling the ST Microelectronics X-NUCLEO-IKA01A1 Expansion Board
paragraph=This library provides the drivers and a sample application to control ST X-NUCLEO-IKA01A1 expansion board
category=Device Control
url=https://github.com/stm32duino/X-NUCLEO-IKA01A1
architectures=stm32
82 changes: 82 additions & 0 deletions src/Component.h
@@ -0,0 +1,82 @@
/**
******************************************************************************
* @file Component.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>&copy; 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 read_id(uint8_t *id) = 0;

/**
* @brief Destructor.
*/
virtual ~Component() {};
};

#endif /* __COMPONENT_CLASS_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 comments on commit e3bd6e2

Please sign in to comment.