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.
Diff: Components/tsz124/tsz124_class.h
- Revision:
- 21:8d0624950dd1
- Parent:
- 20:169bdc228a7b
--- 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 ***/

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