|
35 | 35 |
|
36 | 36 | LC709023F_I2CADDR_DEFAULT = const(0x0B)
|
37 | 37 | LC709203F_CMD_ICVERSION = const(0x11)
|
| 38 | +LC709203F_CMD_BATTPROF = const(0x12) |
38 | 39 | LC709203F_CMD_POWERMODE = const(0x15)
|
39 | 40 | LC709203F_CMD_APA = const(0x0B)
|
40 | 41 | LC709203F_CMD_INITRSOC = const(0x07)
|
@@ -100,6 +101,7 @@ def __init__(self, i2c_bus, address=LC709023F_I2CADDR_DEFAULT):
|
100 | 101 | self._buf = bytearray(10)
|
101 | 102 | self.power_mode = PowerMode.OPERATE # pylint: disable=no-member
|
102 | 103 | self.pack_size = PackSize.MAH500 # pylint: disable=no-member
|
| 104 | + self.battery_profile = 1 |
103 | 105 | self.init_RSOC()
|
104 | 106 |
|
105 | 107 | def init_RSOC(self): # pylint: disable=invalid-name
|
@@ -132,6 +134,17 @@ def power_mode(self, mode):
|
132 | 134 | raise AttributeError("power_mode must be a PowerMode")
|
133 | 135 | self._write_word(LC709203F_CMD_POWERMODE, mode)
|
134 | 136 |
|
| 137 | + @property |
| 138 | + def battery_profile(self): |
| 139 | + """Returns current battery profile (0 or 1)""" |
| 140 | + return self._read_word(LC709203F_CMD_BATTPROF) |
| 141 | + |
| 142 | + @battery_profile.setter |
| 143 | + def battery_profile(self, mode): |
| 144 | + if not mode in (0, 1): |
| 145 | + raise AttributeError("battery_profile must be 0 or 1") |
| 146 | + self._write_word(LC709203F_CMD_BATTPROF, mode) |
| 147 | + |
135 | 148 | @property
|
136 | 149 | def pack_size(self):
|
137 | 150 | """Returns current battery pack size"""
|
|
0 commit comments