Skip to content

Commit 8c5600f

Browse files
committed
bq27441: Add reset() method for hardware reset.
1 parent 2bce3f8 commit 8c5600f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/bq27441/bq27441/device.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,11 @@ def write_op_config(self, value):
454454
# OpConfig register location: BQ27441_ID_REGISTERS id, offset 0
455455
return self.write_extended_data(BQ27441_ID_REGISTERS, 0, op_config_data, 2)
456456

457-
# Issue a soft - reset to the BQ27441 - G1A
457+
# Full reset of the BQ27441-G1A
458+
def reset(self):
459+
return self.execute_control_word(BQ27441_CONTROL_RESET)
460+
461+
# Soft reset (resimulation) of the BQ27441-G1A
458462
def soft_reset(self):
459463
return self.execute_control_word(BQ27441_CONTROL_SOFT_RESET)
460464

tests/scenarios/bq27441.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ tests:
6767
expect: 185
6868
mode: [mock]
6969

70+
- name: "Reset sends CONTROL_RESET command"
71+
action: script
72+
script: |
73+
i2c.clear_write_log()
74+
dev.reset()
75+
log = i2c.get_write_log()
76+
wrote_reset = any(reg == 0x00 and data[0] == 0x41 for reg, data in log)
77+
result = wrote_reset
78+
expect_true: true
79+
mode: [mock]
80+
7081
- name: "Read state of health"
7182
action: call
7283
method: state_of_health

0 commit comments

Comments
 (0)