Functions |
| def | dump_cmd |
| def | prepare_cmd |
Variables |
| tuple | dev = c.comedi_open('/dev/comedi0') |
| tuple | fd = c.comedi_fileno(dev) |
| int | freq = 1000 |
| int | subdevice = 0 |
| int | nscans = 8000 |
| int | secs = 10 |
| list | chans = [0,1,2,3] |
| list | gains = [0,0,0,0] |
| list | aref = [c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND, c.AREF_GROUND] |
| list | cmdtest_messages |
| tuple | nchans = len(chans) |
| tuple | mylist = c.chanlist(nchans) |
| tuple | size = c.comedi_get_buffer_size(dev, subdevice) |
| tuple | map = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_READ) |
| tuple | cmd = c.comedi_cmd_struct() |
| | ret = c.comedi_get_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi buffer size" else: print "buffer size = ", ret ret = c.comedi_get_max_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi max buff size" else: print "max buff size = ", ret construct a comedi command
|
| tuple | ret = c.comedi_command_test(dev,cmd) |
| | nbytes = front - back chunk_limit = (nbytes / size) * size # count for "size" sized chunks remainder = nbytessize # bytes left after chunk_limit chunks done for i in range(0,chunk_limit,size): DATA.fromstring(map.read(size)) # read chunks for i in range(0,remainder,2): DATA.fromstring(map.read(2)) # read remaining bytes
|
| int | front = 0 |
| int | back = 0 |
| tuple | of = open("stream_log.bin","wb") |
| string | format = "H" |
| int | flag = 1 |
| | print "front = ", front
|
| int | time_limit = 2 |
| tuple | t0 = time.time() |
| tuple | t1 = time.time() |
| tuple | DATA = array.array("H") |
ret = c.comedi_get_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi buffer size" else: print "buffer size = ", ret ret = c.comedi_get_max_buffer_size(dev, subdevice) if ret==-1: raise "Error fetching comedi max buff size" else: print "max buff size = ", ret construct a comedi command
Definition at line 116 of file mmap.py.
nbytes = front - back chunk_limit = (nbytes / size) * size # count for "size" sized chunks remainder = nbytessize # bytes left after chunk_limit chunks done for i in range(0,chunk_limit,size): DATA.fromstring(map.read(size)) # read chunks for i in range(0,remainder,2): DATA.fromstring(map.read(2)) # read remaining bytes
time.sleep(.01)
Definition at line 130 of file mmap.py.