diff --git a/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.cpp b/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.cpp
deleted file mode 100644
index b24f686af..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*!
- * @file DFRobot_MAX17043.cpp
- *
- * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- * @license The MIT License (MIT)
- * @author [ouki.wang](ouki.wang@dfrobot.com)
- * @version V1.0
- * @date 2018-4-14
- * @url https://github.com/DFRobot/DFRobot_MAX17043
- */
-
-#include "DFRobot_MAX17043.h"
-
-DFRobot_MAX17043::DFRobot_MAX17043() {}
-
-int DFRobot_MAX17043::begin()
-{
- // write16(MAX17043_COMMAND, 0x0054); //power on reset
- write16(MAX17043_COMMAND, 0x5400); //power on reset
- delay(10);
- _DBG_CODE(Serial.print("\nbegin: "));
- _DBG_CODE(Serial.println(read16(MAX17043_CONFIG), HEX));
- if(read16(MAX17043_CONFIG) == 0x971c) { //default 0x971c
- write16(MAX17043_MODE, 0x4000); //quick start
- write16(MAX17043_CONFIG, 0x9700);
- _DBG_CODE(Serial.println(read16(MAX17043_CONFIG), HEX));
- delay(10);
- return 0;
- }
- return -1;
-}
-
-float DFRobot_MAX17043::readVoltage()
-{
- return (1.25f * (float)(read16(MAX17043_VCELL) >> 4));
-}
-
-float DFRobot_MAX17043::readPercentage()
-{
- uint16_t per = read16(MAX17043_SOC);
- return (float)((per >> 8) + 0.003906f * (per & 0x00ff));
-}
-
-void DFRobot_MAX17043::setInterrupt(uint8_t per)
-{
- uint16_t temp;
- if(per > 32)
- temp = 32;
- else if(per < 1)
- temp = 1;
- temp = 32 - temp;
- writeRegBits(MAX17043_CONFIG, temp, 0x01f, 0);
-}
-
-void DFRobot_MAX17043::clearInterrupt()
-{
- writeRegBits(MAX17043_CONFIG, 0, 0x01, 5);
-}
-
-void DFRobot_MAX17043::setSleep()
-{
- writeRegBits(MAX17043_CONFIG, 1, 0x01, 7);
-}
-
-void DFRobot_MAX17043::setWakeUp()
-{
- writeRegBits(MAX17043_CONFIG, 0, 0x01, 7);
-}
diff --git a/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.h b/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.h
deleted file mode 100644
index f4147ba69..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/DFRobot_MAX17043.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*!
- * @file DFRobot_MAX17043.h
- *
- * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- * @license The MIT License (MIT)
- * @author [ouki.wang](ouki.wang@dfrobot.com)
- * @version V1.0
- * @date 2018-4-14
- * @url https://github.com/DFRobot/DFRobot_MAX17043
- */
-
-#ifndef __DFROBOT_MAX17043_H
-#define __DFROBOT_MAX17043_H
-
-#include "Arduino.h"
-#include "Wire.h"
-
-#define _DBG 0
-
-#if(_DBG)
- #define _DBG_CODE(x) x
-#else
- #define _DBG_CODE(x)
-#endif
-
-#define MAX17043_ADDRESS 0x36
-
-#define MAX17043_VCELL 0x02
-#define MAX17043_SOC 0x04
-#define MAX17043_MODE 0x06
-#define MAX17043_VERSION 0x08
-#define MAX17043_CONFIG 0x0c
-#define MAX17043_COMMAND 0xfe
-
-class DFRobot_MAX17043 {
-public:
- /**
- * @fn DFRobot_MAX17043
- * @brief create MAX17043 object
- * @return MAX17043 object
- */
- DFRobot_MAX17043();
- /**
- * @fn begin
- * @brief MAX17043 begin and test moudle
- *
- * @return initialization result
- * @retval 0 successful
- * @retval -1 faild
- */
- int begin();
- /**
- * @fn readVoltage
- * @brief read battery voltage in mV
- * @return voltage in mV
- */
- float readVoltage();
- /**
- * @fn readPercentage
- * @brief read battery remaining capacity in percentage
- *
- * @return battery remaining capacity in percentage
- */
- float readPercentage();
- /**
- * @fn setInterrupt
- * @brief set MAX17043 interrput threshold
- *
- * @param per interrupt threshold as %1 - 32% (integer)
- */
- void setInterrupt(uint8_t per);
- /**
- * @fn clearInterrupt
- * @brief clear MAX17043 interrupt
- */
- void clearInterrupt();
- /**
- * @fn setSleep
- * @brief set MAX17043 in sleep mode
- *
- */
- void setSleep();
- /**
- * @fn setWakeUp
- * @brief weak up MAX17043
- *
- */
- void setWakeUp();
-
- private:
- void write16(uint8_t reg, uint16_t dat) {
- Wire.begin();
- Wire.beginTransmission(MAX17043_ADDRESS);
- Wire.write(reg);
- Wire.write(dat >> 8);
- Wire.write(dat);
- Wire.endTransmission();
- }
-
- uint16_t read16(uint8_t reg) {
- uint16_t temp;
- Wire.begin();
- Wire.beginTransmission(MAX17043_ADDRESS);
- Wire.write(reg);
- Wire.endTransmission();
- Wire.requestFrom(MAX17043_ADDRESS, 2);
- temp = (uint16_t)Wire.read() << 8;
- temp |= (uint16_t)Wire.read();
- Wire.endTransmission();
- return temp;
- }
-
- void writeRegBits(uint8_t reg, uint16_t dat, uint16_t bits, uint8_t offset) {
- uint16_t temp;
- temp = read16(reg);
- temp = (temp & (~(bits << offset))) | (dat << offset);
- write16(reg, temp);
- }
-};
-
-#endif
diff --git a/lib/lib_i2c/DFRobot_MAX17043/LICENSE b/lib/lib_i2c/DFRobot_MAX17043/LICENSE
deleted file mode 100644
index 79f310082..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright 2010 DFRobot Co.Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/lib/lib_i2c/DFRobot_MAX17043/README_CN.md b/lib/lib_i2c/DFRobot_MAX17043/README_CN.md
deleted file mode 100644
index 85d1f9c87..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/README_CN.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# DFRobot_MAX17043
-
-* [English Version](./README.md)
-
-Gravity 3.7V锂电池电量计使用Gravity I2C接口,超低工作电流,通过Maxim专利算法,实时跟踪电池的相对充电状态(SOC,State-Of-Charge),无需充放电学习过程,无积累误差,即插即用,准确地测量锂电池的当前电压和剩余电量。模块预留低电量报警中断引脚,当电池电量低于指定电量时,该引脚产生一个下跳脉冲,触发主控的外部中断。
-
-![产品效果图](./resources/images/DFR0563.jpg)
-
-
-## 产品链接([https://www.dfrobot.com.cn/goods-1743.html](https://www.dfrobot.com.cn/goods-1743.html))
- SKU: DFR0563
-
-## 目录
-
-* [概述](#概述)
-* [连接](连接)
-* [库安装](#库安装)
-* [方法](#方法)
-* [兼容性](#兼容性)
-* [历史](#历史)
-* [创作者](#创作者)
-
-## 概述
-
-提供 Arduino 库,用于通过 I2C 读取和解释 MAX17043 数据。
-
-## 连接
-相同颜色的线连接在一起,我们只举例说明主板是如何连接到电量计的。接线时要注意管脚的对应关系,接线图如下:
-
-* Arduino UNO
-
-
-
-
-* ESP32
-
-
-
-
-
-## 库安装
-
-这里有2种安装方法:
-1. 使用此库前,请首先下载库文件,将其粘贴到\Arduino\libraries目录中,然后打开examples文件夹并在该文件夹中运行演示。
-2. 直接在Arduino软件库管理中搜索下载 DFRobot_MAX17043 库
-
-## 方法
-
-```C++
- /**
- * @fn DFRobot_MAX17043
- * @brief 构造MAX17043对象
- * @return MAX17043 类对象
- */
- DFRobot_MAX17043();
- /**
- * @fn begin
- * @brief MAX17043 初始化
- *
- * @return 初始化结果
- * @retval 0 成功
- * @retval -1 失败
- */
- int begin();
- /**
- * @fn readVoltage
- * @brief 读电池电压,单位: mV
- * @return 电池电压,单位:mV
- */
- float readVoltage();
- /**
- * @fn readPercentage
- * @brief 读取剩余电池容量的百分比
- *
- * @return 剩余电池容量的百分比
- */
- float readPercentage();
- /**
- * @fn setInterrupt
- * @brief 设置 MAX17043 中断阈值
- *
- * @param per 中断阈值范围: %1 - 32% (整数)
- */
- void setInterrupt(uint8_t per);
- /**
- * @fn clearInterrupt
- * @brief 清除 MAX17043 中断
- */
- void clearInterrupt();
- /**
- * @fn setSleep
- * @brief 设置 MAX17043 进入睡眠模式
- *
- */
- void setSleep();
- /**
- * @fn setWakeUp
- * @brief 唤醒 MAX17043
- */
- void setWakeUp();
-```
-
-## 兼容性
-
-| MCU | Work Well | Work Wrong | Untested | Remarks |
-| ------------------ | :-------: | :--------: | :------: | ------- |
-| FireBeetle-ESP32 | √ | | |
-| FireBeetle-ESP8266 | √ | | |
-| Arduino uno | √ | | |
-
-## 历史
-
-- 2018/04/14 - 1.0.0 版本
-
-## 创作者
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
-
-
-
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/examples/DFRobot_MAX17043/DFRobot_MAX17043.ino b/lib/lib_i2c/DFRobot_MAX17043/examples/DFRobot_MAX17043/DFRobot_MAX17043.ino
deleted file mode 100644
index 746f166fe..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/examples/DFRobot_MAX17043/DFRobot_MAX17043.ino
+++ /dev/null
@@ -1,74 +0,0 @@
-/*!
- * @file DFRobot_MAX17043.ino
- * @brief connect gauge I2C interface with your board (please reference board compatibility)
- * @n Voltage, percentage will be printed via serial.
- * @n Use API to config alaram and sleep (please reference to the readme in lib)
- *
- * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- * @license The MIT License (MIT)
- * @author [ouki.wang](ouki.wang@dfrobot.com)
- * @version V1.0
- * @date 2018-4-14
- * @url https://github.com/DFRobot/DFRobot_MAX17043
- */
-
-#include "DFRobot_MAX17043.h"
-#include "Wire.h"
-
-#ifdef __AVR__
- #define ALR_PIN 2
-#else
- #define ALR_PIN D2
-#endif
-
-#define PRINT_INTERVAL 2000
-
-DFRobot_MAX17043 gauge;
-uint8_t intFlag = 0;
-
-void interruptCallBack()
-{
- intFlag = 1;
-}
-
-void setup()
-{
- Serial.begin(115200);
- while(!Serial);
- Serial.println();
- Serial.println();
- pinMode(ALR_PIN, INPUT_PULLUP);
- attachInterrupt(ALR_PIN, interruptCallBack, FALLING); //default alert is 32%
-
- while(gauge.begin() != 0) {
- Serial.println("gauge begin faild!");
- delay(2000);
- }
- delay(2);
- Serial.println("gauge begin successful!");
- //gauge.setInterrupt(32); //use this to modify alert threshold as 1% - 32% (integer)
-}
-
-void loop()
-{
- static unsigned long lastMillis = 0;
- if((millis() - lastMillis) > PRINT_INTERVAL) {
- lastMillis = millis();
- Serial.println();
-
- Serial.print("voltage: ");
- Serial.print(gauge.readVoltage());
- Serial.println(" mV");
-
- Serial.print("precentage: ");
- Serial.print(gauge.readPercentage());
- Serial.println(" %");
- }
-
- if(intFlag == 1) {
- intFlag = 0;
- gauge.clearInterrupt();
- Serial.println("Low power alert interrupt!");
- //put your battery low power alert interrupt service routine here
- }
-}
diff --git a/lib/lib_i2c/DFRobot_MAX17043/keywords.txt b/lib/lib_i2c/DFRobot_MAX17043/keywords.txt
deleted file mode 100644
index bcb479a57..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/keywords.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-DFRobot_MAX17043 KEYWORD1
-
-begin KEYWORD2
-readVoltage KEYWORD2
-readPercentage KEYWORD2
-setInterrupt KEYWORD2
-clearInterrupt KEYWORD2
-setSleep KEYWORD2
-setWakeUp KEYWORD2
\ No newline at end of file
diff --git a/lib/lib_i2c/DFRobot_MAX17043/library.properties b/lib/lib_i2c/DFRobot_MAX17043/library.properties
deleted file mode 100644
index c769e3bef..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/library.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-name=DFRobot_MAX17043
-version=1.0.0
-author=DFRobot
-maintainer=ouki.wang
-sentence=DFRobot Standard library(SKU:DFR0563).
-paragraph=Gravity: I2C 3.7V Li Battery Fuel Gauge.
-category=Sensors
-url=https://github.com/DFRobot/DFRobot_MAX17043
-architectures=*
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/DFRobot_MAX17043.py b/lib/lib_i2c/DFRobot_MAX17043/python/micropython/DFRobot_MAX17043.py
deleted file mode 100644
index b7ac8b9e8..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/DFRobot_MAX17043.py
+++ /dev/null
@@ -1,111 +0,0 @@
-'''!
- @file DFRobot_MAX17043.py
- @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- @license The MIT License (MIT)
- @author [ouki.wang](ouki.wang@dfrobot.com)
- @version V1.0
- @date 2018-4-14
- @url https://github.com/DFRobot/DFRobot_MAX17043
-'''
-
-import time
-
-from machine import I2C, Pin
-
-## Get I2C bus
-i2c = I2C(scl = Pin(22), sda = Pin(21), freq=400000)
-
-MAX17043_ADDR = 0x36
-MAX17043_VCELL = 0x02
-MAX17043_SOC = 0x04
-MAX17043_MODE = 0x06
-MAX17043_VERSION = 0x08
-MAX17043_CONFIG = 0x0c
-MAX17043_COMMAND = 0xfe
-
-class DFRobot_MAX17043():
-
- def __init__(self):
- '''!
- @brief create MAX17043 object
- @return MAX17043 object
- '''
- pass
-
- def begin(self):
- '''!
- @brief MAX17043 begin and test moudle
- @return initialization result:
- @retval 0 successful
- @retval -1 faild
- '''
- self._write16(MAX17043_COMMAND, 0x5400)
- time.sleep(0.01)
- if self._read16(MAX17043_CONFIG) == 0x971c:
- self._write16(MAX17043_MODE, 0x4000)
- time.sleep(0.01)
- self._write16(MAX17043_CONFIG, 0x9700)
- return 0
- else:
- return -1
-
- def read_voltage(self):
- '''!
- @brief read battery voltage in mV
- @return voltage in mV
- '''
- return (1.25 * (self._read16(MAX17043_VCELL) >> 4))
-
- def read_percentage(self):
- '''!
- @brief read battery remaining capacity in percentage
- @return battery remaining capacity in percentage
- '''
- tmp = self._read16(MAX17043_SOC)
- return ((tmp >> 8) + 0.003906 * (tmp & 0x00ff))
-
- def set_Interrupt(self, per):
- '''!
- @brief set MAX17043 interrput threshold
- @param per interrupt threshold as %1 - 32% (integer)
- '''
- if per > 32:
- per = 32
- elif per < 1:
- per = 1
- per = 32 - int(per)
- self._write_reg_bits(MAX17043_CONFIG, per, 0x01f, 0)
-
- def clear_interrupt(self):
- '''!
- @brief clear MAX17043 interrupt.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 0, 0x01, 5)
-
- def set_sleep(self):
- '''!
- @brief set MAX17043 in sleep mode.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 1, 0x01, 7)
-
- def set_wakeup(self):
- '''!
- @brief wake up MAX17043.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 0, 0x01, 7)
-
- def _write16(self, reg, dat):
- buf = bytearray(2)
- buf[0] = dat >> 8
- buf[1] = dat & 0x00ff
- i2c.writeto_mem(MAX17043_ADDR, reg, buf)
-
- def _read16(self, reg):
- buf = i2c.readfrom_mem(MAX17043_ADDR, reg, 2)
- return ((buf[0] << 8) | buf[1])
-
- def _write_reg_bits(self, reg, dat, bits, offset):
- tmp = self._read16(reg)
- tmp = (tmp & (~(bits << offset))) | (dat << offset)
- self._write16(reg, tmp)
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README.md b/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README.md
deleted file mode 100644
index 106363df4..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README.md
+++ /dev/null
@@ -1,100 +0,0 @@
-# DFRobot_MAX17043
-
-* [中文版](./README_CN.md)
-
-The MAX17043 is ultra-compact, low-cost,host-side fuel-gauge systems for lithium-ion (Li+) batter-ies in handheld and portable
-equpiment.It employs Gravity I2C interface,ultra-low opearting current, and real-time tracking of the relative state of charge
-(SOC) of the battery through Maxim's patented algorithm,eliminating the need for full-to-empty relearning and offset accumualtion
-errors.Plug and play to accurately measure the voltage and remaining power of the battery. The module also features as a low
-battery power alert interrupt function. When the battery power falls below specified threshold, the ALR pin generates a falling
-pluse to trigger the external interrupt of the controller.One thing should mention that the default value of the battery low power
-interrupt alert threshold is 32%, this threshold can be set by the function set_interrupt().
-
-![产品效果图](../../resources/images/DFR0563.jpg)
-
-## Product Link([https://www.dfrobot.com/product-1734.html](https://www.dfrobot.com/product-1734.html))
- SKU: DFR0563
-
-## Table of Contents
-* [Summary](#summary)
-* [connection](connection)
-* [Installation](#installation)
-* [Methods](#methods)
-* [Compatibility](#compatibility)
-* [History](#history)
-* [Credits](#credits)
-
-## Summary
-Provides a microPython library for reading and interperting MAX17043 data over I2C.
-
-## Connection
-Wires of the same color are linked together,and We only exemplify how this board is connected to the Fuel Gauge.
-When connecting , it is necessary to pay attention to the correspondence among pins, the connection diagram is as fellows.
-
-* ESP32
-
-
-
-
-
-
-## Installation
-
-To use this library download the zip file, uncomperss it to a folder named DFRobot_MAX17043 in your upyCraft workspace.
-
-## Methods
-
-```python
- '''!
- @brief MAX17043 begin and test moudle
- @return initialization result:
- @retval 0 successful
- @retval -1 faild
- '''
- def begin(self):
-
- '''!
- @brief read battery voltage in mV
- @return voltage in mV
- '''
- def read_voltage(self):
-
- '''!
- @brief read battery remaining capacity in percentage
- @return battery remaining capacity in percentage
- '''
- def read_percentage(self):
- '''!
- @brief set MAX17043 interrput threshold
- @param per interrupt threshold as %1 - 32% (integer)
- '''
- def set_interrupt(self, per):
-
- '''!
- @brief clear MAX17043 interrupt.
- '''
- def clear_interrupt(self):
-
- '''!
- @brief set MAX17043 in sleep mode.
- '''
- def set_sleep(self):
-
- '''!
- @brief wake up MAX17043.
- '''
-
-```
-## Compatibility
-
-| MCU | Work Well | Work Wrong | Untested | Remarks |
-| ------------------ | :-------: | :--------: | :------: | ------- |
-| ESP32 | √ | | |
-
-## History
-
-- 2018/04/14 - Version 1.0.0 released.
-
-## Credits
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README_CN.md b/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README_CN.md
deleted file mode 100644
index 48af8058c..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/README_CN.md
+++ /dev/null
@@ -1,97 +0,0 @@
-# DFRobot_MAX17043
-
-* [English Version](./README.md)
-
-Gravity 3.7V锂电池电量计使用Gravity I2C接口,超低工作电流,通过Maxim专利算法,实时跟踪电池的相对充电状态(SOC,State-Of-Charge),无需充放电学习过程,无积累误差,即插即用,准确地测量锂电池的当前电压和剩余电量。模块预留低电量报警中断引脚,当电池电量低于指定电量时,该引脚产生一个下跳脉冲,触发主控的外部中断。
-
-![产品效果图](../../resources/images/DFR0563.jpg)
-
-
-## 产品链接([https://www.dfrobot.com.cn/goods-1743.html](https://www.dfrobot.com.cn/goods-1743.html))
- SKU: DFR0563
-
-## 目录
-
-* [概述](#概述)
-* [连接](连接)
-* [库安装](#库安装)
-* [方法](#方法)
-* [兼容性](#兼容性)
-* [历史](#历史)
-* [创作者](#创作者)
-
-## 概述
-提供 microPython 库,用于通过 I2C 读取和解释 MAX17043 数据
-
-## 连接
-相同颜色的线连接在一起,我们只举例说明主板是如何连接到电量计的。接线时要注意管脚的对应关系,接线图如下:
-
-* ESP32
-
-
-
-
-
-
-## 库安装
-
-要使用此库,请下载 zip 文件,将其解压缩到 upyCraft 工作区中名为 DFRobot_MAX17043 的文件夹中。
-
-## 方法
-
-```python
- '''!
- @brief 构造MAX17043对象
- @return MAX17043 初始化
- @retval 0 成功
- @retval -1 失败
- '''
- def begin(self):
-
- '''!
- @brief 读电池电压,单位: mV
- @return 电池电压,单位:mV
- '''
- def read_voltage(self):
-
- '''!
- @brief 读取剩余电池容量的百分比
- @return 剩余电池容量的百分比
- '''
- def read_percentage(self):
- '''!
- @brief 设置 MAX17043 中断阈值
- @param per 中断阈值范围: %1 - 32% (整数)
- '''
- def set_interrupt(self, per):
-
- '''!
- @brief 清除 MAX17043 中断.
- '''
- def clear_interrupt(self):
-
- '''!
- @brief 设置 MAX17043 进入睡眠模式
- '''
- def set_sleep(self):
-
- '''!
- @brief 唤醒 MAX17043
- '''
- def set_wakeup(self):
-```
-
-## 兼容性
-
-| MCU | Work Well | Work Wrong | Untested | Remarks |
-| ------------------ | :-------: | :--------: | :------: | ------- |
-| ESP32 | √ | | |
-
-## 历史
-
-- 2018/04/14 - 1.0.0 版本
-
-## 创作者
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/demo_MAX17043.py b/lib/lib_i2c/DFRobot_MAX17043/python/micropython/demo_MAX17043.py
deleted file mode 100644
index d6d5e2f54..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/micropython/demo_MAX17043.py
+++ /dev/null
@@ -1,38 +0,0 @@
-'''!
- @file demo_MAX17043.py
- @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- @license The MIT License (MIT)
- @author [ouki.wang](ouki.wang@dfrobot.com)
- @version V1.0
- @date 2018-4-14
- @url https://github.com/DFRobot/DFRobot_MAX17043
-'''
-
-import time
-from machine import Pin
-from DFRobot_MAX17043 import DFRobot_MAX17043
-
-gauge = DFRobot_MAX17043()
-
-def interruptCallBack(channel):
- gauge.clear_interrupt()
- print('Low power alert interrupt!')
- #put your battery low power alert interrupt service routine here
-
-pin_irq = Pin(25, Pin.IN)
-pin_irq.irq(trigger = Pin.IRQ_FALLING, handler = interruptCallBack)
-
-rslt = gauge.begin()
-
-while rslt != 0:
- print('gauge begin faild')
- time.sleep(2)
- rslt = gauge.begin()
-
-#gauge.set_Interrupt(32) #use this to modify alert threshold as 1% - 32% (integer)
-print('gauge begin successful')
-
-while True:
- time.sleep(2)
- print('voltage: ' + str(gauge.read_voltage()) + 'mV')
- print('percentage: ' + str(round(gauge.read_percentage(), 2)) + '%')
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/DFRobot_MAX17043.py b/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/DFRobot_MAX17043.py
deleted file mode 100644
index 1ddc751ca..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/DFRobot_MAX17043.py
+++ /dev/null
@@ -1,109 +0,0 @@
-'''!
- @file DFRobot_MAX17043.py
- @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- @license The MIT License (MIT)
- @author [ouki.wang](ouki.wang@dfrobot.com)
- @version V1.0
- @date 2018-4-14
- @url https://github.com/DFRobot/DFRobot_MAX17043
-'''
-
-import smbus
-import time
-import datetime
-
-# Get I2C bus
-bus = smbus.SMBus(1)
-
-MAX17043_ADDR = 0x36
-MAX17043_VCELL = 0x02
-MAX17043_SOC = 0x04
-MAX17043_MODE = 0x06
-MAX17043_VERSION = 0x08
-MAX17043_CONFIG = 0x0c
-MAX17043_COMMAND = 0xfe
-
-class DFRobot_MAX17043():
-
- def __init__(self):
- '''!
- @brief create MAX17043 object
- @return MAX17043 object
- '''
- pass
-
- def begin(self):
- '''!
- @brief MAX17043 begin and test moudle
- @return initialization result:
- @retval 0 successful
- @retval -1 faild
- '''
- self._write16(MAX17043_COMMAND, 0x5400)
- time.sleep(0.01)
- if self._read16(MAX17043_CONFIG) == 0x971c:
- self._write16(MAX17043_MODE, 0x4000)
- time.sleep(0.01)
- self._write16(MAX17043_CONFIG, 0x9700)
- return 0
- else:
- return -1
-
- def read_voltage(self):
- '''!
- @brief read battery voltage in mV
- @return voltage in mV
- '''
- return (1.25 * (self._read16(MAX17043_VCELL) >> 4))
-
- def read_percentage(self):
- '''!
- @brief read battery remaining capacity in percentage
- @return battery remaining capacity in percentage
- '''
- tmp = self._read16(MAX17043_SOC)
- return ((tmp >> 8) + 0.003906 * (tmp & 0x00ff))
-
- def set_interrupt(self, per):
- '''!
- @brief set MAX17043 interrput threshold
- @param per interrupt threshold as %1 - 32% (integer)
- '''
- if per > 32:
- per = 32
- elif per < 1:
- per = 1
- per = 32 - int(per)
- self._write_reg_bits(MAX17043_CONFIG, per, 0x01f, 0)
-
- def clear_interrupt(self):
- '''!
- @brief clear MAX17043 interrupt.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 0, 0x01, 5)
-
- def set_sleep(self):
- '''!
- @brief set MAX17043 in sleep mode.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 1, 0x01, 7)
-
- def set_wakeup(self):
- '''!
- @brief wake up MAX17043.
- '''
- self._write_reg_bits(MAX17043_CONFIG, 0, 0x01, 7)
-
- def _write16(self, reg, dat):
- buf = [dat >> 8, dat & 0x00ff]
- bus.write_i2c_block_data(MAX17043_ADDR, reg, buf)
-
- def _read16(self, reg):
- buf = bus.read_i2c_block_data(MAX17043_ADDR, reg, 2)
- return ((buf[0] << 8) | buf[1])
-
- def _write_reg_bits(self, reg, dat, bits, offset):
- tmp = self._read16(reg)
- tmp = (tmp & (~(bits << offset))) | (dat << offset)
- self._write16(reg, tmp)
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README.md b/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README.md
deleted file mode 100644
index 47bd42678..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README.md
+++ /dev/null
@@ -1,128 +0,0 @@
-# DFRobot_MAX17043
-
-* [中文版](./README_CN.md)
-
-The MAX17043 is ultra-compact, low-cost,host-side fuel-gauge systems for lithium-ion (Li+) batter-ies in handheld and portable
-equpiment.It employs Gravity I2C interface,ultra-low opearting current, and real-time tracking of the relative state of charge
-(SOC) of the battery through Maxim's patented algorithm,eliminating the need for full-to-empty relearning and offset accumualtion
-errors.Plug and play to accurately measure the voltage and remaining power of the battery. The module also features as a low
-battery power alert interrupt function. When the battery power falls below specified threshold, the ALR pin generates a falling
-pluse to trigger the external interrupt of the controller.One thing should mention that the default value of the battery low power
-interrupt alert threshold is 32%, this threshold can be set by the function set_interrupt().
-
-![产品效果图](../../resources/images/DFR0563.jpg)
-
-## Product Link([https://www.dfrobot.com/product-1734.html](https://www.dfrobot.com/product-1734.html))
- SKU: DFR0563
-
-## Table of Contents
-* [Summary](#summary)
-* [connection](connection)
-* [Installation](#installation)
-* [Methods](#methods)
-* [Compatibility](#compatibility)
-* [History](#history)
-* [Credits](#credits)
-
-## Summary
-
-Provides an Raspberry pi library for reading and interperting MAX17043 data over I2C.
-
-## Connection
-Wires of the same color are linked together,and We only exemplify how these three boards are connected to the Fuel Gauge.
-When connecting , it is necessary to pay attention to the correspondence among pins, the connection diagram is as fellows.
-
-* Raspberry Pi
-
-
-
-
-## Installation
-
-Download and install smbus library on Raspberry pi. Steps to install smbus are provided at:
-
-```python
-$> sudo apt-get install -y python-smbus
-$> sudo apt-get install -y i2c-tools
-```
-
-1. To use this library, first download the library file
-```python
-sudo git clone https://github.com/DFRobot/DFRobot_MAX17043
-```
-2. Open and run the routine. To execute a routine demo_x.py, enter python demo_x.py in the command line. For example, to execute the demo_read_and_int.py.py routine, you need to enter :
-
-```python
-python demo_read_and_int.py.py
-or
-python2 demo_read_and_int.py.py
-```
-
-## Methods
-
-```python
- '''!
- @brief MAX17043 begin and test moudle
- @return initialization result:
- @retval 0 successful
- @retval -1 faild
- '''
- def begin(self):
-
- '''!
- @brief read battery voltage in mV
- @return voltage in mV
- '''
- def read_voltage(self):
-
- '''!
- @brief read battery remaining capacity in percentage
- @return battery remaining capacity in percentage
- '''
- def read_percentage(self):
- '''!
- @brief set MAX17043 interrput threshold
- @param per interrupt threshold as %1 - 32% (integer)
- '''
- def set_interrupt(self, per):
-
- '''!
- @brief clear MAX17043 interrupt.
- '''
- def clear_interrupt(self):
-
- '''!
- @brief set MAX17043 in sleep mode.
- '''
- def set_sleep(self):
-
- '''!
- @brief wake up MAX17043.
- '''
- def set_wakeup(self):
-
-
-```
-
-## Compatibility
-
-| 主板 | 通过 | 未通过 | 未测试 | 备注 |
-| ------------ | :--: | :----: | :----: | :--: |
-| RaspberryPi2 | | | √ | |
-| RaspberryPi3 | | | √ | |
-| RaspberryPi4 | √ | | | |
-
-* Python 版本
-
-| Python | 通过 | 未通过 | 未测试 | 备注 |
-| ------- | :--: | :----: | :----: | ---- |
-| Python2 | √ | | | |
-| Python3 | | | √ | |
-
-## History
-
-- 2018/04/14 - Version 1.0.0 released.
-
-## Credits
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README_CN.md b/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README_CN.md
deleted file mode 100644
index 00894b09a..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/README_CN.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# DFRobot_MAX17043
-
-* [English Version](./README.md)
-
-Gravity 3.7V锂电池电量计使用Gravity I2C接口,超低工作电流,通过Maxim专利算法,实时跟踪电池的相对充电状态(SOC,State-Of-Charge),无需充放电学习过程,无积累误差,即插即用,准确地测量锂电池的当前电压和剩余电量。模块预留低电量报警中断引脚,当电池电量低于指定电量时,该引脚产生一个下跳脉冲,触发主控的外部中断。
-
-![产品效果图](../../resources/images/DFR0563.jpg)
-
-
-## 产品链接([https://www.dfrobot.com.cn/goods-1743.html](https://www.dfrobot.com.cn/goods-1743.html))
- SKU: DFR0563
-
-## 目录
-
-* [概述](#概述)
-* [连接](连接)
-* [库安装](#库安装)
-* [方法](#方法)
-* [兼容性](#兼容性)
-* [历史](#历史)
-* [创作者](#创作者)
-
-## 概述
-
-提供 python 库,用于通过 I2C 读取和解释 MAX17043 数据。
-
-## 连接
-相同颜色的线连接在一起,我们只举例说明主板是如何连接到电量计的。接线时要注意管脚的对应关系,接线图如下:
-
-* Raspberry Pi
-
-
-
-
-## 库安装
-1. 下载库至树莓派,要使用这个库,首先要将库下载到Raspberry Pi,命令下载方法如下:
-```python
-sudo git clone https://github.com/DFRobot/DFRobot_MAX17043
-```
-2. 打开并运行例程,要执行一个例程demo_x.py,请在命令行中输入python demo_x.py。例如,要执行 demo_read_and_int.py例程,你需要输入:
-
-```python
-python demo_read_and_int.py
-或
-python2 demo_read_and_int.py
-```
-
-## 方法
-
-```python
- '''!
- @brief 构造MAX17043对象
- @return MAX17043 初始化
- @retval 0 成功
- @retval -1 失败
- '''
- def begin(self):
-
- '''!
- @brief 读电池电压,单位: mV
- @return 电池电压,单位:mV
- '''
- def read_voltage(self):
-
- '''!
- @brief 读取剩余电池容量的百分比
- @return 剩余电池容量的百分比
- '''
- def read_percentage(self):
- '''!
- @brief 设置 MAX17043 中断阈值
- @param per 中断阈值范围: %1 - 32% (整数)
- '''
- def set_interrupt(self, per):
-
- '''!
- @brief 清除 MAX17043 中断.
- '''
- def clear_interrupt(self):
-
- '''!
- @brief 设置 MAX17043 进入睡眠模式
- '''
- def set_sleep(self):
-
- '''!
- @brief 唤醒 MAX17043
- '''
- def set_wakeup(self):
-```
-
-## 兼容性
-
-| 主板 | 通过 | 未通过 | 未测试 | 备注 |
-| ------------ | :--: | :----: | :----: | :--: |
-| RaspberryPi2 | | | √ | |
-| RaspberryPi3 | | | √ | |
-| RaspberryPi4 | √ | | | |
-
-* Python 版本
-
-| Python | 通过 | 未通过 | 未测试 | 备注 |
-| ------- | :--: | :----: | :----: | ---- |
-| Python2 | √ | | | |
-| Python3 | | | √ | |
-
-## 历史
-
-- 2018/04/14 - 1.0.0 版本
-
-## 创作者
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
-
-
-
-
-
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/examples/demo_read_and_int.py b/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/examples/demo_read_and_int.py
deleted file mode 100644
index dd328c640..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/python/raspberry/examples/demo_read_and_int.py
+++ /dev/null
@@ -1,44 +0,0 @@
-'''!
- @file demo_read_and_int.py
- @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
- @license The MIT License (MIT)
- @author [ouki.wang](ouki.wang@dfrobot.com)
- @version V1.0
- @date 2018-4-14
- @url https://github.com/DFRobot/DFRobot_MAX17043
-'''
-
-import sys
-sys.path.append('../')
-import time
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
-from DFRobot_MAX17043 import DFRobot_MAX17043
-import RPi.GPIO as GPIO
-
-gauge = DFRobot_MAX17043()
-
-GPIO.setmode(GPIO.BOARD)
-GPIO.setup(7, GPIO.IN)
-
-def interruptCallBack(channel):
- gauge.clear_interrupt()
- print('Low power alert interrupt!')
- #put your battery low power alert interrupt service routine here
-
-GPIO.add_event_detect(7, GPIO.FALLING, callback = interruptCallBack, bouncetime = 5)
-
-rslt = gauge.begin()
-
-while rslt != 0:
- print('gauge begin faild')
- time.sleep(2)
- rslt = gauge.begin()
-
-gauge.set_interrupt(32) #use this to modify alert threshold as 1% - 32% (integer)
-print('gauge begin successful')
-
-while True:
- time.sleep(2)
- print('voltage: ' + str(gauge.read_voltage()) + 'mV')
- print('percentage: ' + str(round(gauge.read_percentage(), 2)) + '%')
diff --git a/lib/lib_i2c/DFRobot_MAX17043/readme.md b/lib/lib_i2c/DFRobot_MAX17043/readme.md
deleted file mode 100644
index fdc79ac77..000000000
--- a/lib/lib_i2c/DFRobot_MAX17043/readme.md
+++ /dev/null
@@ -1,122 +0,0 @@
-# DFRobot_MAX17043
-
-* [中文版](./README_CN.md)
-
- The MAX17043 is ultra-compact, low-cost,host-side fuel-gauge systems for lithium-ion (Li+) batter-ies in handheld and portable
-equipment.It employs Gravity I2C interface,ultra-low opearting current, and real-time tracking of the relative state of charge (SOC)
-of the battery through Maxim's patented algorithm,eliminating the need for full-to-empty relearning and offset accumualtion errors.
-Plug and play to accurately measure the voltage and remaining power of the battery. The module also features as a low battery power
-alert interrupt function. When the battery power falls below specified threshold, the ALR pin generates a falling pluse to trigger
-the external interrupt of the controller.One thing should mention that the default value of the battery low power interrupt alert
-threshold is 32%, this threshold can be set by the function setInterrupt().
-
-![产品效果图](./resources/images/DFR0563.jpg)
-
-## Product Link([https://www.dfrobot.com/product-1734.html](https://www.dfrobot.com/product-1734.html))
- SKU: DFR0563
-
-## Table of Contents
-* [Summary](#summary)
-* [connection](connection)
-* [Installation](#installation)
-* [Methods](#methods)
-* [Compatibility](#compatibility)
-* [History](#history)
-* [Credits](#credits)
-
-## Summary
-
-Provides an Arduino library for reading and interperting MAX17043 data over I2C.
-
-## Connection
-Wires of the same color are linked together,and We only exemplify how these the boards are connected to the Fuel Gauge.
-When connecting , it is necessary to pay attention to the correspondence among pins, the connection diagram is as fellows.
-
-* Arduino UNO
-
-
-
-
-* ESP32
-
-
-
-
-
-## Installation
-
-To use this library download the zip file, uncomperss it to a folder named DFRobot_MAX17043 in Arduino library.
-## Methods
-
-```C++
- /**
- * @fn DFRobot_MAX17043
- * @brief create MAX17043 object
- * @return MAX17043 object
- */
- DFRobot_MAX17043();
- /**
- * @fn begin
- * @brief MAX17043 begin and test moudle
- *
- * @return initialization result
- * @retval 0 successful
- * @retval -1 faild
- */
- int begin();
- /**
- * @fn readVoltage
- * @brief read battery voltage in mV
- * @return voltage in mV
- */
- float readVoltage();
- /**
- * @fn readPercentage
- * @brief read battery remaining capacity in percentage
- *
- * @return battery remaining capacity in percentage
- */
- float readPercentage();
- /**
- * @fn setInterrupt
- * @brief set MAX17043 interrput threshold
- *
- * @param per interrupt threshold as %1 - 32% (integer)
- */
- void setInterrupt(uint8_t per);
- /**
- * @fn clearInterrupt
- * @brief clear MAX17043 interrupt
- */
- void clearInterrupt();
- /**
- * @fn setSleep
- * @brief set MAX17043 in sleep mode
- *
- */
- void setSleep();
- /**
- * @fn setWakeUp
- * @brief wake up MAX17043
- *
- */
- void setWakeUp();
-
-```
-
-## Compatibility
-
-| MCU | Work Well | Work Wrong | Untested | Remarks |
-| ------------------ | :-------: | :--------: | :------: | ------- |
-| FireBeetle-ESP32 | √ | | |
-| FireBeetle-ESP8266 | √ | | |
-| Arduino uno | √ | | |
-
-## History
-
-- 2018/04/14 - Version 1.0.0 released.
-
-## Credits
-
-Written by ouki.wang(ouki.wang@dfrobot.com), 2018. (Welcome to our [website](https://www.dfrobot.com/))
-
diff --git a/lib/lib_i2c/DFRobot_MAX17043/resources/images/DFR0563.jpg b/lib/lib_i2c/DFRobot_MAX17043/resources/images/DFR0563.jpg
deleted file mode 100644
index eb0370a56..000000000
Binary files a/lib/lib_i2c/DFRobot_MAX17043/resources/images/DFR0563.jpg and /dev/null differ
diff --git a/lib/lib_i2c/DFRobot_MAX17043/resources/images/Raspberry Pi.jpg b/lib/lib_i2c/DFRobot_MAX17043/resources/images/Raspberry Pi.jpg
deleted file mode 100644
index 3ab96c2cd..000000000
Binary files a/lib/lib_i2c/DFRobot_MAX17043/resources/images/Raspberry Pi.jpg and /dev/null differ
diff --git a/lib/lib_i2c/DFRobot_MAX17043/resources/images/UNO.jpg b/lib/lib_i2c/DFRobot_MAX17043/resources/images/UNO.jpg
deleted file mode 100644
index 8c3d66b65..000000000
Binary files a/lib/lib_i2c/DFRobot_MAX17043/resources/images/UNO.jpg and /dev/null differ
diff --git a/lib/lib_i2c/DFRobot_MAX17043/resources/images/esp32.jpg b/lib/lib_i2c/DFRobot_MAX17043/resources/images/esp32.jpg
deleted file mode 100644
index 41b163cfd..000000000
Binary files a/lib/lib_i2c/DFRobot_MAX17043/resources/images/esp32.jpg and /dev/null differ
diff --git a/tasmota/tasmota_xsns_sensor/xsns_110_max17043.ino b/tasmota/tasmota_xsns_sensor/xsns_110_max17043.ino
index 4a90f0b13..7c97be17e 100644
--- a/tasmota/tasmota_xsns_sensor/xsns_110_max17043.ino
+++ b/tasmota/tasmota_xsns_sensor/xsns_110_max17043.ino
@@ -27,10 +27,6 @@
* The alert flag and alert threshold are not required for MQTT, the alert pin is not used
* by this sensor driver.
*
- * Wiring and other information:
- *
- * \lib\lib_i2c\DFRobot_MAX17043\resources
- *
* Tested module(s):
*
* https://www.dfrobot.com/product-1734.html
@@ -45,16 +41,6 @@
#define XI2C_83 83 // See I2CDEVICES.md
#define MAX17043_ADDRESS 0x36
-
-//#define MAX17043_USE_LIB
-
-#ifdef MAX17043_USE_LIB
-
-#include "DFRobot_MAX17043.h"
-DFRobot_MAX17043 max17043_gauge; // Class to read from MAX17043
-
-#else
-
#define MAX17043_VCELL 0x02
#define MAX17043_SOC 0x04
#define MAX17043_MODE 0x06
@@ -62,30 +48,18 @@ DFRobot_MAX17043 max17043_gauge; // Class to read from MAX17043
#define MAX17043_CONFIG 0x0c
#define MAX17043_COMMAND 0xfe
-#endif // MAX17043_USE_LIB
-
bool max17043 = false;
/*********************************************************************************************/
void Max17043Init(void) {
if (I2cSetDevice(MAX17043_ADDRESS)) {
-
-#ifdef MAX17043_USE_LIB
-
- if (max17043_gauge.begin() == 0) {
-
-#else
-
I2cWrite16(MAX17043_ADDRESS, MAX17043_COMMAND, 0x5400); // Power on reset
delay(10);
if (I2cRead16(MAX17043_ADDRESS, MAX17043_CONFIG) == 0x971c) { // Default 0x971c
I2cWrite16(MAX17043_ADDRESS, MAX17043_MODE, 0x4000); // Quick start
I2cWrite16(MAX17043_ADDRESS, MAX17043_CONFIG, 0x9700);
delay(10);
-
-#endif // MAX17043_USE_LIB
-
max17043 = true;
I2cSetActiveFound(MAX17043_ADDRESS, "MAX17043");
}
@@ -93,20 +67,10 @@ void Max17043Init(void) {
}
void Max17043Show(bool json) {
-
-#ifdef MAX17043_USE_LIB
-
- float voltage = max17043_gauge.readVoltage() / 1000.0; // Battery voltage in Volt
- float percentage = max17043_gauge.readPercentage(); // Battery remaining charge in percent
-
-#else
-
float voltage = (1.25f * (float)(I2cRead16(MAX17043_ADDRESS, MAX17043_VCELL) >> 4)) / 1000.0; // Battery voltage in Volt
uint16_t per = I2cRead16(MAX17043_ADDRESS, MAX17043_SOC);
float percentage = (float)((per >> 8) + 0.003906f * (per & 0x00ff)); // Battery remaining charge in percent
-#endif // MAX17043_USE_LIB
-
// During charging the percentage might be (slightly) above 100%. To avoid strange numbers
// in the statistics the percentage provided by this driver will not go above 100%
if (percentage > 100.0) { percentage = 100.0; }