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/tsu104/tsu104_class.h
- Revision:
- 14:8277ca0ab13a
- Parent:
- 13:9cecc8d66cc1
- Child:
- 15:114514787e83
--- a/Components/tsu104/tsu104_class.h Thu Apr 07 07:51:13 2016 +0000
+++ b/Components/tsu104/tsu104_class.h Fri Apr 08 05:30:21 2016 +0000
@@ -90,16 +90,11 @@
/**
* @brief Constructor.
*/
- TSU104(void) : Windcomp()
+ TSU104(PinName photoSensorPin, PinName windCmpSignalPin_1,PinName windCmpSignalPin_2) : Windcomp()
{
- /* ACTION 4 ----------------------------------------------------------*
- * Initialize here the component's member variables, one variable per *
- * line. *
- * *
- * Example: *
- * measure = 0; *
- * instance_id = number_of_instances++; *
- *--------------------------------------------------------------------*/
+ photo_sensor_pin = photoSensorPin;
+ windCmp_signal_pin_1 = windCmpSignalPin_1;
+ windCmp_signal_pin_2 = windCmpSignalPin_2;
}
/**
@@ -134,7 +129,7 @@
*/
virtual unsigned int TSU104_WindComp_Get_D2(void)
{
- DigitalIn windowsCompD2(D2);
+ DigitalIn windowsCompD2(windCmp_signal_pin_1);
return windowsCompD2.read();
}
@@ -144,7 +139,7 @@
*/
virtual unsigned int TSU104_WindComp_Get_D4(void)
{
- DigitalIn windowsCompD4(D4);
+ DigitalIn windowsCompD4(windCmp_signal_pin_2);
return windowsCompD4.read();
}
@@ -154,9 +149,9 @@
* @param pin AnalogIn pin to use for detecting the voltage
* @retval voltage detected by photo sensor
*/
- virtual unsigned int TSU104_PhotoSensor_GetVoltage(PinName pin)
+ virtual unsigned int TSU104_PhotoSensor_GetVoltage(void)
{
- AnalogIn photoSensor(pin);
+ AnalogIn photoSensor(photo_sensor_pin);
double voltage = photoSensor.read();
voltage = voltage*3.3*1000.0; // voltage in mV
return voltage;
@@ -200,6 +195,21 @@
/*** Protected Component Related Methods ***/
+ /**
+ * arduino pin for photosensor output voltage
+ */
+ PinName photo_sensor_pin;
+
+ /**
+ * arduino pin for signal 1 of windows comparator configuration
+ */
+ PinName windCmp_signal_pin_1;
+
+ /**
+ * arduino pin for signal 1 of windows comparator configuration
+ */
+ PinName windCmp_signal_pin_2;
+
/* ACTION 7 --------------------------------------------------------------*
* Declare here the component's specific methods. *
* They should be: *

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