Skip to content

Commit

Permalink
Added begin(TwoWire*)
Browse files Browse the repository at this point in the history
  • Loading branch information
porrey committed Sep 27, 2021
1 parent 6d26e49 commit 7ed871f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 22 deletions.
3 changes: 3 additions & 0 deletions examples/MAX17043/MAX17043.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ void setup()
// begin(bool initializeWire, uint32_t address)
// begin(int sda, int scl) [esp only]
// begin(int sda, int scl, uint8_t) [esp only]
// bool begin(TwoWire* wire); [pass &Wire or &Wire1 for example]
// bool begin(TwoWire* wire, uint8_t address);
// bool begin(TwoWire* wire, bool initializeWire, uint8_t address);

//
// Display an initial reading.
Expand Down
3 changes: 3 additions & 0 deletions examples/MAX17044/MAX17044.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ void setup()
// begin(bool initializeWire, uint32_t address)
// begin(int sda, int scl) [esp only]
// begin(int sda, int scl, uint8_t) [esp only]
// bool begin(TwoWire* wire); [pass &Wire or &Wire1 for example]
// bool begin(TwoWire* wire, uint8_t address);
// bool begin(TwoWire* wire, bool initializeWire, uint8_t address);

//
// Display an initial reading.
Expand Down
3 changes: 3 additions & 0 deletions examples/MAX1704X_0x32/MAX1704X_0x32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ void setup()
// begin(bool initializeWire)
// begin(int sda, int scl) [esp only]
// begin(int sda, int scl, uint8_t) [esp only]
// bool begin(TwoWire* wire); [pass &Wire or &Wire1 for example]
// bool begin(TwoWire* wire, uint8_t address);
// bool begin(TwoWire* wire, bool initializeWire, uint8_t address);

//
// Display an initial reading.
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=MAX1704X
version=1.2.3
version=1.2.4
author=Daniel Porrey
maintainer=Daniel Porrey
sentence=Arduino library for MAX17043/MAX17044 lithium ion battery fuel gauge.
Expand Down
60 changes: 39 additions & 21 deletions src/MAX1704X.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
* MAX1704X Arduino Library for MAX17043 and MAX17044 Fuel Gauge.
*
* Copyright © 2018-2021 Daniel Porrey. All Rights Reserved.
* https://github.com/porrey/max1704x
*
* This file is part of the MAX1704X Arduino Library.
*
* The MAX1704X Arduino Library is free software: you can redistribute
* it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* The MAX1704X Arduino Library is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the MAX1704X Arduino Library. If not,
* see http://www.gnu.org/licenses/.
*/
MAX1704X Arduino Library for MAX17043 and MAX17044 Fuel Gauge.
Copyright © 2018-2021 Daniel Porrey. All Rights Reserved.
https://github.com/porrey/max1704x
This file is part of the MAX1704X Arduino Library.
The MAX1704X Arduino Library is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
The MAX1704X Arduino Library is distributed in the hope that it
will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the MAX1704X Arduino Library. If not,
see http://www.gnu.org/licenses/.
*/
#include "MAX1704X.h"

MAX1704X::MAX1704X(float voltageIncrement)
Expand Down Expand Up @@ -59,6 +59,24 @@ bool MAX1704X::begin(bool initializeWire, uint8_t address)
return returnValue;
}

bool MAX1704X::begin(TwoWire* wire)
{
this->_wire = wire;
return this->begin();
}

bool MAX1704X::begin(TwoWire* wire, uint8_t address)
{
this->_wire = wire;
return this->begin(address);
}

bool MAX1704X::begin(TwoWire* wire, bool initializeWire, uint8_t address)
{
this->_wire = wire;
return this->begin(initializeWire, address);
}

#if defined(ESP8266) || defined(ESP32)
bool MAX1704X::begin(int sda, int scl)
{
Expand Down
3 changes: 3 additions & 0 deletions src/MAX1704X.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class MAX1704X
bool begin();
bool begin(bool);
bool begin(bool, uint8_t);
bool begin(TwoWire*);
bool begin(TwoWire*, uint8_t);
bool begin(TwoWire*, bool, uint8_t);
#if defined(ESP8266) || defined(ESP32)
bool begin(int, int);
bool begin(int, int, uint8_t);
Expand Down

0 comments on commit 7ed871f

Please sign in to comment.