def __init__(self,pno=4,bsz=1024,dbgport=None):
self.BUFSZ=int(pow(2, math.ceil(math.log(bsz)/math.log(2))))
self.MASK=self.BUFSZ-1
self.pin=pno
self.ir=Pin(pno,Pin.IN)
self.buf=array.array('i',0 for i in range(self.BUFSZ))
self.ledge=0
self.wptr=0
self.rptr=0
self.dbgport=dbgport
if dbgport is None:
self.dbgport=DummyPort()
self.dbgport.low()
# cache ticks functions for native call
self.ticks_diff = time.ticks_diff
self.ticks_us = time.ticks_us
self.start()
评论列表
文章目录