Remove lib scripts dir

This commit is contained in:
iabdalkader 2015-08-13 23:11:11 +02:00
parent 0b07c82a79
commit 3b45053d84
3 changed files with 1 additions and 267 deletions

View File

@ -1,93 +0,0 @@
import ustruct as struct
class AVI:
def __init__(self, path, w, h, codec="MJPG"):
self.w = w
self.h = h
self.codec = codec
self.size = 0
self.frames = 0
self.fp = open(path, "w")
self.fp.seek(224) #skip headers
def avi_hdr(self):
hdr = struct.pack("I", int(1000/self.fps)) # Time delay between frames
hdr += struct.pack("I", 0) # Data rate of AVI data
hdr += struct.pack("I", 1) # Size of single unit of padding
hdr += struct.pack("I", 0) # Flags
hdr += struct.pack("I", self.frames)# Number of video frame stored
hdr += struct.pack("I", 0) # Number of intial frames
hdr += struct.pack("I", 1) # Number of data streams in chunk
hdr += struct.pack("I", 0) # Minimum playback buffer size
hdr += struct.pack("I", self.w) # Width of video frame in pixels
hdr += struct.pack("I", self.h) # Height of video frame in pixels
hdr += struct.pack("I", 1) # Time scale
hdr += struct.pack("I", self.fps) # Data rate of playback
hdr += struct.pack("I", 0) # Starting time of AVI data
hdr += struct.pack("I", 0) # Size of AVI data chunk
return hdr;
def str_hdr(self):
hdr = struct.pack("4s", "vids") # Stream type
hdr += struct.pack("4s", self.codec)# Stream codec
hdr += struct.pack("I", 0) # Flags
hdr += struct.pack("I", 0) # Priority
hdr += struct.pack("I", 0) # Number of first frame
hdr += struct.pack("I", 1) # Time scale
hdr += struct.pack("I", self.fps) # Data rate of playback
hdr += struct.pack("I", 0) # Starting time of AVI data
hdr += struct.pack("I", 0) # Data length
hdr += struct.pack("I", 0) # Buffer size
hdr += struct.pack("I", 0) # Sample quailty factor
hdr += struct.pack("I", 0) # Size of the sample in bytes
hdr += struct.pack("II",0,0) # Rect
return hdr;
def str_fmt(self):
#BITMAPINFOHEADER
hdr = struct.pack("I", 40) # Size in bytes
hdr += struct.pack("I", self.w) # Width
hdr += struct.pack("I", self.h) # Height
hdr += struct.pack("H", 1) # Planes
hdr += struct.pack("H", 16) # Bits per pixel
hdr += struct.pack("4s", self.codec) # This should be BI_JPEG, but ffmpeg writes "MJPG"
hdr += struct.pack("I", 0) # Image size (which one?)
hdr += struct.pack("I", 0) # X pixels-per-meter
hdr += struct.pack("I", 0) # Y pixels-per-meter
hdr += struct.pack("I", 0) # color indexes in the color table
hdr += struct.pack("I", 0) # required color indexes in the color table
return hdr;
def new_chunk(self, c_id, c_data):
return c_id +\
struct.pack("I", len(c_data)) +\
c_data
def new_list(self, l_id, l_4cc, l_size, l_data):
return l_id +\
struct.pack("I", l_size+len(l_data)+4) +\
struct.pack("4s", l_4cc) +\
l_data
def add_frame(self, img):
self.frames +=1
self.size += img.size()
self.fp.write(struct.pack("4sI", "00dc", img.size()))
self.fp.write(img)
def flush(self, fps):
self.fps = fps
self.fp.seek(0)
self.fp.write(
self.new_list(b"RIFF", b"AVI ", self.size,
self.new_list(b"LIST", b"hdrl", 0,
self.new_chunk(b"avih", self.avi_hdr())
+ self.new_list(b"LIST", b"strl", 0,
self.new_chunk(b"strh", self.str_hdr())
+ self.new_chunk(b"strf", self.str_fmt())
)
+ self.new_list(b"LIST", b"movi", self.size, b"")
)
)
)
self.fp.close()

