#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:
	'''Now we have initialized everything, lets start with the main part'''
	
	'''Get the co ordinate for the edges of the screen'''
	screenboundx, screenboundy = screen.get_size()
	'''Get the X and Y mouse positions to variables called x and y'''
	mousex,mousey = pygame.mouse.get_pos()
	
	#print "mouse x" , mousex
	#print "mouse y" , mousey
	
	'''
	x -= mousewidth  x = x - mousewidth
	Take half of the width of the limage from the mouse co-ordinate
	So the mouse is in the middle of the image
	'''
	mousex -= mouse.get_width()/2
	mousey -= 10

	
	'''Draw the crosshairs to the screen at the co ordinates we just worked out'''
	screen.blit(mouse, (mousex,mousey))
	
	'''Limit screen updates to 20 frames per second so we dont use 100% cpu time'''
	#clock.tick(20)
	clock.tick(20)
	#count += 1
	(count, switches) = logipi.directRead(0x00, 2)
	#print count
	'''Finish off by update the full display surface to the screen'''
	pygame.display.update()
Exemplo n.º 3
0
	def readReg(self):
		val_tuple = logipi.directRead(self.reg_base_address, 2);
		val = val_tuple[0]+(val_tuple[1] << 8)
		return val
Exemplo n.º 4
0
 def readReg(self):
     val_tuple = logipi.directRead(self.reg_base_address, 2)
     val = val_tuple[0] + (val_tuple[1] << 8)
     return val
Exemplo n.º 5
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)
print logipi.directRead(0x0012, 2, 0)
print logipi.directRead(0x0013, 2, 0)
exit()


logipi.directWrite(0x0001, (0x01, 0x0C, 0x01, 0x0C), 0)
logipi.directWrite(0x0001, (0xF1, 0x0A, 0xF1, 0x0A), 0)
logipi.directWrite(0x0001, (0x00, 0x0F, 0x00, 0x0F), 0)
logipi.directWrite(0x0001, (0x00, 0x09, 0x00, 0x09), 0)
logipi.directWrite(0x0001, (0x07, 0x0B, 0x07, 0x0B), 0)


logipi.directWrite(0x0008, (0x80, 0x00))
logipi.directWrite(0x0009, (0x80, 0x00))
Exemplo n.º 6
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)
print logipi.directRead(0x0012, 2, 0)
print logipi.directRead(0x0013, 2, 0)
exit()

logipi.directWrite(0x0001, (0x01, 0x0C, 0x01, 0x0C), 0)
logipi.directWrite(0x0001, (0xF1, 0x0A, 0xF1, 0x0A), 0)
logipi.directWrite(0x0001, (0x00, 0x0F, 0x00, 0x0F), 0)
logipi.directWrite(0x0001, (0x00, 0x09, 0x00, 0x09), 0)
logipi.directWrite(0x0001, (0x07, 0x0B, 0x07, 0x0B), 0)

logipi.directWrite(0x0008, (0x80, 0x00))
logipi.directWrite(0x0009, (0x80, 0x00))
logipi.directWrite(0x000A, (0x80, 0x00))
logipi.directWrite(0x000B, (0x80, 0x00))