|
59 | 59 | LC709203F_CMD_CELLTEMPERATURE = const(0x08)
|
60 | 60 | LC709203F_CMD_THERMISTORB = const(0x06)
|
61 | 61 | LC709203F_CMD_STATUSBIT = const(0x16)
|
| 62 | +LC709203F_CMD_ALARMPERCENT = const(0x13) |
| 63 | +LC709203F_CMD_ALARMVOLTAGE = const(0x14) |
62 | 64 |
|
63 | 65 |
|
64 | 66 | class CV:
|
@@ -233,6 +235,32 @@ def thermistor_enable(self, status: bool) -> None:
|
233 | 235 | raise ValueError("thermistor_enable must be True or False")
|
234 | 236 | self._write_word(LC709203F_CMD_STATUSBIT, status)
|
235 | 237 |
|
| 238 | + @property |
| 239 | + def low_voltage_alarm_percent(self) -> int: |
| 240 | + """Return the current low voltage alarm percentage. |
| 241 | + 0 indicates disabled.""" |
| 242 | + return self._read_word(LC709203F_CMD_ALARMPERCENT) |
| 243 | + |
| 244 | + @low_voltage_alarm_percent.setter |
| 245 | + def low_voltage_alarm_percent(self, percent: int) -> None: |
| 246 | + """Set the low voltage alarm percentage. |
| 247 | + Value of 0 disables the alarm""" |
| 248 | + if not 0 <= percent <= 100: |
| 249 | + raise ValueError("alarm voltage percent must be 0-100") |
| 250 | + self._write_word(LC709203F_CMD_ALARMPERCENT, percent) |
| 251 | + |
| 252 | + @property |
| 253 | + def low_voltage_alarm(self) -> int: |
| 254 | + """Return the current low voltage alarm value in mV |
| 255 | + 0 indicates disabled""" |
| 256 | + return self._read_word(LC709203F_CMD_ALARMVOLTAGE) |
| 257 | + |
| 258 | + @low_voltage_alarm.setter |
| 259 | + def low_voltage_alarm(self, voltage: int) -> None: |
| 260 | + """Set the low voltage alarm value in mV. |
| 261 | + Value of 0 disables the alarm.""" |
| 262 | + self._write_word(LC709203F_CMD_ALARMVOLTAGE, voltage) |
| 263 | + |
236 | 264 | # pylint: disable=no-self-use
|
237 | 265 | def _generate_crc(self, data: ReadableBuffer) -> int:
|
238 | 266 | """8-bit CRC algorithm for checking data"""
|
|
0 commit comments