2 #ifndef LIBPROPELLER_MAX17048_H_ 
    3 #define LIBPROPELLER_MAX17048_H_ 
   45         status_ = bus_->
Ping(kDeviceAddress);
 
   58         int soc = GetShort(kSOC);
 
   59         return ((
unsigned) soc) >> 8;
 
   67         int voltage = GetShort(kVCELL);
 
   71         voltage = ((voltage * 7812) / 100) / 1000;
 
   87         int rate = (GetShort(kCRATE) << 16) >> 16;
 
   89         return (rate * 208) / 100;
 
   97         return GetShort(kVERSION);
 
  103     const static unsigned char kDeviceAddress = 0b01101100;
 
  105     const static unsigned char kVCELL = 0x02;
 
  106     const static unsigned char kSOC = 0x04;
 
  107     const static unsigned char kVERSION = 0x08;
 
  108     const static unsigned char kCRATE = 0x16;
 
  113     int GetShort(
char address) {
 
  115         bus_->
Get(kDeviceAddress, address, data, 2);
 
  116         int result = (data[0] << 8) | data[1];
 
  123 #endif // LIBPROPELLER_MAX17048_H_