From d79678a0cc2d7e3192442415d9d14237a74a9b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20NEDJAR?= Date: Sun, 15 Mar 2026 10:55:48 +0100 Subject: [PATCH] bq27441: Add reset() method for hardware reset. --- lib/bq27441/bq27441/device.py | 6 +++++- tests/scenarios/bq27441.yaml | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/bq27441/bq27441/device.py b/lib/bq27441/bq27441/device.py index 068a1899..58ebc9e3 100644 --- a/lib/bq27441/bq27441/device.py +++ b/lib/bq27441/bq27441/device.py @@ -454,7 +454,11 @@ def write_op_config(self, value): # OpConfig register location: BQ27441_ID_REGISTERS id, offset 0 return self.write_extended_data(BQ27441_ID_REGISTERS, 0, op_config_data, 2) - # Issue a soft - reset to the BQ27441 - G1A + # Full reset of the BQ27441-G1A + def reset(self): + return self.execute_control_word(BQ27441_CONTROL_RESET) + + # Soft reset (resimulation) of the BQ27441-G1A def soft_reset(self): return self.execute_control_word(BQ27441_CONTROL_SOFT_RESET) diff --git a/tests/scenarios/bq27441.yaml b/tests/scenarios/bq27441.yaml index a1ae1c6c..5c01480e 100644 --- a/tests/scenarios/bq27441.yaml +++ b/tests/scenarios/bq27441.yaml @@ -67,6 +67,17 @@ tests: expect: 185 mode: [mock] + - name: "Reset sends CONTROL_RESET command" + action: script + script: | + i2c.clear_write_log() + dev.reset() + log = i2c.get_write_log() + wrote_reset = any(reg == 0x00 and data[0] == 0x41 for reg, data in log) + result = wrote_reset + expect_true: true + mode: [mock] + - name: "Read state of health" action: call method: state_of_health