SOFT564Z Group 3 / Mbed 2 deprecated SOFT564Z_Group_3v3

Dependencies:   mbed Servo ros_lib_kinetic

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers power.cpp Source File

power.cpp

00001 /*--------------------------------------------------------------------------------
00002 Filename: power.cpp
00003 Description: Power management source code
00004 --------------------------------------------------------------------------------*/
00005 
00006 #include "mbed.h"
00007 #include "power.h"
00008 
00009 /*--------------------------------------------------------------------------------
00010 Function name: cAdafruit_VL6180X
00011 Input Parameters: N/A
00012 Output Parameters: N/A
00013 Description: Class constructor (Initialisation upon creating class)
00014 ----------------------------------------------------------------------------------*/
00015 cPower::cPower(AnalogIn vbatt, AnalogIn fiveVolts, AnalogIn threeVolts) : _vbatt(vbatt), _5v0(fiveVolts), _3v3(threeVolts)
00016 {
00017     
00018 }
00019 
00020 /*--------------------------------------------------------------------------------
00021 Function name: WriteByte(wchar_t reg,char data)
00022 Input Parameters: reg - the register of the data to write, data - the data to send
00023 Output Parameters: N/A
00024 Description: Writes a single byte to a specified address using the I2C libraries
00025 ----------------------------------------------------------------------------------*/
00026 float cPower::monitor_battery()
00027 {
00028     float tempPower;
00029     tempPower = _vbatt * 2.0f * 3.3f; //Scales to account for the potential divider
00030     return tempPower;
00031 }
00032 
00033 float cPower::monitor_5v_line()
00034 {
00035     float tempPower;
00036     tempPower = _5v0 * 3.0f * 3.3f; //Scales to account for the potential divider
00037     return tempPower;
00038 }
00039 
00040 float cPower::monitor_3v3_line()
00041 {
00042     float tempPower;
00043     tempPower = _3v3 * 2.0f * 3.3f; //Scales to account for the potential divider
00044     return tempPower;
00045 }