Project

General

Profile

RE: I2C Access with 5CSX Development Board » ltc2945.h

Michael Williamson, 06/17/2014 11:04 AM

 
1
/**
2
 *      \file   ltc2945.h
3
 *
4
 *      \brief  Class for the LTC2945 interface.
5
 *
6
 *     o  0
7
 *     | /       Copyright (c) 2014
8
 *    (CL)---o   Critical Link, LLC
9
 *      \
10
 *       O
11
 */
12

    
13
#ifndef _LTC2945_H_ 
14
#define _LTC2945_H_
15

    
16
#include "i2cdevice.h"
17

    
18
#include <stdint.h>
19

    
20
namespace MityDSP
21
{
22
    
23
/**
24
 *  A simple interface class to the LTC2945 based
25
 *  power monitor.  By default, sensors will run continuously
26
 *  in highest resolution mode of operation.
27
 */
28
class tcLTC2945 : public tcI2CDevice
29
{
30
public:
31
   
32
	/**
33
	 * Constructor.
34
	 *
35
	 * @param anBus Bus number. Will open /dev/i2c-%d for I2C communcation.
36
	 * @param anAddr The I2C address of the battery.
37
	 */
38
	tcLTC2945(int anBus, int anAddr, float Rsens, float Vin);
39

    
40
	/**
41
	 * Destructor.
42
	 */
43
	virtual ~tcLTC2945(void) {};
44

    
45
	/**
46
	 * Get the voltage across Rsens
47
	 *
48
	 * \param[out] volts voltage
49
	 *
50
	 * @return non-zero on error
51
	 */
52
	int GetDeltaSense(float& volts);
53

    
54
	int Initialize(void);
55

    
56
	/**
57
	 * Get estimated power consumption based on Vin and current estimate.
58
	 */
59
	int GetPowerW(float& power);
60
  	
61
protected:
62
	float mnRsens;
63
	float mnVin;
64
};
65

    
66
}
67
#endif
(2-2/6) Go to top
Add picture from clipboard (Maximum size: 1 GB)