Skip to content

Commit

Permalink
fix: adjust reset behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
elagil committed Jul 10, 2022
1 parent 6211cba commit 90e5a79
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion sigmadsp/dsp/adau1x01.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def soft_reset(self):
Not available on ADAU1x01
"""
logger.info("Soft-resetting the DSP is not available on ADAU1x01")
logger.info("Soft-reset is not available on ADAU1x01")

def safeload(self, address: int, data: bytes):
"""Write data to the chip using hardware safeload.
Expand Down
18 changes: 10 additions & 8 deletions sigmadsp/dsp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,18 @@ def hard_reset(self, delay: float = 0):
"""
pin = self.get_pin_by_name("reset")

if not pin:
logger.info("Falling back to soft-resetting the DSP, no hard-reset pin is defined.")
self.soft_reset()
return
if pin:
logger.info("Hard-resetting the DSP.")

pin.control.on()
time.sleep(delay)
pin.control.off()

logger.info("Hard-resetting the DSP.")
else:
logger.warning("No hard-reset pin is defined, not resetting.")

pin.control.on()
time.sleep(delay)
pin.control.off()
# Soft-reset in the end, for flushing registers.
self.soft_reset()

def write(self, address: int, data: bytes):
"""Write data to the DSP using the configured communication handler.
Expand Down
3 changes: 0 additions & 3 deletions sigmadsp/dsp/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,4 @@ def dsp_from_config(config: Dict) -> Dsp:
except (KeyError, TypeError):
logger.info("No DSP pin definitions were found in the configuration file.")

else:
dsp.hard_reset()

return dsp

0 comments on commit 90e5a79

Please sign in to comment.