forked from lucadentella/ArduinoLib_MAX17043
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMAX17048.h
43 lines (31 loc) · 813 Bytes
/
MAX17048.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// MAX17048/44 library for Arduino
//
// Luca Dentella (http://www.lucadentella.it)
#include "Arduino.h"
#ifndef _MAX17048_H
#define _MAX17048_H
#define MAX17048_ADDRESS 0x36
#define VCELL_REGISTER 0x02
#define SOC_REGISTER 0x04
#define MODE_REGISTER 0x06
#define VERSION_REGISTER 0x08
#define CONFIG_REGISTER 0x0C
#define COMMAND_REGISTER 0xFE
class MAX17048 {
public:
float getVCell();
float getSoC();
int getVersion();
byte getCompensateValue();
byte getAlertThreshold();
void setAlertThreshold(byte threshold);
boolean inAlert();
void clearAlert();
void reset();
void quickStart();
private:
void readConfigRegister(byte &MSB, byte &LSB);
void readRegister(byte startAddress, byte &MSB, byte &LSB);
void writeRegister(byte address, byte MSB, byte LSB);
};
#endif