Beispiel #1
0
    def __init__(self, thread_id, name):           
        threading.Thread.__init__(self)
        
        self.stimulus_onset_time = 0
        self.local_status = 0
        self.mask = 0x0000 if IsMRI == 0  else 0x001f
        
        # Open comunication with Vpixx
        DPxOpen()
        
        #Select the correct device
        DPxSelectDevice('PROPixxCtrl')
        DPxSetMarker()
        self.stimulus_onset_time = DPxGetMarker()
        DPxEnableDinDebounce()              # Filter out button bounce
        self.local_status = DPxSetDinLog()        # Configure logging with default values
        DPxStartDinLog()
        DPxUpdateRegCache()

        # Thread infos        
        self.thread_id = thread_id
        self.name = name
        
        # Every button has: its value {0,1} and time when it changed (as datetime)
        self.button_state = {'time': np.array([dt.now()]*5), 'state': np.zeros((5,),dtype=np.int8)}
        self.button_state['state'][-1] = 1
        self._stop_event = threading.Event()
Beispiel #2
0
 
 This demo opens the device, stops any current running schedule,
 sets the ram/buffer for our update synchronization on video signal,
 and starts right away.
  
The arguments of DPxSetDoutSched(onset, rateValue, rateUnits, count) are as follow:
Onset: 0, starts now.
Rate: 2, on/off happens once per frame.
Units: 'video', per video frame.
Duration: 0, lasts until the schedule is stopped.
 """
 from pypixxlib._libdpx import DPxOpen, DPxSelectDevice, DPxStopDoutSched, \
    DPxUpdateRegCache, DPxGetDoutBuffBaseAddr, DPxSetDoutBuff, DPxWriteRam, \
    DPxSetDoutSched, DPxStartDoutSched

DPxOpen()
DPxSelectDevice('PROPixx Ctrl')
DPxStopDoutSched()
DPxUpdateRegCache()


base_address = DPxGetDoutBuffBaseAddr()
buffer_dout = [0xFFFF, 0]
DPxSetDoutBuff(base_address, 4)
DPxWriteRam(base_address, buffer_dout)
DPxSetDoutSched(0, 2, 'video', 0) 

DPxUpdateRegCache()

DPxStartDoutSched()
DPxUpdateRegCache()