View File

@ -1,172 +0,0 @@
from time import sleep
from pyb import Pin, SPI
rst = Pin('PD12', Pin.OUT_PP, Pin.PULL_UP)
rs = Pin('PD13', Pin.OUT_PP, Pin.PULL_UP)
cs = Pin('PB12', Pin.OUT_PP, Pin.PULL_UP)
bl = Pin('PA5', Pin.OUT_PP, Pin.PULL_UP)
spi = SPI(2, SPI.MASTER, baudrate=22500000, polarity=0, phase=0)
def reset():
rst.low()
sleep(100)
rst.high()
sleep(100)
def write_command(c):
cs.low()
rs.low()
spi.send(c)
cs.high()
def write_data(c):
cs.low()
rs.high()
spi.send(c)
cs.high()
def clear(c=0x00):
write_command(0x2C)
for i in range(128*160):
write_data(c)
write_data(c)
def write_image(image):
write_command(0x2C)
cs.low()
rs.high()
spi.send(image)
cs.high()
def set_backlight(on):
if (on):
bl.high()
else:
bl.low()
def init(madctl=0xC0):
#HW reset
reset()
#LCD init sequence
#Sleep exit
write_command(0x11)
sleep (120)
#ST7735R Frame Rate
write_command(0xB1)
write_data(0x01)
write_data(0x2C)
write_data(0x2D)
write_command(0xB2)
write_data(0x01)
write_data(0x2C)
write_data(0x2D)
write_command(0xB3)
write_data(0x01)
write_data(0x2C)
write_data(0x2D)
write_data(0x01)
write_data(0x2C)
write_data(0x2D)
write_command(0xB4)
#Column inversion
write_data(0x07)
#ST7735R Power Sequence
write_command(0xC0)
write_data(0xA2)
write_data(0x02)
write_data(0x84)
write_command(0xC1)
write_data(0xC5)
write_command(0xC2)
write_data(0x0A)
write_data(0x00)
write_command(0xC3)
write_data(0x8A)
write_data(0x2A)
write_command(0xC4)
write_data(0x8A)
write_data(0xEE)
#VCOM
write_command(0xC5)
write_data(0x0E)
#MX, MY, MV, RGB mode
write_command(0x36)
write_data(madctl)
#ST7735R Gamma Sequence
write_command(0xe0)
write_data(0x0f)
write_data(0x1a)
write_data(0x0f)
write_data(0x18)
write_data(0x2f)
write_data(0x28)
write_data(0x20)
write_data(0x22)
write_data(0x1f)
write_data(0x1b)
write_data(0x23)
write_data(0x37)
write_data(0x00)
write_data(0x07)
write_data(0x02)
write_data(0x10)
write_command(0xe1)
write_data(0x0f)
write_data(0x1b)
write_data(0x0f)
write_data(0x17)
write_data(0x33)
write_data(0x2c)
write_data(0x29)
write_data(0x2e)
write_data(0x30)
write_data(0x30)
write_data(0x39)
write_data(0x3f)
write_data(0x00)
write_data(0x07)
write_data(0x03)
write_data(0x10)
# set column address
write_command(0x2a)
write_data(0x00)
write_data(0x00)
write_data(0x00)
write_data(128-1)
# set row address
write_command(0x2b)
write_data(0x00)
write_data(0x00)
write_data(0x00)
write_data(160-1)
#Enable test command
write_command(0xF0)
write_data(0x01)
#Disable ram power save mode
write_command(0xF6)
write_data(0x00)
#65k mode
write_command(0x3A)
write_data(0x05)
#Display on
write_command(0x29)

View File

@ -43,8 +43,7 @@ os.mkdir(util_dir)
shutil.copy('pydfu.py', util_dir)
shutil.copy('openmv-cascade.py', util_dir)
data_tree = Tree('lib', prefix='lib')
data_tree += Tree('util', prefix='util')
data_tree = Tree('util', prefix='util')
data_tree += Tree('examples', prefix='examples')
data_tree += Tree('../udev', prefix='udev')
data_tree += Tree('../firmware', prefix='firmware',