Пример #1
0
 def _enable_event_detect(self):
     lgpio.gpio_claim_alert(
         self.factory._handle, self.number, self._edges,
         lgpio.gpio_get_mode(self.factory._handle, self.number)
         & self.GPIO_LINE_FLAGS_MASK)
     self._callback = lgpio.callback(self.factory._handle, self.number,
                                     self._edges, self._call_when_changed)
Пример #2
0
 def _disable_event_detect(self):
     if self._callback is not None:
         self._callback.cancel()
         self._callback = None
     lgpio.gpio_claim_input(
         self.factory._handle, self.number,
         lgpio.gpio_get_mode(self.factory._handle, self.number)
         & self.GPIO_LINE_FLAGS_MASK)
Пример #3
0
 def _get_pull(self):
     mode = lgpio.gpio_get_mode(self.factory._handle, self.number)
     if mode & self.GPIO_IS_BIAS_PULL_UP:
         return 'up'
     elif mode & self.GPIO_IS_BIAS_PULL_DOWN:
         return 'down'
     else:
         return 'floating'
Пример #4
0
 def _get_function(self):
     mode = lgpio.gpio_get_mode(self.factory._handle, self.number)
     return ['input', 'output'][bool(mode & self.GPIO_IS_OUT)]
Пример #5
0
status, dummy = sbc.group_read(9999, 8888)
check("group_read 1", sbc.BAD_HANDLE, status)

status = sbc.group_write(9999, 8888, 7777)
check("group_write 1", sbc.BAD_HANDLE, status)

status = sbc.gpiochip_open(9999)
check("gpiochip_open 1", sbc.CANNOT_OPEN_CHIP, status)

status, lines, name, label = sbc.gpio_get_chip_info(9999)
check("gpio_get_chip_info 1", sbc.BAD_HANDLE, status)

status, offset, flags, name, user = sbc.gpio_get_line_info(9999, 8888)
check("gpio_get_line_info 1", sbc.BAD_HANDLE, status)

status = sbc.gpio_get_mode(9999, 8888)
check("gpio_get_mode 1", sbc.BAD_HANDLE, status)

status = sbc.gpio_read(9999, 8888)
check("gpio_read 1", sbc.BAD_HANDLE, status)

status = sbc.gpio_free(9999, 8888)
check("gpio_free 1", sbc.BAD_HANDLE, status)

status = sbc.group_free(9999, 8888)
check("group_free 1", sbc.BAD_HANDLE, status)

status = sbc.tx_pulse(9999, 8888, 7777, 6666, 5555, 4444)
check("tx_pulse 1", sbc.BAD_HANDLE, status)

status = sbc.tx_pwm(9999, 8888, 7777, 6666, 5555, 4444)