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.
Diff: driverLifiRx.cpp
- Revision:
- 5:5fe30df87772
- Parent:
- 4:3ec60ea204c6
- Parent:
- 3:ae1f53883bc0
- Child:
- 21:82b5759f5047
--- a/driverLifiRx.cpp Thu Apr 04 14:36:31 2019 +0900 +++ b/driverLifiRx.cpp Thu Apr 04 14:48:04 2019 +0900 @@ -72,6 +72,7 @@ //the curve from datasheet seems y=2x+0, so lux = 2 * I[uA] = 2 * 100 * V[V/ohm] return 2*(100*vol); } + float meas_v1_max=0; float meas_v1_min=3300; float meas_v2_max=0; @@ -80,6 +81,7 @@ float meas_v3_min=3300; float meas_v4_max=0; float meas_v4_min=3300; + void LifiRx_PdTunning() { float meas_r1; @@ -90,6 +92,7 @@ float meas_v3; float meas_r4; float meas_v4; + meas_v1_max=0; meas_v1_min=3300; meas_v2_max=0; @@ -124,6 +127,7 @@ meas_v3 = meas_r3 * 3300; // Converts value in the 0V-3.3V range meas_r4 = adc_4.read(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range) meas_v4 = meas_r4 * 3300; // Converts value in the 0V-3.3V range + if( meas_v1_min > meas_v1 ) meas_v1_min = meas_v1; if( meas_v1_max < meas_v1 ) meas_v1_max = meas_v1; if( meas_v2_min > meas_v2 ) meas_v2_min = meas_v2; @@ -132,6 +136,7 @@ if( meas_v3_max < meas_v3 ) meas_v3_max = meas_v3; if( meas_v4_min > meas_v4 ) meas_v4_min = meas_v4; if( meas_v4_max < meas_v4 ) meas_v4_max = meas_v4; + // Display values printf("measure 1 = %f = %4.0f mV = %5.0f uA = %5.0f lux delta = %5.0f \n", meas_r1, meas_v1, meas_v1/10.0, meas_v1/5.0, meas_v1_max - meas_v1_min); printf("measure 2 = %f = %4.0f mV = %5.0f uA = %5.0f lux delta = %5.0f \n", meas_r2, meas_v2, meas_v2/10.0, meas_v2/5.0, meas_v2_max - meas_v2_min); @@ -142,6 +147,7 @@ } } + int LifiRx_AdcRead(int num) { //floor(x) - round down @@ -225,6 +231,7 @@ LifiRx_LoopOOK(); //printf("4"); //wait_ms(50); + } }