diff --git a/docs/en/api/power.md b/docs/en/api/power.md index ef3e2de9..8e5c47b0 100644 --- a/docs/en/api/power.md +++ b/docs/en/api/power.md @@ -131,11 +131,18 @@ This function checks the state of the charge **Definition:** ```arduino -bool canControl(){ +bool isCharging(){ uint8_t data; Wire.beginTransmission(IP5306_ADDR); Wire.write(IP5306_REG_READ0); - return(Wire.endTransmission()==0); + Wire.endTransmission(false); + if(Wire.requestFrom(IP5306_ADDR, 1)) + { + data = Wire.read(); + if (data & (1 << CHARGE_FULL_BIT)) return true; + else return false; + } + return false; } ``` diff --git a/docs/ja/api/power.md b/docs/ja/api/power.md index f9949d96..5ae62b46 100644 --- a/docs/ja/api/power.md +++ b/docs/ja/api/power.md @@ -131,11 +131,18 @@ bool canControl(){ **定義:** ```arduino -bool canControl(){ +bool isCharging(){ uint8_t data; Wire.beginTransmission(IP5306_ADDR); Wire.write(IP5306_REG_READ0); - return(Wire.endTransmission()==0); + Wire.endTransmission(false); + if(Wire.requestFrom(IP5306_ADDR, 1)) + { + data = Wire.read(); + if (data & (1 << CHARGE_FULL_BIT)) return true; + else return false; + } + return false; } ``` diff --git a/docs/zh_CN/api/power.md b/docs/zh_CN/api/power.md index 3b1e5f26..c8ac5461 100644 --- a/docs/zh_CN/api/power.md +++ b/docs/zh_CN/api/power.md @@ -121,11 +121,18 @@ bool canControl(){ **函数实现:** ```arduino -bool canControl(){ +bool isCharging(){ uint8_t data; Wire.beginTransmission(IP5306_ADDR); Wire.write(IP5306_REG_READ0); - return(Wire.endTransmission()==0); + Wire.endTransmission(false); + if(Wire.requestFrom(IP5306_ADDR, 1)) + { + data = Wire.read(); + if (data & (1 << CHARGE_FULL_BIT)) return true; + else return false; + } + return false; } ```