Example #1
0
	def writeEye(self, eye_buffer):
		long_buffer = tuple()
		for k in range(0, 8):
			#logipi.directWrite(0x0001, (eye_buffer[k],k+1, eye_buffer[k], k+1), 0)
			long_buffer = long_buffer +(eye_buffer[k],k+1, eye_buffer[k], k+1,)
		logipi.directWrite(self.mat_base_address, long_buffer[0:16], 0)
		#time.sleep(0.001)
		logipi.directWrite(self.mat_base_address, long_buffer[16:32], 0)
Example #2
0
def writeEye(eye_buffer):
    long_buffer = tuple()
    for k in range(0, 8):
        # logipi.directWrite(0x0001, (eye_buffer[k],k+1, eye_buffer[k], k+1), 0)
        long_buffer = long_buffer + (eye_buffer[k], k + 1, eye_buffer[k], k + 1)
    logipi.directWrite(0x0001, long_buffer[0:16], 0)
    time.sleep(0.001)
    logipi.directWrite(0x0001, long_buffer[16:32], 0)
Example #3
0
 def writeEye(self, eye_buffer):
     long_buffer = tuple()
     for k in range(0, 8):
         #logipi.directWrite(0x0001, (eye_buffer[k],k+1, eye_buffer[k], k+1), 0)
         long_buffer = long_buffer + (
             eye_buffer[k],
             k + 1,
             eye_buffer[k],
             k + 1,
         )
     logipi.directWrite(self.mat_base_address, long_buffer[0:16], 0)
     #time.sleep(0.001)
     logipi.directWrite(self.mat_base_address, long_buffer[16:32], 0)
Example #4
0
	def setAllPwm(self, val):
		logipi.directWrite(self.pwm_base_address+2, ((val & 0x00FF), val >> 8, (val & 0x00FF), val >> 8, (val & 0x00FF), val >> 8));
Example #5
0
	def setPwm(self, index, val):
		logipi.directWrite(self.pwm_base_address+(2+index), ((val & 0x00FF), val >> 8));
Example #6
0
	def setPwmPeriod(self, period):
		self.pwmPeriod = period ;
		logipi.directWrite(self.pwm_base_address+1, ((period & 0x00FF), period >> 8));	
Example #7
0
	def setPwmDivider(self, div):
		logipi.directWrite(self.pwm_base_address, ((div & 0x00FF), div >> 8));
Example #8
0
	def setServoPulse(self, index, pos):
		logipi.directWrite(self.servo_base_address[index], (pos,0));
Example #9
0
        else:
            pupil_buffer = pupil_buffer + (eye_ball[i],)
    return pupil_buffer


def writeEye(eye_buffer):
    long_buffer = tuple()
    for k in range(0, 8):
        # logipi.directWrite(0x0001, (eye_buffer[k],k+1, eye_buffer[k], k+1), 0)
        long_buffer = long_buffer + (eye_buffer[k], k + 1, eye_buffer[k], k + 1)
    logipi.directWrite(0x0001, long_buffer[0:16], 0)
    time.sleep(0.001)
    logipi.directWrite(0x0001, long_buffer[16:32], 0)


logipi.directWrite(0x0000, (0xFF, 0x00), 0)

logipi.directWrite(0x0010, (0x04, 0x00), 0)
logipi.directWrite(0x0011, (0x00, 0x08), 0)
intens = 0
while True:
    logipi.directWrite(0x0012, ((intens & 0x00FF), intens >> 8), 0)
    logipi.directWrite(0x0013, ((intens & 0x00FF), intens >> 8), 0)
    logipi.directWrite(0x0014, ((intens & 0x00FF), intens >> 8), 0)
    time.sleep(0.001)
    intens = intens + 1
    if intens > 0x0800:
        intens = 0


print logipi.directRead(0x0010, 2, 0)
Example #10
0
 def writeReg(self, val):
     logipi.directWrite(self.reg_base_address, ((val & 0x00FF), val >> 8))
Example #11
0
 def setAllPwm(self, val):
     logipi.directWrite(self.pwm_base_address + 2,
                        ((val & 0x00FF), val >> 8, (val & 0x00FF), val >> 8,
                         (val & 0x00FF), val >> 8))
Example #12
0
 def setPwm(self, index, val):
     logipi.directWrite(self.pwm_base_address + (2 + index),
                        ((val & 0x00FF), val >> 8))
