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.
Dependencies: mbed
Diff: src/adc.cpp
- Revision:
- 12:fd1fd1857628
- Parent:
- 11:01dcfb29fbc4
- Child:
- 17:454afe56eedb
--- a/src/adc.cpp Fri Dec 07 20:42:41 2018 +0000 +++ b/src/adc.cpp Sat Dec 08 01:53:36 2018 +0000 @@ -52,10 +52,10 @@ for(unsigned int i=0;i<loopCounter;i++){ v48x = v48x + VIN48.read_u16(); + i48x = i48x + IIN48.read_u16(); v24x = v24x + VIN24.read_u16(); + i24x = i24x + IIN24.read_u16(); v12x = v12x + VIN12.read_u16(); - i48x = i48x + IIN48.read_u16(); - i24x = i24x + IIN24.read_u16(); i12x = i12x + IIN12.read_u16(); } avals.v48 = v48x/loopCounter; @@ -125,11 +125,11 @@ dvals.v48f = VOLTAGE_48_FACTOR*avals.v48; dvals.v24f = VOLTAGE_24_FACTOR*avals.v24; dvals.v12f = VOLTAGE_12_FACTOR*avals.v12; - dvals.i48f = (avals.i48-CURRENT_48_OFFSET)/CURRENT_48_DIV_FACTOR; + dvals.i48f = ((avals.i48-CURRENT_48_OFFSET)/CURRENT_48_DIV_FACTOR)-CURRENT_CONTROL_OFFSET; dvals.i24f = (avals.i24-CURRENT_24_OFFSET)/CURRENT_24_DIV_FACTOR; dvals.i12f = (avals.i12-CURRENT_12_OFFSET)/CURRENT_12_DIV_FACTOR; }else{ - dvals.v48f = 1.0*avals.v48; + dvals.v48f = 1.0*avals.v48-CURRENT_CONTROL_OFFSET; dvals.v24f = 1.0*avals.v24; dvals.v12f = 1.0*avals.v12; dvals.i48f = 1.0*avals.i48;