12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef MAX17043_H_
- #define MAX17043_H_
- #include "ets_sys.h"
- /*------------------------------------------------------------------------------*/
- // Debug Flag(s)
- /*------------------------------------------------------------------------------*/
- #define MAX17043_DEBUG 0
- /*------------------------------------------------------------------------------*/
- /*------------------------------------------------------------------------------*/
- // Device I2C ID
- /*------------------------------------------------------------------------------*/
- #define DEVICE_ADDRESS 0x36
- #define WRITE_ADDRESS 0x6C // develop macro
- #define READ_ADDRESS 0x6D // develop macro
- /*------------------------------------------------------------------------------*/
- /*------------------------------------------------------------------------------*/
- // Device Registers
- /*------------------------------------------------------------------------------*/
- #define VCELL_H 0x02 // 12-bit ADC battery voltage
- #define VCELL_L 0x03
- /*------------------------------------------------------------------------------*/
- #define SOC_H 0x04 // 16-bit capacity estimation
- #define SOC_L 0x05
- /*------------------------------------------------------------------------------*/
- #define MODE_H 0x06 // sends special commands to IC
- #define MODE_L 0x07
- /*------------------------------------------------------------------------------*/
- #define VERISON_H 0x08 // returns IC version
- #define VERSION_L 0x09
- /*------------------------------------------------------------------------------*/
- #define CONFIG_H 0x0C // battery compensation parameters
- #define CONFIG_L 0x0D
- /*------------------------------------------------------------------------------*/
- #define COMMAND_H 0xFE // sends special commands to IC
- #define COMMAND_L 0xFF
- /*------------------------------------------------------------------------------*/
- /*------------------------------------------------------------------------------*/
- // Function Prototypes
- /*------------------------------------------------------------------------------*/
- uint16_t max17043_getVoltage(void);
- uint16_t max17043_getSOC(void);
- bool max17043_sleep(uint8_t enable);
- bool max17043_quickStart(void);
- /*------------------------------------------------------------------------------*/
- /*------------------------------------------------------------------------------*/
- // Macro Definitions
- /*------------------------------------------------------------------------------*/
- #define max17043_i2c_init() i2c_master_gpio_init()
- /*------------------------------------------------------------------------------*/
- #endif
|