Example #13
0
 def setPwmPeriod(self, period):
     self.pwmPeriod = period
     logipi.directWrite(self.pwm_base_address + 1,
                        ((period & 0x00FF), period >> 8))
Example #14
0
 def setPwmDivider(self, div):
     logipi.directWrite(self.pwm_base_address, ((div & 0x00FF), div >> 8))
Example #15
0
 def setServoPulse(self, index, pos):
     logipi.directWrite(self.servo_base_address[index], (pos, 0))
Example #16
0
	def writeReg(self, val):
		logipi.directWrite(self.reg_base_address, ((val & 0x00FF), val >> 8));
Example #17
0
	def initEye(self):
		logipi.directWrite(self.mat_base_address, (0x01,0x0C, 0x01, 0x0C), 0)
		logipi.directWrite(self.mat_base_address, (0xF1,0x0A, 0xF1, 0x0A), 0)
		logipi.directWrite(self.mat_base_address, (0x00,0x0F, 0x00, 0x0F), 0)
		logipi.directWrite(self.mat_base_address, (0x00,0x09, 0x00, 0x09), 0)
		logipi.directWrite(self.mat_base_address, (0x07,0x0B, 0x07, 0x0B), 0)
Example #18
0
 def initEye(self):
     logipi.directWrite(self.mat_base_address, (0x01, 0x0C, 0x01, 0x0C), 0)
     logipi.directWrite(self.mat_base_address, (0xF1, 0x0A, 0xF1, 0x0A), 0)
     logipi.directWrite(self.mat_base_address, (0x00, 0x0F, 0x00, 0x0F), 0)
     logipi.directWrite(self.mat_base_address, (0x00, 0x09, 0x00, 0x09), 0)
     logipi.directWrite(self.mat_base_address, (0x07, 0x0B, 0x07, 0x0B), 0)
		#WISHBONE MEMORY MAP
		# 0x0000 LEDs
		# 0x0001 SW
		# 0x0008 SSEG0
		# 0x0009 SSEG1
		# 0x000A SSEG2
		# 0x000B SSEG3
		# 0x000C SSEG4
		# 0x000D SSEG5
		# 0x000E SSEG6
		# 0x000F SSEG7
		# 0x0010 PB -- PB(0) is wired to reset
	
	if USE_WINDOWS==0 :
		count = logipi.directRead(0x00, 2)[0]
		logipi.directWrite(0x01, (sw_val, 0x00))
		logipi.directWrite(0x10, (pb_val, 0x00))
		#update sseg
		sseg1_val = logipi.directRead(0x08, 2)[0] # SSEG 0
		sseg2_val = logipi.directRead(0x08, 2)[1] #SSEG 1
		sseg3_val = logipi.directRead(0x09, 2)[0] # SSEG 2
		sseg4_val = logipi.directRead(0x09, 2)[1] # SSEG 3
	else:
		if WINDOWS_UPDATE_COUNT:
			count += 1  #AUTO INCREMENT
			sseg1_val += 1
			sseg2_val += 1
			sseg3_val += 1
			sseg4_val += 1
		else:
			count = 0xAA
Example #20
0
def writeEye(eye_buffer):
    long_buffer = tuple()
    for k in range(0, 8):
        #logipi.directWrite(0x0001, (eye_buffer[k],k+1, eye_buffer[k], k+1), 0)
        long_buffer = long_buffer + (
            eye_buffer[k],
            k + 1,
            eye_buffer[k],
            k + 1,
        )
    logipi.directWrite(0x0001, long_buffer[0:16], 0)
    time.sleep(0.001)
    logipi.directWrite(0x0001, long_buffer[16:32], 0)


logipi.directWrite(0x0000, (0xFF, 0x00), 0)

logipi.directWrite(0x0010, (0x04, 0x00), 0)
logipi.directWrite(0x0011, (0x00, 0x08), 0)
intens = 0
while True:
    logipi.directWrite(0x0012, ((intens & 0x00FF), intens >> 8), 0)
    logipi.directWrite(0x0013, ((intens & 0x00FF), intens >> 8), 0)
    logipi.directWrite(0x0014, ((intens & 0x00FF), intens >> 8), 0)
    time.sleep(0.001)
    intens = intens + 1
    if intens > 0x0800:
        intens = 0

print logipi.directRead(0x0010, 2, 0)
print logipi.directRead(0x0011, 2, 0)