
with the tof code
Dependencies: mbed Servo ros_lib_kinetic
Power/power.cpp@9:326b8f261ef0, 2020-01-04 (annotated)
- Committer:
- Alexshawcroft
- Date:
- Sat Jan 04 21:35:25 2020 +0000
- Revision:
- 9:326b8f261ef0
- Parent:
- 4:36a04230554d
oh
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Stumi | 4:36a04230554d | 1 | /*-------------------------------------------------------------------------------- |
Stumi | 4:36a04230554d | 2 | Filename: power.cpp |
Stumi | 4:36a04230554d | 3 | Description: Power management source code |
Stumi | 4:36a04230554d | 4 | --------------------------------------------------------------------------------*/ |
Stumi | 4:36a04230554d | 5 | |
Stumi | 4:36a04230554d | 6 | #include "mbed.h" |
Stumi | 4:36a04230554d | 7 | #include "power.h" |
Stumi | 4:36a04230554d | 8 | |
Stumi | 4:36a04230554d | 9 | /*-------------------------------------------------------------------------------- |
Stumi | 4:36a04230554d | 10 | Function name: cAdafruit_VL6180X |
Stumi | 4:36a04230554d | 11 | Input Parameters: N/A |
Stumi | 4:36a04230554d | 12 | Output Parameters: N/A |
Stumi | 4:36a04230554d | 13 | Description: Class constructor (Initialisation upon creating class) |
Stumi | 4:36a04230554d | 14 | ----------------------------------------------------------------------------------*/ |
Stumi | 4:36a04230554d | 15 | cPower::cPower(AnalogIn vbatt, AnalogIn fiveVolts, AnalogIn threeVolts) : _vbatt(vbatt), _5v0(fiveVolts), _3v3(threeVolts) |
Stumi | 4:36a04230554d | 16 | { |
Stumi | 4:36a04230554d | 17 | |
Stumi | 4:36a04230554d | 18 | } |
Stumi | 4:36a04230554d | 19 | |
Stumi | 4:36a04230554d | 20 | /*-------------------------------------------------------------------------------- |
Stumi | 4:36a04230554d | 21 | Function name: WriteByte(wchar_t reg,char data) |
Stumi | 4:36a04230554d | 22 | Input Parameters: reg - the register of the data to write, data - the data to send |
Stumi | 4:36a04230554d | 23 | Output Parameters: N/A |
Stumi | 4:36a04230554d | 24 | Description: Writes a single byte to a specified address using the I2C libraries |
Stumi | 4:36a04230554d | 25 | ----------------------------------------------------------------------------------*/ |
Stumi | 4:36a04230554d | 26 | float cPower::monitor_battery() |
Stumi | 4:36a04230554d | 27 | { |
Stumi | 4:36a04230554d | 28 | float tempPower; |
Stumi | 4:36a04230554d | 29 | tempPower = _vbatt * 2.0f * 3.3f; //Scales to account for the potential divider |
Stumi | 4:36a04230554d | 30 | return tempPower; |
Stumi | 4:36a04230554d | 31 | } |
Stumi | 4:36a04230554d | 32 | |
Stumi | 4:36a04230554d | 33 | float cPower::monitor_5v_line() |
Stumi | 4:36a04230554d | 34 | { |
Stumi | 4:36a04230554d | 35 | float tempPower; |
Stumi | 4:36a04230554d | 36 | tempPower = _5v0 * 3.0f * 3.3f; //Scales to account for the potential divider |
Stumi | 4:36a04230554d | 37 | return tempPower; |
Stumi | 4:36a04230554d | 38 | } |
Stumi | 4:36a04230554d | 39 | |
Stumi | 4:36a04230554d | 40 | float cPower::monitor_3v3_line() |
Stumi | 4:36a04230554d | 41 | { |
Stumi | 4:36a04230554d | 42 | float tempPower; |
Stumi | 4:36a04230554d | 43 | tempPower = _3v3 * 2.0f * 3.3f; //Scales to account for the potential divider |
Stumi | 4:36a04230554d | 44 | return tempPower; |
Stumi | 4:36a04230554d | 45 | } |