我们从Python开源项目中,提取了以下14个代码示例,用于说明如何使用machine.disable_irq()。
def reset(self): """ Perform the onewire reset function. Returns True if a device asserted a presence pulse, False otherwise. """ sleep_us = time.sleep_us disable_irq = machine.disable_irq enable_irq = machine.enable_irq pin = self.pin pin(0) sleep_us(480) i = disable_irq() pin(1) sleep_us(60) status = not pin() enable_irq(i) sleep_us(420) return status
def read_bit(self): sleep_us = time.sleep_us enable_irq = machine.enable_irq pin = self.pin pin(1) # half of the devices don't match CRC without this line i = machine.disable_irq() pin(0) sleep_us(1) pin(1) sleep_us(1) value = pin() enable_irq(i) sleep_us(40) return value
def write_bit(self, value): sleep_us = time.sleep_us pin = self.pin i = machine.disable_irq() pin(0) sleep_us(1) pin(value) sleep_us(60) pin(1) sleep_us(1) machine.enable_irq(i)
def acquire_out_buffer(self): while self.out_buffer_lock == True: time.sleep_ms(1) # Wait for release self.irqstate=machine.disable_irq() if self.out_buffer_lock == True: # TODO: check if this locking is enough machine.enable_irq(self.irqstate) return False self.out_buffer_lock=True return True
def noInterrupts(): _irqsts=disable_irq() return _irqsts
def reset(self): state=disable_irq() self.wptr=0 self.rptr=0 enable_irq(state)