diff --git a/util/client.py b/util/client.py new file mode 100644 index 000000000..fe0afcfc1 --- /dev/null +++ b/util/client.py @@ -0,0 +1,15 @@ +#! /usr/bin/env python +import time +import select +import socket +ADDR=('192.168.1.101', 8000) + +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.connect(ADDR) +time.sleep(0.500) +s.send("HelloWorld") +time.sleep(0.500) +print (s.recv(10)) +time.sleep(3) +print ("closing") +s.close() diff --git a/util/draw_rainbow.py b/util/draw_rainbow.py new file mode 100755 index 000000000..0ffc103fb --- /dev/null +++ b/util/draw_rainbow.py @@ -0,0 +1,20 @@ +#! /usr/bin/env python +import colorsys +from PIL import Image + +NUM_COL=256 +SAT=1.0 +VAL=1.0 +OFFSET=220 +tup = [colorsys.hsv_to_rgb(1.0-(i/float(NUM_COL+OFFSET)), SAT, VAL) for i in range(OFFSET, NUM_COL+OFFSET)] +col = [(int(r*255), int(g*255), int(b*255)) for r,g,b in tup] + +REPY=3 +w=64 +h=NUM_COL*REPY +im = Image.new('RGB', (w, h)) +for y in range(0, h): + for x in range(0, w): + im.putpixel((x, y), col[y/REPY]) + +im.show() diff --git a/util/gen_rainbow.py b/util/gen_rainbow.py new file mode 100755 index 000000000..c7290f35c --- /dev/null +++ b/util/gen_rainbow.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python +import colorsys + +NUM_COL=256 +SAT=1.0 +VAL=1.0 +OFFSET=220 +tup = [colorsys.hsv_to_rgb(1.0-(i/float(NUM_COL+OFFSET)), SAT, VAL) for i in range(OFFSET, NUM_COL+OFFSET)] +col = [((int(r*255)*31/255)&0x1F)<<11 | + ((int(g*255)*63/255)&0x3F)<<5 | + ((int(b*255)*31/255)&0x1F) for r,g,b in tup] + +print \ +"#include \n"\ +"const uint16_t rainbow_table[%d] = {"%(NUM_COL) + +for i in range(0, NUM_COL): + if (i%4)==0 and i != (NUM_COL-1): + if i >0: + print "" + print " ", + print "0x%X,"%((col[i] & 0xff)<<8 |(col[i] & 0xff00) >> 8), +print "\n};" diff --git a/util/pll.py b/util/pll.py new file mode 100755 index 000000000..f3d47d7a9 --- /dev/null +++ b/util/pll.py @@ -0,0 +1,11 @@ +#! /usr/bin/env python + +PLL_M = 6 +PLL_N = 360 +PLL_Q = 15 +PLL_P = 4 +HSE_VALUE = 12000000 +PLL_VCO = (HSE_VALUE / PLL_M) * PLL_N +print ("PLL_VCO = %d"%PLL_VCO) +print ("SYSCLK = %d"%(PLL_VCO / PLL_P)) +print ("USB/SDIO/RNG =%d"%(PLL_VCO / PLL_Q))