diff options
| author | Martin Braun <martin.braun@ettus.com> | 2017-05-12 16:55:54 -0700 |
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:53 -0800 |
| commit | 5a4a78de6104333307da68b6a0dfc516291ede69 (patch) | |
| tree | a8fad6471d5df0175dd55e4970a018a8cb2d09b4 /mpm/python/usrp_mpm/dboard_manager/lmk_mg.py | |
| parent | 9dee6175da45440997c8ed82fbf40f8f380dc4a7 (diff) | |
| download | uhd-5a4a78de6104333307da68b6a0dfc516291ede69.tar.gz uhd-5a4a78de6104333307da68b6a0dfc516291ede69.tar.bz2 uhd-5a4a78de6104333307da68b6a0dfc516291ede69.zip | |
mpm: Factored out common LMK04828 code
Diffstat (limited to 'mpm/python/usrp_mpm/dboard_manager/lmk_mg.py')
| -rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/lmk_mg.py | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py b/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py index 94d50527d..96795f7fd 100644 --- a/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py +++ b/mpm/python/usrp_mpm/dboard_manager/lmk_mg.py @@ -18,16 +18,15 @@ LMK04828 driver for use with Magnesium """ -from ..mpmlog import get_logger from time import sleep +from ..mpmlog import get_logger +from ..chips import LMK04828 -class LMK04828Mg(object): - def __init__(self, regs_iface, spi_lock): - self.regs_iface = regs_iface +class LMK04828Mg(LMK04828): + def __init__(self, regs_iface, spi_lock, slot=None): + LMK04828.__init__(self, regs_iface, slot) self.spi_lock = spi_lock self.log = get_logger("LMK04828") - assert hasattr(self.regs_iface, 'peek8') - assert hasattr(self.regs_iface, 'poke8') assert hasattr(self.spi_lock, 'lock') assert hasattr(self.spi_lock, 'unlock') @@ -95,22 +94,3 @@ class LMK04828Mg(object): self.log.trace("LMK init'd and locked") - def get_chip_id(self): - """ - Read back the chip ID - """ - # TODO: avoid deadlock by not locking when we already have lock (or use a recursive mutex internally) - #self.spi_lock.lock() - chip_id = self.regs_iface.peek8(0x03) - #self.spi_lock.unlock() - return chip_id - - def verify_chip_id(self): - """ - Returns True if the chip ID matches what we expect, False otherwise. - """ - chip_id = self.get_chip_id() - if chip_id != 6: - self.log.error("wrong chip id {0}".format(chip_id)) - return False - return True |
