def __init__(self, pi: pigpio.pi, ch: int, baud: int, data_ready_pin: int): self.pi = pi self.ch = ch self.baud = baud self.dr_pin = data_ready_pin pi.set_mode(data_ready_pin, pigpio.INPUT) pi.set_pull_up_down(data_ready_pin, pigpio.PUD_UP)
def __init__(self, pi: pigpio.pi, config): self.pi = pi self.enable_pin = config['enable-pin'] self.dir_pin = config['dir-pin'] self.step_pin = config['step-pin'] self.reverse = config['reverse-dir'] self.acceleration_profile = calculate_acceleration_profile( config['min-sps'], config['max-sps'], config['acceleration']) self.min_delay = 1 / config['max-sps'] self.max_delay = 1 / config['min-sps'] pi.set_mode(self.dir_pin, pigpio.OUTPUT) pi.set_mode(self.step_pin, pigpio.OUTPUT)
def __init__(self, pi: pigpio.pi, ch: int, baud: int, reset_pin: int, rs_pin: int): self.pi = pi self.ch = ch self.baud = baud self.reset_pin = reset_pin self.rs_pin = rs_pin pi.set_mode(reset_pin, pigpio.OUTPUT) pi.set_mode(rs_pin, pigpio.OUTPUT) pi.write(reset_pin, 1) pi.write(rs_pin, 0)
def __init__(self, pi: pigpio.pi, gpio: int, repeats: int = 6, bits: int = 12, gap: int = 9000, t_0: int = 300, t_1: int = 900) -> None: self.pi = pi self.gpio = gpio self.repeats = repeats self.bits = bits self.gap = gap self.t_0 = t_0 self.t_1 = t_1 self._make_waves() pi.set_mode(gpio, pigpio.OUTPUT)
def __init__(self, pi: pigpio.pi, gpio, callback=None, min_bits=8, max_bits=12, glitch=150): self.pi = pi self.gpio = gpio self.cb = callback self.min_bits = min_bits * 2 self.max_bits = max_bits * 2 self.glitch = glitch self._in_code = False self._edge = 0 self._code = 0 self._gap = 0 self._ready = False pi.set_mode(gpio, pigpio.INPUT) pi.set_glitch_filter(gpio, glitch) self._last_edge_tick = pi.get_current_tick() self._cb = pi.callback(gpio, pigpio.EITHER_EDGE, self._cbf)
def __init__(self, pi: pigpio.pi, mqttc: mqtt.Client, gpio): self.mqttc = mqttc self.gpio = gpio pi.set_glitch_filter(gpio, 300000) pi.set_mode(gpio, pigpio.INPUT) pi.callback(gpio, pigpio.EITHER_EDGE, self.on_edge)
def __init__(self, pi: pigpio.pi, bus: int = 1, addr: int = 0x27, width: int = 16, backlight_on: bool = True): self.pi = pi self.width = width self.backlight_on = backlight_on self.RS = (1 << 0) self.E = (1 << 2) self.BL = (1 << 3) self.B4 = 4 self._h = pi.i2c_open(bus, addr) self._init()
def __init__(self, pi: pigpio.pi, address=0x48): self.address = address self.pi = pi self.handle = pi.i2c_open(1, self.address, 0)
def __init__(self, pi: pigpio.pi, mqttc: mqtt.Client, gpio): self.mqttc = mqttc self.gpio = gpio pi.callback(gpio, 1, self.on_tilt) pi.callback(gpio, 0, self.on_tilt)