Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWorld_IKA01A1
Fork of X_NUCLEO_IKA01A1 by
Library for STMicroelectronics' X-NUCLEO-IKA01A1 multifunctional expansion board based on operational amplifiers.
Revision 21:8d0624950dd1, committed 2016-04-13
- Comitter:
- hemddabral
- Date:
- Wed Apr 13 06:21:46 2016 +0000
- Parent:
- 20:169bdc228a7b
- Child:
- 22:ff8d071bf79e
- Commit message:
- updated TSZ124 class, and simplified method names in WindComp and PhotoSensor configurations.
Changed in this revision
--- a/Components/Common/photosensor.h Mon Apr 11 07:32:53 2016 +0000
+++ b/Components/Common/photosensor.h Wed Apr 13 06:21:46 2016 +0000
@@ -109,7 +109,7 @@
* Status_t (*GetValue) (void *handle, float *f); *
*------------------------------------------------------------------------*/
/* Specific */
- unsigned int (*Get_PhotoSensor_GetVoltage) (void *handle);
+ unsigned int (*GetGetVoltage) (void *handle);
} WINDCOMP_VTable_t;
#ifdef __cplusplus
--- a/Components/Common/windcomp.h Mon Apr 11 07:32:53 2016 +0000
+++ b/Components/Common/windcomp.h Wed Apr 13 06:21:46 2016 +0000
@@ -109,8 +109,8 @@
* Status_t (*GetValue) (void *handle, float *f); *
*------------------------------------------------------------------------*/
/* Specific */
- unsigned int (*WindComp_Get_Signal1) (void *handle);
- unsigned int (*WindComp_Get_Signal2) (void *handle);
+ unsigned int (*GetSignal1) (void *handle);
+ unsigned int (*GetSignal2) (void *handle);
} WINDCOMP_VTable_t;
#ifdef __cplusplus
--- a/Components/Interfaces/PhotoSensor_class.h Mon Apr 11 07:32:53 2016 +0000
+++ b/Components/Interfaces/PhotoSensor_class.h Wed Apr 13 06:21:46 2016 +0000
@@ -84,7 +84,7 @@
* @param pin AnalogIn pin to use for detecting the voltage
* @retval voltage detected by photo sensor
*/
- virtual unsigned int Get_PhotoSensor_GetVoltage(void) = 0;
+ virtual unsigned int GetVoltage(void) = 0;
};
#endif /* __PHOTO_SENSOR_CLASS_H */
--- a/Components/Interfaces/Windcomp_class.h Mon Apr 11 07:32:53 2016 +0000 +++ b/Components/Interfaces/Windcomp_class.h Wed Apr 13 06:21:46 2016 +0000 @@ -83,13 +83,13 @@ * @brief abstract method for obtaining digital signal value 1 in windows comparator configuration * @retval digital signal value 1 */ - virtual unsigned int WindComp_Get_Signal1(void) = 0; + virtual unsigned int GetSignal1(void) = 0; /** * @brief abstract method for obtaining digital signal value 2 in windows comparator configuration * @retval digital signal value 2 */ - virtual unsigned int WindComp_Get_Signal2(void) = 0;}; + virtual unsigned int GetSignal2(void) = 0;}; #endif /* __WINDCOMP_CLASS_H */
--- a/Components/tsu104/tsu104_class.h Mon Apr 11 07:32:53 2016 +0000
+++ b/Components/tsu104/tsu104_class.h Wed Apr 13 06:21:46 2016 +0000
@@ -128,7 +128,7 @@
* @brief get digital signal value 1 in windows comparator configuration
* @retval digital signal value 1
*/
- virtual unsigned int WindComp_Get_Signal1(void)
+ virtual unsigned int GetSignal1(void)
{
DigitalIn windowsCompD2(windCmp_signal_pin_1);
return windowsCompD2.read();
@@ -138,7 +138,7 @@
* @brief get digital signal value 2 in windows comparator configuration
* @retval digital signal value 2
*/
- virtual unsigned int WindComp_Get_Signal2(void)
+ virtual unsigned int GetSignal2(void)
{
DigitalIn windowsCompD4(windCmp_signal_pin_2);
return windowsCompD4.read();
@@ -150,7 +150,7 @@
* @param pin AnalogIn pin to use for detecting the voltage
* @retval voltage detected by photo sensor
*/
- virtual unsigned int Get_PhotoSensor_GetVoltage(void)
+ virtual unsigned int GetVoltage(void)
{
AnalogIn photoSensor(photo_sensor_pin);
double voltage = photoSensor.read();
--- a/Components/tsz124/tsz124_class.h Mon Apr 11 07:32:53 2016 +0000
+++ b/Components/tsz124/tsz124_class.h Wed Apr 13 06:21:46 2016 +0000
@@ -89,16 +89,10 @@
/**
* @brief Constructor.
*/
- TSZ124(void) : Instrumentation_amp()
+ TSZ124(PinName instrumentAmpPin, PinName currentSensorPin) : Instrumentation_amp()
{
- /* ACTION 4 ----------------------------------------------------------*
- * Initialize here the component's member variables, one variable per *
- * line. *
- * *
- * Example: *
- * measure = 0; *
- * instance_id = number_of_instances++; *
- *--------------------------------------------------------------------*/
+ instrAmpPin = instrumentAmpPin;
+ currentSensPin = currentSensorPin;
}
/**
@@ -136,7 +130,7 @@
virtual unsigned int GetVoltage(void)
{
const unsigned int ADC_RANGE_12_BIT = 0xFFF;
- AnalogIn ain(X_NUCLEO_IKA01A1_PIN_INSTRUMENTATION_AMP);
+ AnalogIn ain(instrAmpPin);
return ((double)ain.read())*805.0*ADC_RANGE_12_BIT/1000.0;
}
@@ -147,7 +141,7 @@
virtual unsigned int GetCurrent(void)
{
const unsigned int ADC_RANGE_12_BIT = 0xFFF;
- AnalogIn ain(X_NUCLEO_IKA01A1_PIN_CURRENT_SENSING);
+ AnalogIn ain(currentSensPin);
return ((double)ain.read())*1000.0*805.0*ADC_RANGE_12_BIT/1000.0/1586.0;
}
@@ -207,6 +201,8 @@
/* TSZ124's generic functions. */
Status_t TSZ124_Init(void *init);
unsigned int TSZ124_ReadID(void *id);
+ PinName instrAmpPin;
+ PinName currentSensPin;
/*** Component's Instance Variables ***/
--- a/x_nucleo_ika01a1_class.cpp Mon Apr 11 07:32:53 2016 +0000
+++ b/x_nucleo_ika01a1_class.cpp Wed Apr 13 06:21:46 2016 +0000
@@ -62,8 +62,13 @@
/**
* @brief Constructor.
*/
-X_NUCLEO_IKA01A1::X_NUCLEO_IKA01A1(PinName photoSensorPin, PinName windCmpSignalPin_1,PinName windCmpSignalPin_2,
- PinName ledDriverPin, double ledDriverPeriod_us)
+X_NUCLEO_IKA01A1::X_NUCLEO_IKA01A1(PinName instrumentAmpPin,
+ PinName currentSensorPin,
+ PinName photoSensorPin,
+ PinName windCmpSignalPin_1,
+ PinName windCmpSignalPin_2,
+ PinName ledDriverPin,
+ double ledDriverPeriod_us)
{
/* Instantiating the components. */
@@ -74,7 +79,7 @@
* component_1 = new COMPONENT_1(); *
* component_2 = new COMPONENT_2(); *
*------------------------------------------------------------------------*/
- tsz124 = new TSZ124();
+ tsz124 = new TSZ124(instrumentAmpPin, currentSensorPin);
tsu104 = new TSU104(photoSensorPin, windCmpSignalPin_1, windCmpSignalPin_2);
tsv734 = new TSV734(ledDriverPin, ledDriverPeriod_us);
}
@@ -83,13 +88,18 @@
* @brief Getting a singleton instance of X_NUCLEO_IKA01A1 class.
* @retval a singleton instance of X_NUCLEO_IKA01A1 class.
*/
-X_NUCLEO_IKA01A1 *X_NUCLEO_IKA01A1::Instance(PinName photoSensorPin, PinName windCmpSignalPin_1,PinName windCmpSignalPin_2,
- PinName ledDriverPin, double ledDriverPeriod_us)
+X_NUCLEO_IKA01A1 *X_NUCLEO_IKA01A1::Instance(PinName instrumentAmpPin,
+ PinName currentSensorPin,
+ PinName photoSensorPin,
+ PinName windCmpSignalPin_1,
+ PinName windCmpSignalPin_2,
+ PinName ledDriverPin,
+ double ledDriverPeriod_us)
{
if (_instance == NULL)
{
/* Instantiating the board. */
- _instance = new X_NUCLEO_IKA01A1(photoSensorPin, windCmpSignalPin_1, windCmpSignalPin_2, ledDriverPin, ledDriverPeriod_us);
+ _instance = new X_NUCLEO_IKA01A1(instrumentAmpPin, currentSensorPin, photoSensorPin, windCmpSignalPin_1, windCmpSignalPin_2, ledDriverPin, ledDriverPeriod_us);
/* Initializing the components. */
if (!_instance->Init())
--- a/x_nucleo_ika01a1_class.h Mon Apr 11 07:32:53 2016 +0000 +++ b/x_nucleo_ika01a1_class.h Wed Apr 13 06:21:46 2016 +0000 @@ -94,8 +94,8 @@ * @brief Getting a singleton instance of X_NUCLEO_IKA01A1 class. * @retval a singleton instance of X_NUCLEO_IKA01A1 class. */ - static X_NUCLEO_IKA01A1 *Instance(PinName photoSensorPin, PinName windCmpSignalPin_1,PinName windCmpSignalPin_2, - PinName ledDriverPin, double ledDriverPeriod_us); + static X_NUCLEO_IKA01A1 *Instance(PinName instrumentAmpPin, PinName currentSensorPin, PinName photoSensorPin, PinName windCmpSignalPin_1, + PinName windCmpSignalPin_2, PinName ledDriverPin, double ledDriverPeriod_us); /** * @brief Initialize the singleton's operational amplifiers to default settings @@ -133,8 +133,8 @@ /** * @brief Constructor. */ - X_NUCLEO_IKA01A1(PinName photoSensorPin, PinName windCmpSignalPin_1,PinName windCmpSignalPin_2, - PinName ledDriverPin, double ledDriverPeriod_us); + X_NUCLEO_IKA01A1(PinName instrumentAmpPin, PinName currentSensorPin, PinName photoSensorPin, PinName windCmpSignalPin_1, + PinName windCmpSignalPin_2, PinName ledDriverPin, double ledDriverPeriod_us); /*** Protected Expansion Board Related Initialization Methods ***/

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