Skip to content

Correct LC709023F to LC709203F #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions adafruit_lc709203f.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LC709203F.git"

LC709023F_I2CADDR_DEFAULT = const(0x0B)
LC709203F_I2CADDR_DEFAULT = const(0x0B)
LC709203F_CMD_ICVERSION = const(0x11)
LC709203F_CMD_BATTPROF = const(0x12)
LC709203F_CMD_POWERMODE = const(0x15)
Expand Down Expand Up @@ -93,10 +93,10 @@ class PackSize(CV):
)


class LC709023F:
"""Interface library for LC709023F battery monitoring and fuel gauge sensors"""
class LC709203F:
"""Interface library for LC709203F battery monitoring and fuel gauge sensors"""

def __init__(self, i2c_bus, address=LC709023F_I2CADDR_DEFAULT):
def __init__(self, i2c_bus, address=LC709203F_I2CADDR_DEFAULT):
self.i2c_device = i2c_device.I2CDevice(i2c_bus, address)
self._buf = bytearray(10)
self.power_mode = PowerMode.OPERATE # pylint: disable=no-member
Expand Down Expand Up @@ -171,7 +171,7 @@ def _generate_crc(self, data):
return crc & 0xFF

def _read_word(self, command):
self._buf[0] = LC709023F_I2CADDR_DEFAULT * 2 # write byte
self._buf[0] = LC709203F_I2CADDR_DEFAULT * 2 # write byte
self._buf[1] = command # command / register
self._buf[2] = self._buf[0] | 0x1 # read byte

Expand All @@ -185,7 +185,7 @@ def _read_word(self, command):
return (self._buf[4] << 8) | self._buf[3]

def _write_word(self, command, data):
self._buf[0] = LC709023F_I2CADDR_DEFAULT * 2 # write byte
self._buf[0] = LC709203F_I2CADDR_DEFAULT * 2 # write byte
self._buf[1] = command # command / register
self._buf[2] = data & 0xFF
self._buf[3] = (data >> 8) & 0xFF
Expand Down
6 changes: 3 additions & 3 deletions examples/lc709203f_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import time
import board
from adafruit_lc709203f import LC709023F
from adafruit_lc709203f import LC709203F

print("LC709023F simple test")
print("LC709203F simple test")
print("Make sure LiPoly battery is plugged into the board!")

sensor = LC709023F(board.I2C())
sensor = LC709203F(board.I2C())

print("IC version:", hex(sensor.ic_version))
while True:
Expand Down