From e68cda3b7502469bff5c8f393528c79df10d64a2 Mon Sep 17 00:00:00 2001 From: Trung N Tran Date: Thu, 3 Aug 2017 14:31:58 -0700 Subject: n310: add init value for sysfs_gpio --- mpm/python/usrp_mpm/sysfs_gpio.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mpm/python/usrp_mpm/sysfs_gpio.py b/mpm/python/usrp_mpm/sysfs_gpio.py index ea423dc00..bbd428c0d 100644 --- a/mpm/python/usrp_mpm/sysfs_gpio.py +++ b/mpm/python/usrp_mpm/sysfs_gpio.py @@ -101,21 +101,26 @@ class SysFSGPIO(object): API for accessing GPIOs mapped into userland via sysfs """ - def __init__(self, label, use_mask, ddr): + def __init__(self, label, use_mask, ddr, init_value=0): assert (use_mask & ddr) == ddr self.log = get_logger("SysFSGPIO") self._label = label self._use_mask = use_mask self._ddr = ddr + self._init_value = init_value self.log.trace("Generating SysFSGPIO object for label `{}'...".format(label)) self._gpio_dev, self._map_info = find_gpio_device(label, self.log) if self._gpio_dev is None: self.log.error("Could not find GPIO device with label `{}'.".format(label)) self.log.trace("GPIO base number is {}".format(self._map_info.get("sys_number"))) self._base_gpio = self._map_info.get("sys_number") - self.init(self._map_info['ngpio'], self._base_gpio, self._use_mask, self._ddr) + self.init(self._map_info['ngpio'], + self._base_gpio, + self._use_mask, + self._ddr, + self._init_value) - def init(self, n_gpio, base, use_mask, ddr): + def init(self, n_gpio, base, use_mask, ddr, init_value=0): """ Guarantees that all the devices are created accordingly @@ -127,11 +132,13 @@ class SysFSGPIO(object): for gpio_idx in gpio_list: gpio_num = base + gpio_idx ddr_out = ddr & (1<