| ||||||
Files | |
| file | mindsensors-powermeter.h |
Mindsensors Power Meter Sensor. | |
Defines | |
| #define | MSPM_I2C_ADDR 0x12 |
| #define | MSPM_CMD_REG 0x41 |
| #define | MSPM_PCURRENT 0x42 |
| #define | MSPM_PVOLTAGE 0x44 |
| #define | MSPM_CAPUSED 0x46 |
| #define | MSPM_TIME 0x56 |
Functions | |
| int | MSPMreadCurrent (tSensors link, ubyte address=MSPM_I2C_ADDR) |
| int | MSPMreadVoltage (tSensors link, ubyte address=MSPM_I2C_ADDR) |
| bool | MSPMreadVoltageCurrent (tSensors link, int &voltage, int ¤t, ubyte address=MSPM_I2C_ADDR) |
| long | MSPMreadTime (tSensors link, ubyte address=MSPM_I2C_ADDR) |
| bool | MSPMresetCounters (tSensors link, ubyte address=MSPM_I2C_ADDR) |
| bool | _MSPMsendCommand (tSensors link, byte command, ubyte address) |
Variables | |
| tByteArray | MSPM_I2CRequest |
| tByteArray | MSPM_I2CReply |
Power Meter Sensor
| #define MSPM_CAPUSED 0x46 |
Capacity used since last reset in mAh - 2 bytes
Definition at line 50 of file mindsensors-powermeter.h.
| #define MSPM_CMD_REG 0x41 |
Register used for issuing commands
Definition at line 46 of file mindsensors-powermeter.h.
| #define MSPM_I2C_ADDR 0x12 |
I2C address used by the PM
Definition at line 45 of file mindsensors-powermeter.h.
| #define MSPM_PCURRENT 0x42 |
Present current reading in mA - 2 bytes
Definition at line 48 of file mindsensors-powermeter.h.
| #define MSPM_PVOLTAGE 0x44 |
Present current reading in mV - 2 bytes
Definition at line 49 of file mindsensors-powermeter.h.
| #define MSPM_TIME 0x56 |
Time since last reset in ms - 4 bytes (long)
Definition at line 51 of file mindsensors-powermeter.h.
| bool _MSPMsendCommand | ( | tSensors | link, |
| byte | command, | ||
| ubyte | address | ||
| ) |
This function sends a command to the Power Meter.
Note: this is an internal function and should not be called directly.
| link | the sensor port number |
| command | the command to be sent |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 81 of file mindsensors-powermeter.h.
| int MSPMreadCurrent | ( | tSensors | link, |
| ubyte | address | ||
| ) |
Return the present current measured.
| link | the MSPM port number |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 97 of file mindsensors-powermeter.h.
| long MSPMreadTime | ( | tSensors | link, |
| ubyte | address | ||
| ) |
Return the time elapsed in ms since the last reset.
| link | the MSPM port number |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 161 of file mindsensors-powermeter.h.
| int MSPMreadVoltage | ( | tSensors | link, |
| ubyte | address | ||
| ) |
Return the present voltage measured.
| link | the MSPM port number |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 117 of file mindsensors-powermeter.h.
| bool MSPMreadVoltageCurrent | ( | tSensors | link, |
| int & | voltage, | ||
| int & | current, | ||
| ubyte | address | ||
| ) |
Return the present voltage and current measured. This is a much more efficient method of fetching both.
| link | the MSPM port number |
| voltage | present voltage being measured |
| current | present current being measured |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 140 of file mindsensors-powermeter.h.
| bool MSPMresetCounters | ( | tSensors | link, |
| ubyte | address | ||
| ) |
Reset all the counters.
| link | the MSPM port number |
| address | the I2C address to use, optional, defaults to 0x12 |
Definition at line 182 of file mindsensors-powermeter.h.
Array to hold I2C reply data
Definition at line 54 of file mindsensors-powermeter.h.
Array to hold I2C command data
Definition at line 53 of file mindsensors-powermeter.h.
1.7.2