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