diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-05-31 18:19:30 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:58 -0800 |
commit | 2bd564ca225cbf1d02eb5025315bb67fe458ba00 (patch) | |
tree | d295f722df18cad84a7aa9db6d7f084dfa6b4338 | |
parent | d16d342be2dee7fef1f798349eba211cce0f27f9 (diff) | |
download | uhd-2bd564ca225cbf1d02eb5025315bb67fe458ba00.tar.gz uhd-2bd564ca225cbf1d02eb5025315bb67fe458ba00.tar.bz2 uhd-2bd564ca225cbf1d02eb5025315bb67fe458ba00.zip |
mpm: Replaced xrange with range for better Python future-proofing
-rw-r--r-- | mpm/python/usrp_mpm/cores/tdc_sync.py | 6 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/eiscat.py | 2 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py | 2 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/sysfs_gpio.py | 2 | ||||
-rwxr-xr-x | mpm/tools/mpm_debug.py | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/mpm/python/usrp_mpm/cores/tdc_sync.py b/mpm/python/usrp_mpm/cores/tdc_sync.py index c3cc308a0..6d680d32f 100644 --- a/mpm/python/usrp_mpm/cores/tdc_sync.py +++ b/mpm/python/usrp_mpm/cores/tdc_sync.py @@ -14,7 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # """ -TDC sync foo +TDC clock synchronization """ import time @@ -193,7 +193,7 @@ class ClockSynchronizer(object): # Now, read off 512 measurements and take the mean of them. num_meas = 256 # FIXME back to 512 self.log.trace("Reading {} TDC measurements from device...".format(num_meas)) - current_value = mean([measure_offset() for _ in xrange(num_meas)]) + current_value = mean([measure_offset() for _ in range(num_meas)]) # Run the initial value through the oracle to determine the adjustments to make. target_values = [135e-9,] # only one target for now that all DBs shift to @@ -232,7 +232,7 @@ class ClockSynchronizer(object): Return the offset (in seconds) the whatever what measured and whatever the reference is. """ - for _ in xrange(1000): # TODO replace with poll & timeout + for _ in range(1000): # TODO replace with poll & timeout rtc_offset_msb = self.peek32(self.RTC_OFFSET_1) updated = (rtc_offset_msb & 0x100) == 0x100 if updated: diff --git a/mpm/python/usrp_mpm/dboard_manager/eiscat.py b/mpm/python/usrp_mpm/dboard_manager/eiscat.py index 0b76c88ee..4a4d4a256 100644 --- a/mpm/python/usrp_mpm/dboard_manager/eiscat.py +++ b/mpm/python/usrp_mpm/dboard_manager/eiscat.py @@ -439,7 +439,7 @@ class EISCAT(DboardManagerBase): slot_idx, core_idx, self.log - ) for core_idx in xrange(2) + ) for core_idx in range(2) ] def _init_spi_devices(): " Returns abstraction layers to all the SPI devices " diff --git a/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py b/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py index d6975fea6..3affdc3e9 100644 --- a/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py +++ b/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py @@ -213,7 +213,7 @@ class LMK04828EISCAT(LMK04828): (0x132, ddly_value), # Hidden register. Write the same as previous based on inc/dec. (0x144, 0xB1), # Enable SYNC on outputs 2,4,6,12 )) - for x in xrange(abs(num_shifts)): + for x in range(abs(num_shifts)): self.poke8(0x142, 0x1) self.poke8(0x144, 0xFF) # Disable SYNC on all outputs diff --git a/mpm/python/usrp_mpm/sysfs_gpio.py b/mpm/python/usrp_mpm/sysfs_gpio.py index fd06ad10d..fa07921d8 100644 --- a/mpm/python/usrp_mpm/sysfs_gpio.py +++ b/mpm/python/usrp_mpm/sysfs_gpio.py @@ -121,7 +121,7 @@ class SysFSGPIO(object): E.g., if use_mask & 0x1 is True, it makes sure that 'gpioXXX' is exported. Also sets the DDRs. """ - gpio_list = [x for x in xrange(n_gpio) if (1<<x) & use_mask] + gpio_list = [x for x in range(n_gpio) if (1<<x) & use_mask] self.log.trace("Initializing {} GPIOs...".format(len(gpio_list))) for gpio_idx in gpio_list: gpio_num = base + gpio_idx diff --git a/mpm/tools/mpm_debug.py b/mpm/tools/mpm_debug.py index dff1c78bd..b1f0b28a2 100755 --- a/mpm/tools/mpm_debug.py +++ b/mpm/tools/mpm_debug.py @@ -56,7 +56,7 @@ def echo(address, port): sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM) - message = "MPM-ECHO" + bytearray(random.getrandbits(8) for _ in xrange(8000-8)) + message = "MPM-ECHO" + bytearray(random.getrandbits(8) for _ in range(8000-8)) sock.sendto(message, (address, port)) sock.settimeout(0.05) # wait max 50 ms while True: |