kopia lustrzana https://github.com/GuyCarver/MicroPython
rodzic
85c2890213
commit
fddeec64b2
|
@ -0,0 +1,215 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
|
@ -0,0 +1,38 @@
|
|||
# Control bot that throws treats using a servo
|
||||
|
||||
import pyb
|
||||
|
||||
servoNums = [1, 2]
|
||||
ledNum = 3
|
||||
|
||||
def pitchtoangle( aPitch ):
|
||||
return aPitch * 90 / 32
|
||||
|
||||
def setservo( aServo, aPitch ):
|
||||
aServo.angle(pitchtoangle(aPitch))
|
||||
|
||||
def main( ) :
|
||||
a = pyb.Accel()
|
||||
pitches = [ a.x, a.y ]
|
||||
servos = [ pyb.Servo(sn) for sn in servoNums ]
|
||||
curangles = [-100, -100]
|
||||
|
||||
# mn, mx, _, a, s = s1.calibration()
|
||||
# s1.calibration(mn, mx, servoCenter, a, s)
|
||||
# s1.speed(0)
|
||||
|
||||
l = pyb.LED(ledNum)
|
||||
sw = pyb.Switch()
|
||||
|
||||
while(1):
|
||||
if sw():
|
||||
break;
|
||||
for i in range(len(pitches)):
|
||||
p = pitches[i]()
|
||||
if curangles[i] != p:
|
||||
curangles[i] = p
|
||||
setservo(servos[i], p)
|
||||
pyb.delay(20)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,725 @@
|
|||
#driver for Sainsmart 1.8" TFT display ST7735
|
||||
#Translated by Guy Carver from the ST7735 sample code.
|
||||
|
||||
import pyb
|
||||
from math import sqrt
|
||||
|
||||
ST_NOP = 0x0
|
||||
ST_SWRESET = 0x01
|
||||
ST_RDDID = 0x04
|
||||
ST_RDDST = 0x09
|
||||
|
||||
ST_SLPIN = 0x10
|
||||
ST_SLPOUT = 0x11
|
||||
ST_PTLON = 0x12
|
||||
ST_NORON = 0x13
|
||||
|
||||
ST_INVOFF = 0x20
|
||||
ST_INVON = 0x21
|
||||
ST_DISPOFF = 0x28
|
||||
ST_DISPON = 0x29
|
||||
ST_CASET = 0x2A
|
||||
ST_RASET = 0x2B
|
||||
ST_RAMWR = 0x2C
|
||||
ST_RAMRD = 0x2E
|
||||
|
||||
ST_COLMOD = 0x3A
|
||||
ST_MADCTL = 0x36
|
||||
|
||||
ST_FRMCTR1 = 0xB1
|
||||
ST_FRMCTR2 = 0xB2
|
||||
ST_FRMCTR3 = 0xB3
|
||||
ST_INVCTR = 0xB4
|
||||
ST_DISSET5 = 0xB6
|
||||
|
||||
ST_PWCTR1 = 0xC0
|
||||
ST_PWCTR2 = 0xC1
|
||||
ST_PWCTR3 = 0xC2
|
||||
ST_PWCTR4 = 0xC3
|
||||
ST_PWCTR5 = 0xC4
|
||||
ST_VMCTR1 = 0xC5
|
||||
|
||||
ST_RDID1 = 0xDA
|
||||
ST_RDID2 = 0xDB
|
||||
ST_RDID3 = 0xDC
|
||||
ST_RDID4 = 0xDD
|
||||
|
||||
ST_PWCTR6 = 0xFC
|
||||
|
||||
ST_GMCTRP1 = 0xE0
|
||||
ST_GMCTRN1 = 0xE1
|
||||
|
||||
#TFTRotations and TFTRGB are bits to set
|
||||
# on MADCTL to control display rotation/color layout
|
||||
#Looking at display with pins on top.
|
||||
#00 = upper left printing right
|
||||
#10 = does nothing (MADCTL_ML)
|
||||
#20 = upper left printing down (backwards) (Vertical flip)
|
||||
#40 = upper right printing left (backwards) (X Flip)
|
||||
#80 = lower left printing right (backwards) (Y Flip)
|
||||
#04 = (MADCTL_MH)
|
||||
|
||||
#60 = 90 right rotation
|
||||
#C0 = 180 right rotation
|
||||
#A0 = 270 right rotation
|
||||
TFTRotations = [0x00, 0x60, 0xC0, 0xA0]
|
||||
TFTBGR = 0x08 #When set color is bgr else rgb.
|
||||
TFTRGB = 0x00
|
||||
|
||||
class Point(object):
|
||||
"""2D point class"""
|
||||
|
||||
def __init__(self, x = 0, y = 0) :
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
||||
def __str__(self) :
|
||||
return "ST7735.Point(" + str(self.x) + "," + str(self.y)+ ")"
|
||||
|
||||
def __repr__(self) :
|
||||
return self.__str__()
|
||||
|
||||
def clone( self ) :
|
||||
return Point(self.x, self.y)
|
||||
|
||||
def clamp( aValue, aMin, aMax ) :
|
||||
return max(aMin, min(aMax, aValue))
|
||||
|
||||
def TFTColor( aR, aG, aB ) :
|
||||
'''Create a 16 bit rgb value from the given R,G,B from 0-255.
|
||||
This assumes rgb 565 layout and will be incorrect for bgr.'''
|
||||
return ((aR & 0xF8) << 8) | ((aG & 0xFC) << 3) | (aB >> 3)
|
||||
|
||||
BLACK = 0
|
||||
RED = TFTColor(0xFF, 0x00, 0x00)
|
||||
MAROON = TFTColor(0x80, 0x00, 0x00)
|
||||
GREEN = TFTColor(0x00, 0xFF, 0x00)
|
||||
BLUE = TFTColor(0x00, 0x00, 0xFF)
|
||||
NAVY = TFTColor(0x00, 0x00, 0x80)
|
||||
CYAN = TFTColor(0x00, 0xFF, 0xFF)
|
||||
YELLOW = TFTColor(0xFF, 0xFF, 0x00)
|
||||
PURPLE = TFTColor(0xFF, 0x00, 0xFF)
|
||||
WHITE = TFTColor(0xFF, 0xFF, 0xFF)
|
||||
GRAY = TFTColor(0x80, 0x80, 0x80)
|
||||
|
||||
ScreenSize = Point(128, 160)
|
||||
|
||||
class TFT(object) :
|
||||
"""Sainsmart TFT 7735 display driver."""
|
||||
|
||||
@staticmethod
|
||||
def makecolor(aR, aG, aB):
|
||||
'''Create a 565 rgb TFTColor value'''
|
||||
return TFTColor(aR, aG, aB)
|
||||
|
||||
def __init__(self, aLoc, aDC, aReset) :
|
||||
"""aLoc SPI pin location is either 1 for 'X' or 2 for 'Y'.
|
||||
aDC is the DC pin and aReset is the reset pin."""
|
||||
self.size = ScreenSize.clone()
|
||||
self.rotate = 0 #Vertical with top toward pins.
|
||||
self.rgb = TFTRGB #color order of rgb.
|
||||
self.dc = pyb.Pin(aDC, pyb.Pin.OUT_PP, pyb.Pin.PULL_DOWN)
|
||||
self.reset = pyb.Pin(aReset, pyb.Pin.OUT_PP, pyb.Pin.PULL_DOWN)
|
||||
rate = 100000000 #Set way high but will be clamped to a maximum in SPI constructor.
|
||||
cs = "X5" if aLoc == 1 else "Y5"
|
||||
self.cs = pyb.Pin(cs, pyb.Pin.OUT_PP, pyb.Pin.PULL_DOWN)
|
||||
self.cs.high()
|
||||
self.spi = pyb.SPI(aLoc, pyb.SPI.MASTER, baudrate = rate, polarity = 0, phase = 1, crc=None)
|
||||
self.colorData = bytearray(2)
|
||||
self.windowLocData = bytearray(4)
|
||||
|
||||
def on( self, aTF = True ) :
|
||||
'''Turn display on or off.'''
|
||||
self._writecommand(ST_DISPON if aTF else ST_DISPOFF)
|
||||
|
||||
def invertcolor( self, aBool ) :
|
||||
'''Invert the color data IE: Black = White.'''
|
||||
self._writecommand(ST_INVON if aBool else ST_INVOFF)
|
||||
|
||||
def setrgb( self, aTF = True ) :
|
||||
'''True = rgb else bgr'''
|
||||
self.rgb = TFTRBG if aTF else TFTBGR
|
||||
self._setMADCTL()
|
||||
|
||||
def setrotation( self, aRot ) :
|
||||
'''0 - 3. Starts vertical with top toward pins and rotates 90 deg
|
||||
clockwise each step.'''
|
||||
if (0 <= aRot < 4):
|
||||
rotchange = self.rotate ^ aRot
|
||||
self.rotate = aRot
|
||||
#If switching from vertical to horizontal swap x,y
|
||||
# (indicated by bit 0 changing).
|
||||
if (rotchange & 1):
|
||||
self.size.x, self.size.y = self.size.y, self.size.x
|
||||
self._setMADCTL()
|
||||
|
||||
def drawpixel( self, aPos, aColor ) :
|
||||
'''Draw a pixel at the given position'''
|
||||
if 0 <= aPos.x < self.size.x and 0 <= aPos.y < self.size.y:
|
||||
self._setwindowpoint(aPos)
|
||||
self._pushcolor(aColor)
|
||||
|
||||
def drawstring( self, aPos, aString, aColor, aFont, aSize = 1 ) :
|
||||
'''Draw a string at the given position. If the string reaches the end of the
|
||||
display it is wrapped to aPos.x on the next line. aSize may be an integer
|
||||
which will size the font uniformly on w,h or a Point with x,y scales or
|
||||
any type that may be indexed with [0] or [1].'''
|
||||
|
||||
#Make a size either from single value or 2 elements.
|
||||
if (type(aSize) == int) or (type(aSize) == float):
|
||||
wh = Point(aSize, aSize)
|
||||
elif (type(aSize) == Point):
|
||||
wh = aSize
|
||||
else:
|
||||
wh = Point(aSize[0], aSize[1])
|
||||
|
||||
pos = aPos.clone()
|
||||
width = wh.x * aFont["Width"] + 1
|
||||
for c in aString:
|
||||
self.drawchar(pos, c, aColor, aFont, wh)
|
||||
pos.x += width
|
||||
#We check > rather than >= to let the right (blank) edge of the
|
||||
# character print off the right of the screen.
|
||||
if pos.x + width > self.size.x:
|
||||
pos.y += aFont["Height"] * wh.y + 1
|
||||
pos.x = aPos.x
|
||||
|
||||
def drawchar( self, aPos, aChar, aColor, aFont, aSizes ) :
|
||||
'''Draw a character at the given position using the given font and color.
|
||||
aSizes is a Point with x, y as integer scales indicating the
|
||||
# of pixels to draw for each pixel in the character.'''
|
||||
|
||||
if aFont == None:
|
||||
return
|
||||
|
||||
startchar = aFont['Start']
|
||||
endchar = aFont['End']
|
||||
|
||||
ci = ord(aChar)
|
||||
if (startchar <= ci <= endchar):
|
||||
fontw = aFont['Width']
|
||||
fonth = aFont['Height']
|
||||
ci = (ci - startchar) * fontw
|
||||
|
||||
charA = aFont["Data"][ci:ci + fontw]
|
||||
pos = aPos.clone()
|
||||
if aSizes.x <= 1 and aSizes.y <= 1 :
|
||||
for c in charA :
|
||||
pos.y = aPos.y
|
||||
for r in range(fonth) :
|
||||
if c & 0x01 :
|
||||
self.drawpixel(pos, aColor)
|
||||
pos.y += 1
|
||||
c >>= 1
|
||||
pos.x += 1
|
||||
else:
|
||||
for c in charA :
|
||||
pos.y = aPos.y
|
||||
for r in range(fonth) :
|
||||
if c & 0x01 :
|
||||
self.fillrect(pos, aSizes, aColor)
|
||||
pos.y += aSizes.y
|
||||
c >>= 1
|
||||
pos.x += aSizes.x
|
||||
|
||||
def drawline( self, aStart, aEnd, aColor ) :
|
||||
'''Draws a line from aStart to aEnd in the given color. Vertical or horizontal
|
||||
lines are forwarded to vline and hline.'''
|
||||
if aStart.x == aEnd.x:
|
||||
#Make sure we use the smallest y.
|
||||
pnt = aEnd if (aEnd.y < aStart.y) else aStart
|
||||
self.vline(pnt, abs(aEnd.y - aStart.y) + 1, aColor)
|
||||
elif aStart.y == aEnd.y:
|
||||
#Make sure we use the smallest x.
|
||||
pnt = aEnd if aEnd.x < aStart.x else aStart
|
||||
self.hline(pnt, abs(aEnd.x - aStart.x) + 1, aColor)
|
||||
else:
|
||||
slope = float(aEnd.y - aStart.y) / (aEnd.x - aStart.x)
|
||||
if (abs(slope) < 1.0):
|
||||
for x in range(aStart.x, aEnd.x + 1) :
|
||||
y = (x - aStart.x) * slope + aStart.y
|
||||
self.drawpixel(Point(x, int(y + 0.5)), aColor)
|
||||
else:
|
||||
for y in range(aStart.y, aEnd.y + 1) :
|
||||
x = (y - aStart.y) / slope + aStart.x
|
||||
self.drawpixel(Point(int(x + 0.5), y), aColor)
|
||||
|
||||
def vline( self, aStart, aLen, aColor ) :
|
||||
'''Draw a vertical line from aStart for aLen. aLen may be negative.'''
|
||||
start = Point(clamp(aStart.x, 0, self.size.x), clamp(aStart.y, 0, self.size.y))
|
||||
stop = Point(start.x, clamp(start.y + aLen, 0, self.size.y))
|
||||
#Make sure smallest y 1st.
|
||||
if (stop.y < start.y):
|
||||
start, stop = stop, start
|
||||
self._setwindowloc(start, stop)
|
||||
self._draw(aLen, aColor)
|
||||
|
||||
def hline( self, aStart, aLen, aColor ) :
|
||||
'''Draw a horizontal line from aStart for aLen. aLen may be negative.'''
|
||||
start = Point(clamp(aStart.x, 0, self.size.x), clamp(aStart.y, 0, self.size.y))
|
||||
stop = Point(clamp(start.x + aLen, 0, self.size.x), start.y)
|
||||
#Make sure smallest x 1st.
|
||||
if (stop.x < start.x):
|
||||
start, stop = stop, start
|
||||
self._setwindowloc(start, stop)
|
||||
self._draw(aLen, aColor)
|
||||
|
||||
def rect( self, aStart, aSize, aColor ) :
|
||||
'''Draw a hollow rectangle. aStart is the smallest coordinate corner
|
||||
and aSize is a Point indicating width, height.'''
|
||||
self.hline(aStart, aSize.x, aColor)
|
||||
self.hline(Point(aStart.x, aStart.y + aSize.y - 1), aSize.x, aColor)
|
||||
self.vline(aStart, aSize.y, aColor)
|
||||
self.vline(Point(aStart.x + aSize.x - 1, aStart.y), aSize.y, aColor)
|
||||
|
||||
def fillrect( self, aStart, aSize, aColor ) :
|
||||
'''Draw a filled rectangle. aStart is the smallest coordinate corner
|
||||
and aSize is a Point indicating width, height.'''
|
||||
start = Point(clamp(aStart.x, 0, self.size.x), clamp(aStart.y, 0, self.size.y))
|
||||
end = Point(clamp(start.x + aSize.x - 1, 0, self.size.x), clamp(start.y + aSize.y - 1, 0, self.size.y))
|
||||
|
||||
if (end.x < start.x):
|
||||
end.x, start.x = start.x, end.x
|
||||
if (end.y < start.y):
|
||||
end.y, start.y = start.y, end.y
|
||||
|
||||
self._setwindowloc(start, end)
|
||||
numPixels = (end.x - start.x + 1) * (end.y - start.y + 1)
|
||||
self._draw(numPixels, aColor)
|
||||
|
||||
def circle( self, aPos, aRadius, aColor ) :
|
||||
'''Draw a hollow circle with the given radius and color with aPos as center.'''
|
||||
self.colorData[0] = aColor >> 8
|
||||
self.colorData[1] = aColor
|
||||
xend = int(0.7071 * aRadius) + 1
|
||||
rsq = aRadius * aRadius
|
||||
for x in range(xend) :
|
||||
y = int(sqrt(rsq - x * x))
|
||||
xp = aPos.x + x
|
||||
yp = aPos.y + y
|
||||
xn = aPos.x - x
|
||||
yn = aPos.y - y
|
||||
xyp = aPos.x + y
|
||||
yxp = aPos.y + x
|
||||
xyn = aPos.x - y
|
||||
yxn = aPos.y - x
|
||||
|
||||
self._setwindowpoint(Point(xp, yp))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xp, yn))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xn, yp))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xn, yn))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xp, yn))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xyp, yxp))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xyp, yxn))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xyn, yxp))
|
||||
self._writedata(self.colorData)
|
||||
self._setwindowpoint(Point(xyn, yxn))
|
||||
self._writedata(self.colorData)
|
||||
|
||||
def fillcircle( self, aPos, aRadius, aColor ) :
|
||||
'''Draw a filled circle with given radius and color with aPos as center'''
|
||||
rsq = aRadius * aRadius
|
||||
for x in range(aRadius) :
|
||||
y = int(sqrt(rsq - x * x))
|
||||
y0 = aPos.y - y
|
||||
ln = y * 2
|
||||
self.vline(Point(aPos.x + x, y0), ln, aColor)
|
||||
self.vline(Point(aPos.x - x, y0), ln, aColor)
|
||||
|
||||
def fill( self, aColor ) :
|
||||
'''Fill screen with the given color.'''
|
||||
self.fillrect(Point(0, 0), self.size, aColor)
|
||||
self._draw(self.size.x * self.size.y, aColor)
|
||||
|
||||
def _draw( self, aPixels, aColor ) :
|
||||
'''Send given color to the device aPixels times.'''
|
||||
self.colorData[0] = aColor >> 8
|
||||
self.colorData[1] = aColor
|
||||
|
||||
self.dc.high()
|
||||
self.cs.low()
|
||||
for i in range(aPixels):
|
||||
self.spi.send(self.colorData)
|
||||
self.cs.high()
|
||||
|
||||
def _setwindowpoint( self, aPos ) :
|
||||
'''Set a single point for drawing a color to.'''
|
||||
x = int(aPos.x)
|
||||
y = int(aPos.y)
|
||||
self._writecommand(ST_CASET) #Column address set.
|
||||
self.windowLocData[0] = 0x00
|
||||
self.windowLocData[1] = x
|
||||
self.windowLocData[2] = 0x00
|
||||
self.windowLocData[3] = x
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RASET) #Row address set.
|
||||
self.windowLocData[1] = y
|
||||
self.windowLocData[3] = y
|
||||
self._writedata(self.windowLocData)
|
||||
self._writecommand(ST_RAMWR) #Write to RAM.
|
||||
|
||||
def _setwindowloc( self, aPos0, aPos1 ) :
|
||||
'''Set a rectangular area for drawing a color to.'''
|
||||
self._writecommand(ST_CASET) #Column address set.
|
||||
self.windowLocData[0] = 0x00
|
||||
self.windowLocData[1] = int(aPos0.x)
|
||||
self.windowLocData[2] = 0x00
|
||||
self.windowLocData[3] = int(aPos1.x)
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RASET) #Row address set.
|
||||
self.windowLocData[1] = int(aPos0.y)
|
||||
self.windowLocData[3] = int(aPos1.y)
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RAMWR) #Write to RAM.
|
||||
|
||||
def _writecommand( self, aCommand ) :
|
||||
'''Write given command to the device.'''
|
||||
self.dc.low()
|
||||
self.cs.low()
|
||||
self.spi.send(aCommand)
|
||||
self.cs.high()
|
||||
|
||||
def _writedata( self, aData ) :
|
||||
'''Write given data to the device. This may be
|
||||
either a single int or a bytearray of values.'''
|
||||
self.dc.high()
|
||||
self.cs.low()
|
||||
self.spi.send(aData)
|
||||
self.cs.high()
|
||||
|
||||
def _pushcolor( self, aColor ) :
|
||||
'''Push given color to the device.'''
|
||||
self.colorData[0] = aColor >> 8
|
||||
self.colorData[1] = aColor
|
||||
self._writedata(self.colorData)
|
||||
|
||||
def _setMADCTL( self ) :
|
||||
'''Set screen rotation and RGB/BGR format.'''
|
||||
self._writecommand(ST_MADCTL)
|
||||
self._writedata(TFTRotations[self.rotate] | self.rgb)
|
||||
|
||||
def _reset(self):
|
||||
'''Reset the device.'''
|
||||
self.dc.low()
|
||||
self.reset.high()
|
||||
pyb.delay(500)
|
||||
self.reset.low()
|
||||
pyb.delay(500)
|
||||
self.reset.high()
|
||||
pyb.delay(500)
|
||||
|
||||
def _initb(self):
|
||||
'''Initialize blue tab version.'''
|
||||
self.size.x = ScreenSize.x + 2
|
||||
self.size.y = ScreenSize.y + 1
|
||||
self._reset()
|
||||
self._writecommand(ST_SWRESET) #Software reset.
|
||||
pyb.delay(50)
|
||||
self._writecommand(ST_SLPOUT) #out of sleep mode.
|
||||
pyb.delay(500)
|
||||
|
||||
data1 = bytearray(1)
|
||||
self._writecommand(ST_COLMOD) #Set color mode.
|
||||
data1[0] = 0x05 #16 bit color.
|
||||
self._writedata(data1)
|
||||
pyb.delay(10)
|
||||
|
||||
data3 = bytearray([0x00, 0x06, 0x03]) #fastest refresh, 6 lines front, 3 lines back.
|
||||
self._writecommand(ST_FRMCTR1) #Frame rate control.
|
||||
self._writedata(data3)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_MADCTL)
|
||||
data1[0] = 0x08 #row address/col address, bottom to top refresh
|
||||
self._writedata(data1)
|
||||
|
||||
data2 = bytearray(2)
|
||||
self._writecommand(ST_DISSET5) #Display settings
|
||||
data2[0] = 0x15 #1 clock cycle nonoverlap, 2 cycle gate rise, 3 cycle oscil, equalize
|
||||
data2[1] = 0x02 #fix on VTL
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_INVCTR) #Display inversion control
|
||||
data1[0] = 0x00 #Line inversion.
|
||||
self._writedata(data1)
|
||||
|
||||
self._writecommand(ST_PWCTR1) #Power control
|
||||
data2[0] = 0x02 #GVDD = 4.7V
|
||||
data2[1] = 0x70 #1.0uA
|
||||
self._writedata(data2)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_PWCTR2) #Power control
|
||||
data1[0] = 0x05 #VGH = 14.7V, VGL = -7.35V
|
||||
self._writedata(data1)
|
||||
|
||||
#Took this out because with it the screen stays all white.
|
||||
#But I tested on green tab version so maybe it will work for blue.
|
||||
# self._writecommand(ST_PWCTR3) #Power control
|
||||
# data2[0] = 0x01 #Opamp current small
|
||||
# data2[1] = 0x02 #Boost frequency
|
||||
# self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_VMCTR1) #Power control
|
||||
data2[0] = 0x3C #VCOMH = 4V
|
||||
data2[1] = 0x38 #VCOML = -1.1V
|
||||
self._writedata(data2)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_PWCTR6) #Power control
|
||||
data2[0] = 0x11
|
||||
data2[1] = 0x15
|
||||
self._writedata(data2)
|
||||
|
||||
#These different values don't seem to make a difference.
|
||||
# dataGMCTRP = bytearray([0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, 0x1f,
|
||||
# 0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10])
|
||||
dataGMCTRP = bytearray([0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29,
|
||||
0x25, 0x2b, 0x39, 0x00, 0x01, 0x03, 0x10])
|
||||
self._writecommand(ST_GMCTRP1)
|
||||
self._writedata(dataGMCTRP)
|
||||
|
||||
# dataGMCTRN = bytearray([0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, 0x30,
|
||||
# 0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10])
|
||||
dataGMCTRN = bytearray([0x03, 0x1d, 0x07, 0x06, 0x2e, 0x2c, 0x29, 0x2d, 0x2e,
|
||||
0x2e, 0x37, 0x3f, 0x00, 0x00, 0x02, 0x10])
|
||||
self._writecommand(ST_GMCTRN1)
|
||||
self._writedata(dataGMCTRN)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_CASET) #Column address set.
|
||||
self.windowLocData[0] = 0x00
|
||||
self.windowLocData[1] = 2 #Start at column 2
|
||||
self.windowLocData[2] = 0x00
|
||||
self.windowLocData[3] = self.size.x - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RASET) #Row address set.
|
||||
self.windowLocData[1] = 1 #Start at row 2.
|
||||
self.windowLocData[3] = self.size.y - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_NORON) #Normal display on.
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_RAMWR)
|
||||
pyb.delay(500)
|
||||
|
||||
self._writecommand(ST_DISPON)
|
||||
self.cs.high()
|
||||
pyb.delay(500)
|
||||
|
||||
def _initr(self):
|
||||
'''Initialize a red tab version.'''
|
||||
self._reset()
|
||||
|
||||
self._writecommand(ST_SWRESET) #Software reset.
|
||||
pyb.delay(150)
|
||||
self._writecommand(ST_SLPOUT) #out of sleep mode.
|
||||
pyb.delay(500)
|
||||
|
||||
data3 = bytearray([0x01, 0x2C, 0x2D]) #fastest refresh, 6 lines front, 3 lines back.
|
||||
self._writecommand(ST_FRMCTR1) #Frame rate control.
|
||||
self._writedata(data3)
|
||||
|
||||
self._writecommand(ST_FRMCTR2) #Frame rate control.
|
||||
self._writedata(data3)
|
||||
|
||||
data6 = bytearray([0x01, 0x2c, 0x2d, 0x01, 0x2c, 0x2d])
|
||||
self._writecommand(ST_FRMCTR3) #Frame rate control.
|
||||
self._writedata(data6)
|
||||
pyb.delay(10)
|
||||
|
||||
data1 = bytearray(1)
|
||||
self._writecommand(ST_INVCTR) #Display inversion control
|
||||
data1[0] = 0x07 #Line inversion.
|
||||
self._writedata(data1)
|
||||
|
||||
self._writecommand(ST_PWCTR1) #Power control
|
||||
data3[0] = 0xA2
|
||||
data3[1] = 0x02
|
||||
data3[2] = 0x84
|
||||
self._writedata(data3)
|
||||
|
||||
self._writecommand(ST_PWCTR2) #Power control
|
||||
data1[0] = 0xC5 #VGH = 14.7V, VGL = -7.35V
|
||||
self._writedata(data1)
|
||||
|
||||
data2 = bytearray(2)
|
||||
self._writecommand(ST_PWCTR3) #Power control
|
||||
data2[0] = 0x0A #Opamp current small
|
||||
data2[1] = 0x00 #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_PWCTR4) #Power control
|
||||
data2[0] = 0x8A #Opamp current small
|
||||
data2[1] = 0x2A #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_PWCTR5) #Power control
|
||||
data2[0] = 0x8A #Opamp current small
|
||||
data2[1] = 0xEE #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_VMCTR1) #Power control
|
||||
data1[0] = 0x0E
|
||||
self._writedata(data1)
|
||||
|
||||
self._writecommand(ST_INVOFF)
|
||||
|
||||
self._writecommand(ST_MADCTL) #Power control
|
||||
data1[0] = 0xC8
|
||||
self._writedata(data1)
|
||||
|
||||
self._writecommand(ST_COLMOD)
|
||||
data1[0] = 0x05
|
||||
self._writedata(data1)
|
||||
|
||||
self._writecommand(ST_CASET) #Column address set.
|
||||
self.windowLocData[0] = 0x00
|
||||
self.windowLocData[1] = 0x00
|
||||
self.windowLocData[2] = 0x00
|
||||
self.windowLocData[3] = self.size.x - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RASET) #Row address set.
|
||||
self.windowLocData[3] = self.size.y - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
dataGMCTRP = bytearray([0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, 0x1f,
|
||||
0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10])
|
||||
self._writecommand(ST_GMCTRP1)
|
||||
self._writedata(dataGMCTRP)
|
||||
|
||||
dataGMCTRN = bytearray([0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, 0x30,
|
||||
0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10])
|
||||
self._writecommand(ST_GMCTRN1)
|
||||
self._writedata(dataGMCTRN)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_DISPON)
|
||||
pyb.delay(100)
|
||||
|
||||
self._writecommand(ST_NORON) #Normal display on.
|
||||
pyb.delay(10)
|
||||
|
||||
self.cs.high()
|
||||
|
||||
def _initg(self):
|
||||
'''Initialize a green tab version.'''
|
||||
self._reset()
|
||||
|
||||
self._writecommand(ST_SWRESET) #Software reset.
|
||||
pyb.delay(150)
|
||||
self._writecommand(ST_SLPOUT) #out of sleep mode.
|
||||
pyb.delay(255)
|
||||
|
||||
data3 = bytearray([0x01, 0x2C, 0x2D]) #fastest refresh, 6 lines front, 3 lines back.
|
||||
self._writecommand(ST_FRMCTR1) #Frame rate control.
|
||||
self._writedata(data3)
|
||||
|
||||
self._writecommand(ST_FRMCTR2) #Frame rate control.
|
||||
self._writedata(data3)
|
||||
|
||||
data6 = bytearray([0x01, 0x2c, 0x2d, 0x01, 0x2c, 0x2d])
|
||||
self._writecommand(ST_FRMCTR3) #Frame rate control.
|
||||
self._writedata(data6)
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_INVCTR) #Display inversion control
|
||||
self._writedata(0x07)
|
||||
|
||||
self._writecommand(ST_PWCTR1) #Power control
|
||||
data3[0] = 0xA2
|
||||
data3[1] = 0x02
|
||||
data3[2] = 0x84
|
||||
self._writedata(data3)
|
||||
|
||||
self._writecommand(ST_PWCTR2) #Power control
|
||||
self._writedata(0xC5)
|
||||
|
||||
data2 = bytearray(2)
|
||||
self._writecommand(ST_PWCTR3) #Power control
|
||||
data2[0] = 0x0A #Opamp current small
|
||||
data2[1] = 0x00 #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_PWCTR4) #Power control
|
||||
data2[0] = 0x8A #Opamp current small
|
||||
data2[1] = 0x2A #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_PWCTR5) #Power control
|
||||
data2[0] = 0x8A #Opamp current small
|
||||
data2[1] = 0xEE #Boost frequency
|
||||
self._writedata(data2)
|
||||
|
||||
self._writecommand(ST_VMCTR1) #Power control
|
||||
self._writedata(0x0E)
|
||||
|
||||
self._writecommand(ST_INVOFF)
|
||||
|
||||
self._setMADCTL()
|
||||
|
||||
self._writecommand(ST_COLMOD)
|
||||
self._writedata(0x05)
|
||||
|
||||
self._writecommand(ST_CASET) #Column address set.
|
||||
self.windowLocData[0] = 0x00
|
||||
self.windowLocData[1] = 0x01 #Start at row/column 1.
|
||||
self.windowLocData[2] = 0x00
|
||||
self.windowLocData[3] = self.size.x - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
self._writecommand(ST_RASET) #Row address set.
|
||||
self.windowLocData[3] = self.size.y - 1
|
||||
self._writedata(self.windowLocData)
|
||||
|
||||
dataGMCTRP = bytearray([0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29,
|
||||
0x25, 0x2b, 0x39, 0x00, 0x01, 0x03, 0x10])
|
||||
self._writecommand(ST_GMCTRP1)
|
||||
self._writedata(dataGMCTRP)
|
||||
|
||||
dataGMCTRN = bytearray([0x03, 0x1d, 0x07, 0x06, 0x2e, 0x2c, 0x29, 0x2d, 0x2e,
|
||||
0x2e, 0x37, 0x3f, 0x00, 0x00, 0x02, 0x10])
|
||||
self._writecommand(ST_GMCTRN1)
|
||||
self._writedata(dataGMCTRN)
|
||||
|
||||
self._writecommand(ST_NORON) #Normal display on.
|
||||
pyb.delay(10)
|
||||
|
||||
self._writecommand(ST_DISPON)
|
||||
pyb.delay(100)
|
||||
|
||||
self.cs.high()
|
||||
|
||||
def maker():
|
||||
t = TFT(1, "X1", "X2")
|
||||
print("Initializing")
|
||||
t._initr()
|
||||
t.fill(0)
|
||||
return t
|
||||
|
||||
def makeb( ):
|
||||
t = TFT(1, "X1", "X2")
|
||||
print("Initializing")
|
||||
t._initb()
|
||||
t.fill(0)
|
||||
return t
|
||||
|
||||
def makeg( ):
|
||||
t = TFT(1, "X1", "X2")
|
||||
print("Initializing")
|
||||
t._initg()
|
||||
t.fill(0)
|
||||
return t
|
|
@ -0,0 +1,265 @@
|
|||
#Font used for ST7735 display.
|
||||
|
||||
#Each character uses 5 bytes.
|
||||
#index using ASCII value * 5.
|
||||
#Each byte contains a column of pixels.
|
||||
#The character may be 8 pixels high and 5 wide.
|
||||
|
||||
basicfont = {"Width": 5, "Height": 8, "Start": 0, "End": 255, "Data": bytearray([
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
|
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
|
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
|
||||
0x18, 0x3C, 0x7E, 0x3C, 0x18,
|
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C,
|
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
|
||||
0x00, 0x18, 0x3C, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
|
||||
0x00, 0x18, 0x24, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
|
||||
0x30, 0x48, 0x3A, 0x06, 0x0E,
|
||||
0x26, 0x29, 0x79, 0x29, 0x26,
|
||||
0x40, 0x7F, 0x05, 0x05, 0x07,
|
||||
0x40, 0x7F, 0x05, 0x25, 0x3F,
|
||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
|
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
|
||||
0x14, 0x22, 0x7F, 0x22, 0x14,
|
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
|
||||
0x06, 0x09, 0x7F, 0x01, 0x7F,
|
||||
0x00, 0x66, 0x89, 0x95, 0x6A,
|
||||
0x60, 0x60, 0x60, 0x60, 0x60,
|
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94,
|
||||
0x08, 0x04, 0x7E, 0x04, 0x08,
|
||||
0x10, 0x20, 0x7E, 0x20, 0x10,
|
||||
0x08, 0x08, 0x2A, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x2A, 0x08, 0x08,
|
||||
0x1E, 0x10, 0x10, 0x10, 0x10,
|
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
|
||||
0x30, 0x38, 0x3E, 0x38, 0x30,
|
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x5F, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x07, 0x00,
|
||||
0x14, 0x7F, 0x14, 0x7F, 0x14,
|
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12,
|
||||
0x23, 0x13, 0x08, 0x64, 0x62,
|
||||
0x36, 0x49, 0x56, 0x20, 0x50,
|
||||
0x00, 0x08, 0x07, 0x03, 0x00,
|
||||
0x00, 0x1C, 0x22, 0x41, 0x00,
|
||||
0x00, 0x41, 0x22, 0x1C, 0x00,
|
||||
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
|
||||
0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||
0x00, 0x80, 0x70, 0x30, 0x00,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00,
|
||||
0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||
0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||
0x72, 0x49, 0x49, 0x49, 0x46,
|
||||
0x21, 0x41, 0x49, 0x4D, 0x33,
|
||||
0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||
0x27, 0x45, 0x45, 0x45, 0x39,
|
||||
0x3C, 0x4A, 0x49, 0x49, 0x31,
|
||||
0x41, 0x21, 0x11, 0x09, 0x07,
|
||||
0x36, 0x49, 0x49, 0x49, 0x36,
|
||||
0x46, 0x49, 0x49, 0x29, 0x1E,
|
||||
0x00, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x40, 0x34, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x41,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x00, 0x41, 0x22, 0x14, 0x08,
|
||||
0x02, 0x01, 0x59, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x5D, 0x59, 0x4E,
|
||||
0x7C, 0x12, 0x11, 0x12, 0x7C,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||
0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||
0x3E, 0x41, 0x41, 0x51, 0x73,
|
||||
0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||
0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||
0x20, 0x40, 0x41, 0x3F, 0x01,
|
||||
0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||
0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||
0x7F, 0x02, 0x1C, 0x02, 0x7F,
|
||||
0x7F, 0x04, 0x08, 0x10, 0x7F,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||
0x7F, 0x09, 0x19, 0x29, 0x46,
|
||||
0x26, 0x49, 0x49, 0x49, 0x32,
|
||||
0x03, 0x01, 0x7F, 0x01, 0x03,
|
||||
0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||
0x3F, 0x40, 0x38, 0x40, 0x3F,
|
||||
0x63, 0x14, 0x08, 0x14, 0x63,
|
||||
0x03, 0x04, 0x78, 0x04, 0x03,
|
||||
0x61, 0x59, 0x49, 0x4D, 0x43,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x41,
|
||||
0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x00, 0x41, 0x41, 0x41, 0x7F,
|
||||
0x04, 0x02, 0x01, 0x02, 0x04,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x00, 0x03, 0x07, 0x08, 0x00,
|
||||
0x20, 0x54, 0x54, 0x78, 0x40,
|
||||
0x7F, 0x28, 0x44, 0x44, 0x38,
|
||||
0x38, 0x44, 0x44, 0x44, 0x28,
|
||||
0x38, 0x44, 0x44, 0x28, 0x7F,
|
||||
0x38, 0x54, 0x54, 0x54, 0x18,
|
||||
0x00, 0x08, 0x7E, 0x09, 0x02,
|
||||
0x18, 0xA4, 0xA4, 0x9C, 0x78,
|
||||
0x7F, 0x08, 0x04, 0x04, 0x78,
|
||||
0x00, 0x44, 0x7D, 0x40, 0x00,
|
||||
0x20, 0x40, 0x40, 0x3D, 0x00,
|
||||
0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x41, 0x7F, 0x40, 0x00,
|
||||
0x7C, 0x04, 0x78, 0x04, 0x78,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x78,
|
||||
0x38, 0x44, 0x44, 0x44, 0x38,
|
||||
0xFC, 0x18, 0x24, 0x24, 0x18,
|
||||
0x18, 0x24, 0x24, 0x18, 0xFC,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x08,
|
||||
0x48, 0x54, 0x54, 0x54, 0x24,
|
||||
0x04, 0x04, 0x3F, 0x44, 0x24,
|
||||
0x3C, 0x40, 0x40, 0x20, 0x7C,
|
||||
0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||
0x3C, 0x40, 0x30, 0x40, 0x3C,
|
||||
0x44, 0x28, 0x10, 0x28, 0x44,
|
||||
0x4C, 0x90, 0x90, 0x90, 0x7C,
|
||||
0x44, 0x64, 0x54, 0x4C, 0x44,
|
||||
0x00, 0x08, 0x36, 0x41, 0x00,
|
||||
0x00, 0x00, 0x77, 0x00, 0x00,
|
||||
0x00, 0x41, 0x36, 0x08, 0x00,
|
||||
0x02, 0x01, 0x02, 0x04, 0x02,
|
||||
0x3C, 0x26, 0x23, 0x26, 0x3C,
|
||||
0x1E, 0xA1, 0xA1, 0x61, 0x12,
|
||||
0x3A, 0x40, 0x40, 0x20, 0x7A,
|
||||
0x38, 0x54, 0x54, 0x55, 0x59,
|
||||
0x21, 0x55, 0x55, 0x79, 0x41,
|
||||
0x21, 0x54, 0x54, 0x78, 0x41,
|
||||
0x21, 0x55, 0x54, 0x78, 0x40,
|
||||
0x20, 0x54, 0x55, 0x79, 0x40,
|
||||
0x0C, 0x1E, 0x52, 0x72, 0x12,
|
||||
0x39, 0x55, 0x55, 0x55, 0x59,
|
||||
0x39, 0x54, 0x54, 0x54, 0x59,
|
||||
0x39, 0x55, 0x54, 0x54, 0x58,
|
||||
0x00, 0x00, 0x45, 0x7C, 0x41,
|
||||
0x00, 0x02, 0x45, 0x7D, 0x42,
|
||||
0x00, 0x01, 0x45, 0x7C, 0x40,
|
||||
0xF0, 0x29, 0x24, 0x29, 0xF0,
|
||||
0xF0, 0x28, 0x25, 0x28, 0xF0,
|
||||
0x7C, 0x54, 0x55, 0x45, 0x00,
|
||||
0x20, 0x54, 0x54, 0x7C, 0x54,
|
||||
0x7C, 0x0A, 0x09, 0x7F, 0x49,
|
||||
0x32, 0x49, 0x49, 0x49, 0x32,
|
||||
0x32, 0x48, 0x48, 0x48, 0x32,
|
||||
0x32, 0x4A, 0x48, 0x48, 0x30,
|
||||
0x3A, 0x41, 0x41, 0x21, 0x7A,
|
||||
0x3A, 0x42, 0x40, 0x20, 0x78,
|
||||
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
|
||||
0x39, 0x44, 0x44, 0x44, 0x39,
|
||||
0x3D, 0x40, 0x40, 0x40, 0x3D,
|
||||
0x3C, 0x24, 0xFF, 0x24, 0x24,
|
||||
0x48, 0x7E, 0x49, 0x43, 0x66,
|
||||
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
|
||||
0xFF, 0x09, 0x29, 0xF6, 0x20,
|
||||
0xC0, 0x88, 0x7E, 0x09, 0x03,
|
||||
0x20, 0x54, 0x54, 0x79, 0x41,
|
||||
0x00, 0x00, 0x44, 0x7D, 0x41,
|
||||
0x30, 0x48, 0x48, 0x4A, 0x32,
|
||||
0x38, 0x40, 0x40, 0x22, 0x7A,
|
||||
0x00, 0x7A, 0x0A, 0x0A, 0x72,
|
||||
0x7D, 0x0D, 0x19, 0x31, 0x7D,
|
||||
0x26, 0x29, 0x29, 0x2F, 0x28,
|
||||
0x26, 0x29, 0x29, 0x29, 0x26,
|
||||
0x30, 0x48, 0x4D, 0x40, 0x20,
|
||||
0x38, 0x08, 0x08, 0x08, 0x08,
|
||||
0x08, 0x08, 0x08, 0x08, 0x38,
|
||||
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
|
||||
0x2F, 0x10, 0x28, 0x34, 0xFA,
|
||||
0x00, 0x00, 0x7B, 0x00, 0x00,
|
||||
0x08, 0x14, 0x2A, 0x14, 0x22,
|
||||
0x22, 0x14, 0x2A, 0x14, 0x08,
|
||||
0xAA, 0x00, 0x55, 0x00, 0xAA,
|
||||
0xAA, 0x55, 0xAA, 0x55, 0xAA,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x00,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x00,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x00,
|
||||
0x10, 0x10, 0xFF, 0x00, 0xFF,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x14, 0x14, 0x14, 0xFC, 0x00,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xFF,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xFC,
|
||||
0x14, 0x14, 0x17, 0x10, 0x1F,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0x1F, 0x00,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x14,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x17,
|
||||
0x00, 0x00, 0xFC, 0x04, 0xF4,
|
||||
0x14, 0x14, 0x17, 0x10, 0x17,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xF4,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x17, 0x14,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0xF4, 0x14,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x14,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x14,
|
||||
0x00, 0x00, 0xF0, 0x10, 0xF0,
|
||||
0x10, 0x10, 0xFF, 0x10, 0xFF,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x14,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x10,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
|
||||
0x38, 0x44, 0x44, 0x38, 0x44,
|
||||
0x7C, 0x2A, 0x2A, 0x3E, 0x14,
|
||||
0x7E, 0x02, 0x02, 0x06, 0x06,
|
||||
0x02, 0x7E, 0x02, 0x7E, 0x02,
|
||||
0x63, 0x55, 0x49, 0x41, 0x63,
|
||||
0x38, 0x44, 0x44, 0x3C, 0x04,
|
||||
0x40, 0x7E, 0x20, 0x1E, 0x20,
|
||||
0x06, 0x02, 0x7E, 0x02, 0x02,
|
||||
0x99, 0xA5, 0xE7, 0xA5, 0x99,
|
||||
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
|
||||
0x4C, 0x72, 0x01, 0x72, 0x4C,
|
||||
0x30, 0x4A, 0x4D, 0x4D, 0x30,
|
||||
0x30, 0x48, 0x78, 0x48, 0x30,
|
||||
0xBC, 0x62, 0x5A, 0x46, 0x3D,
|
||||
0x3E, 0x49, 0x49, 0x49, 0x00,
|
||||
0x7E, 0x01, 0x01, 0x01, 0x7E,
|
||||
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
|
||||
0x44, 0x44, 0x5F, 0x44, 0x44,
|
||||
0x40, 0x51, 0x4A, 0x44, 0x40,
|
||||
0x40, 0x44, 0x4A, 0x51, 0x40,
|
||||
0x00, 0x00, 0xFF, 0x01, 0x03,
|
||||
0xE0, 0x80, 0xFF, 0x00, 0x00,
|
||||
0x08, 0x08, 0x6B, 0x6B, 0x08,
|
||||
0x36, 0x12, 0x36, 0x24, 0x36,
|
||||
0x06, 0x0F, 0x09, 0x0F, 0x06,
|
||||
0x00, 0x00, 0x18, 0x18, 0x00,
|
||||
0x00, 0x00, 0x10, 0x10, 0x00,
|
||||
0x30, 0x40, 0xFF, 0x01, 0x01,
|
||||
0x00, 0x1F, 0x01, 0x01, 0x1E,
|
||||
0x00, 0x19, 0x1D, 0x17, 0x12,
|
||||
0x00, 0x3C, 0x3C, 0x3C, 0x3C,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00
|
||||
])}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
|
||||
seriffont = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x03, 0x00, 0x03, 0x00, 0x00, 0x00, #0x00,
|
||||
0x12, 0x3F, 0x12, 0x3F, 0x12, 0x00, #0x00,
|
||||
0x26, 0x7F, 0x32, 0x00, 0x00, 0x00, #0x00,
|
||||
0x13, 0x0B, 0x34, 0x32, 0x00, 0x00, #0x00,
|
||||
0x1A, 0x25, 0x1A, 0x28, 0x00, 0x00, #0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x7E, 0x81, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x81, 0x7E, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x06, 0x06, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x08, 0x1C, 0x08, 0x00, 0x00, 0x00, #0x00,
|
||||
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x08, 0x08, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x38, 0x07, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1E, 0x21, 0x21, 0x1E, 0x00, 0x00, #0x00,
|
||||
0x02, 0x3F, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x32, 0x29, 0x29, 0x36, 0x00, 0x00, #0x00,
|
||||
0x12, 0x21, 0x25, 0x1A, 0x00, 0x00, #0x00,
|
||||
0x18, 0x16, 0x3F, 0x10, 0x00, 0x00, #0x00,
|
||||
0x27, 0x25, 0x19, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1E, 0x25, 0x25, 0x18, 0x00, 0x00, #0x00,
|
||||
0x03, 0x39, 0x07, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1A, 0x25, 0x25, 0x1A, 0x00, 0x00, #0x00,
|
||||
0x06, 0x29, 0x29, 0x1E, 0x00, 0x00, #0x00,
|
||||
0x24, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x08, 0x14, 0x22, 0x00, 0x00, 0x00, #0x00,
|
||||
0x14, 0x14, 0x14, 0x00, 0x00, 0x00, #0x00,
|
||||
0x22, 0x14, 0x08, 0x00, 0x00, 0x00, #0x00,
|
||||
0x02, 0x29, 0x05, 0x02, 0x00, 0x00, #0x00,
|
||||
0x1C, 0x22, 0x49, 0x55, 0x59, 0x12, #0x0C,
|
||||
0x30, 0x2C, 0x0B, 0x0B, 0x2C, 0x30, #0x00,
|
||||
0x21, 0x3F, 0x25, 0x25, 0x1A, 0x00, #0x00,
|
||||
0x1E, 0x21, 0x21, 0x21, 0x13, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x21, 0x21, 0x1E, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x25, 0x33, 0x00, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x25, 0x03, 0x00, 0x00, #0x00,
|
||||
0x1E, 0x21, 0x21, 0x29, 0x3B, 0x00, #0x00,
|
||||
0x3F, 0x04, 0x04, 0x3F, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x21, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x21, 0x1F, 0x01, 0x00, 0x00, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x0C, 0x33, 0x21, 0x00, #0x00,
|
||||
0x3F, 0x21, 0x30, 0x00, 0x00, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x0C, 0x30, 0x0C, 0x3F, #0x21,
|
||||
0x3F, 0x03, 0x0C, 0x3F, 0x01, 0x00, #0x00,
|
||||
0x1E, 0x21, 0x21, 0x21, 0x1E, 0x00, #0x00,
|
||||
0x3F, 0x29, 0x06, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1E, 0x21, 0x21, 0x61, 0x1E, 0x00, #0x00,
|
||||
0x21, 0x3F, 0x09, 0x36, 0x00, 0x00, #0x00,
|
||||
0x32, 0x25, 0x25, 0x1B, 0x00, 0x00, #0x00,
|
||||
0x01, 0x3F, 0x01, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1F, 0x21, 0x20, 0x21, 0x1F, 0x00, #0x00,
|
||||
0x03, 0x0D, 0x30, 0x30, 0x0D, 0x03, #0x00,
|
||||
0x0F, 0x31, 0x0C, 0x0C, 0x31, 0x0F, #0x00,
|
||||
0x21, 0x33, 0x0C, 0x0C, 0x33, 0x21, #0x00,
|
||||
0x03, 0x24, 0x38, 0x24, 0x03, 0x01, #0x00,
|
||||
0x29, 0x25, 0x33, 0x00, 0x00, 0x00, #0x00,
|
||||
0x7F, 0x41, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x07, 0x38, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x41, 0x7F, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x02, 0x01, 0x02, 0x00, 0x00, 0x00, #0x00,
|
||||
0x40, 0x40, 0x40, 0x40, 0x00, 0x00, #0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x14, 0x24, 0x38, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x28, 0x24, 0x18, 0x00, 0x00, #0x00,
|
||||
0x18, 0x24, 0x24, 0x00, 0x00, 0x00, #0x00,
|
||||
0x18, 0x24, 0x25, 0x3F, 0x00, 0x00, #0x00,
|
||||
0x18, 0x24, 0x28, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3E, 0x25, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x18, 0xA4, 0xA4, 0x7C, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x04, 0x38, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0xFD, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x18, 0x24, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3C, 0x04, 0x38, 0x04, 0x38, 0x00, #0x00,
|
||||
0x3C, 0x04, 0x38, 0x00, 0x00, 0x00, #0x00,
|
||||
0x18, 0x24, 0x24, 0x18, 0x00, 0x00, #0x00,
|
||||
0xFC, 0xA4, 0x24, 0x18, 0x00, 0x00, #0x00,
|
||||
0x18, 0x24, 0xA4, 0xFC, 0x00, 0x00, #0x00,
|
||||
0x3C, 0x04, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x28, 0x24, 0x14, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1E, 0x24, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x1C, 0x20, 0x3C, 0x00, 0x00, 0x00, #0x00,
|
||||
0x0C, 0x30, 0x0C, 0x00, 0x00, 0x00, #0x00,
|
||||
0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x00, #0x00,
|
||||
0x24, 0x18, 0x24, 0x00, 0x00, 0x00, #0x00,
|
||||
0x9C, 0x60, 0x1C, 0x00, 0x00, 0x00, #0x00,
|
||||
0x34, 0x24, 0x2C, 0x00, 0x00, 0x00, #0x00,
|
||||
0x08, 0x77, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x77, 0x08, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, #0x00,
|
||||
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, #0x00
|
||||
])}
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
terminalfont = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
|
||||
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
|
||||
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
|
||||
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
|
||||
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
|
||||
0x00, 0x36, 0x49, 0x56, 0x20, 0x50,
|
||||
0x00, 0x00, 0x07, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00,
|
||||
0x00, 0x00, 0x41, 0x3E, 0x00, 0x00,
|
||||
0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08,
|
||||
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||
0x00, 0x00, 0xE0, 0x60, 0x00, 0x00,
|
||||
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
|
||||
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||
0x00, 0x62, 0x51, 0x49, 0x49, 0x46,
|
||||
0x00, 0x22, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||
0x00, 0x2F, 0x49, 0x49, 0x49, 0x31,
|
||||
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,
|
||||
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,
|
||||
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,
|
||||
0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
|
||||
0x00, 0x24, 0x24, 0x24, 0x24, 0x24,
|
||||
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,
|
||||
0x00, 0x02, 0x01, 0x59, 0x09, 0x06,
|
||||
0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E,
|
||||
0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E,
|
||||
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,
|
||||
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||
0x00, 0x30, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||
0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F,
|
||||
0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F,
|
||||
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x19, 0x66,
|
||||
0x00, 0x26, 0x49, 0x49, 0x49, 0x32,
|
||||
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,
|
||||
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||
0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F,
|
||||
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,
|
||||
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,
|
||||
0x00, 0x71, 0x49, 0x45, 0x43, 0x00,
|
||||
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,
|
||||
0x00, 0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,
|
||||
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
|
||||
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,
|
||||
0x00, 0x7F, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x28,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x7F,
|
||||
0x00, 0x38, 0x54, 0x54, 0x54, 0x08,
|
||||
0x00, 0x08, 0x7E, 0x09, 0x09, 0x00,
|
||||
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,
|
||||
0x00, 0x7F, 0x04, 0x04, 0x78, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7D, 0x40, 0x00,
|
||||
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,
|
||||
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7F, 0x40, 0x00,
|
||||
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,
|
||||
0x00, 0x7C, 0x04, 0x04, 0x78, 0x00,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0xFC, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0xFC,
|
||||
0x00, 0x44, 0x78, 0x44, 0x04, 0x08,
|
||||
0x00, 0x08, 0x54, 0x54, 0x54, 0x20,
|
||||
0x00, 0x04, 0x3E, 0x44, 0x24, 0x00,
|
||||
0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00,
|
||||
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||
0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C,
|
||||
0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00,
|
||||
0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00,
|
||||
0x00, 0x64, 0x54, 0x54, 0x4C, 0x00,
|
||||
0x00, 0x08, 0x3E, 0x41, 0x41, 0x00,
|
||||
0x00, 0x00, 0x00, 0x77, 0x00, 0x00,
|
||||
0x00, 0x00, 0x41, 0x41, 0x3E, 0x08,
|
||||
0x00, 0x02, 0x01, 0x02, 0x01, 0x00,
|
||||
0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C
|
||||
])}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# My MicroPython repository
|
||||
|
||||
## Contents
|
||||
|
||||
* ST7735 - Sainsmart LCD display driver.
|
|
@ -0,0 +1,12 @@
|
|||
This is a Micro Python board
|
||||
|
||||
You can get started right away by writing your Python code in 'main.py'.
|
||||
|
||||
For a serial prompt:
|
||||
- Windows: you need to go to 'Device manager', right click on the unknown device,
|
||||
then update the driver software, using the 'pybcdc.inf' file found on this drive.
|
||||
Then use a terminal program like Hyperterminal or putty.
|
||||
- Mac OS X: use the command: screen /dev/tty.usbmodem*
|
||||
- Linux: use the command: screen /dev/ttyACM0
|
||||
|
||||
Please visit http://micropython.org/help/ for further help.
|
|
@ -0,0 +1,113 @@
|
|||
#Display distance reported by the HC-SR04 on the ST7735 LCD.
|
||||
|
||||
import ultrasonic
|
||||
import pyb
|
||||
from ST7735 import NAVY, CYAN, Point, TFTColor
|
||||
import terminalfont
|
||||
|
||||
ZeroPoint = Point(0, 0)
|
||||
SONAR_DELAY = 100
|
||||
FONT_HEIGHT = terminalfont.terminalfont["Height"]
|
||||
|
||||
#100-15 = blue
|
||||
#15-10 = green
|
||||
#10-5 = yellow
|
||||
#5-0 = red
|
||||
|
||||
COLORS = [(0, 255, 0, 0)
|
||||
(5, 255, 255, 0),
|
||||
(10, 0, 255, 0),
|
||||
(15, 0, 0, 255),
|
||||
]
|
||||
|
||||
def getrgb( aDistance ) :
|
||||
'''Get an interpolated TFTColor based on distance.
|
||||
Uses the COLORS list.'''
|
||||
clr = NAVY
|
||||
|
||||
def interp(l, v0, v1):
|
||||
return (v0 * (1.0 - l) + (v1 * l))
|
||||
|
||||
for i in range(1, len(COLORS)) :
|
||||
c = colors[i]
|
||||
if c[0] >= aDistance:
|
||||
rng0, r0, g0, b0 = colors[i - 1]
|
||||
rng1, r1, g1, b1 = c
|
||||
#interpolate between rng0 and rng1
|
||||
l = (aDistance - rng0) / float(rng1 - rng0)
|
||||
r = interp(l, r0, r1)
|
||||
g = interp(l, g0, g1)
|
||||
b = interp(l, b0, b1)
|
||||
clr = TFTColor(r,g,b)
|
||||
|
||||
return clr
|
||||
|
||||
class RangePoint(object):
|
||||
"""Display a point on the screen"""
|
||||
|
||||
def __init__(self, aSize):
|
||||
self.size = aSize
|
||||
self.pos = Point(-1, 0)
|
||||
self.prevdistance = -1
|
||||
|
||||
def update( self, aDisplay, aDistance, aTime ) :
|
||||
if (self.prevdistance != aDistance):
|
||||
self._draw(aDisplay, 0)
|
||||
clr = getrgb(aDistance)
|
||||
self.pos.x = int((aDisplay.size.x / 2) - (self.size / 2))
|
||||
y = min(1.0, aDistance / MAXRANGE)
|
||||
self.pos.y = int(y * aDisplay.size.y)
|
||||
self._draw(aDisplay, clr)
|
||||
self.prevdistance = aDistance
|
||||
|
||||
def _draw( self, aDisplay, aColor ) :
|
||||
if self.pos.x >= 0:
|
||||
aDisplay.fillrect(self.pos, self.size, aColor)
|
||||
|
||||
class SonarDisplay(object):
|
||||
"""Display HC-SR04 distance on ST7735 LCD with text and a box"""
|
||||
def __init__( self, aDisplay, aTrigger, aEcho ):
|
||||
self.display = aDisplay
|
||||
self.triggerpin = aTrigger
|
||||
self.echopin = aEcho
|
||||
self.rangepoint = RangePoint(4)
|
||||
self.hc = ultrasonic.Ultrasonic(self.triggerpin, self.echopin)
|
||||
|
||||
def printdistance( self, aDistance ) :
|
||||
s = "I: " + str(aDistance)
|
||||
aDisplay.fillrect(ZeroPoint, Point(aDisplay.size.x, FONT_HEIGHT), 0)
|
||||
aDisplay.drawstring(ZeroPoint, s, CYAN, terminalfont.terminalfont)
|
||||
|
||||
def run( self ):
|
||||
self.display.fill(0)
|
||||
sw = pyb.Switch()
|
||||
lasttime = pyb.millis()
|
||||
while sw() == False :
|
||||
pyb.delay(SONAR_DELAY)
|
||||
distance = self.hc.distance_in_inches()
|
||||
thistime = pyb.millis()
|
||||
t = thistime - lasttime
|
||||
self.printdistance(distance)
|
||||
self.rangepoint.update(self.display, distance, t / 1000.0)
|
||||
lasttime = thistime
|
||||
|
||||
# sensor1_trigPin = pyb.Pin.board.X8
|
||||
# sensor1_echoPin = pyb.Pin.board.X7
|
||||
|
||||
# sensor1 = ultrasonic.Ultrasonic(sensor1_trigPin, sensor1_echoPin)
|
||||
|
||||
# switch = pyb.Switch()
|
||||
|
||||
# # function that prints each sensor's distance
|
||||
# def print_sensor_values():
|
||||
# # get sensor1's distance in cm
|
||||
# distance1 = sensor1.distance_in_inches()
|
||||
|
||||
# print("Sensor1", distance1, "inches")
|
||||
|
||||
# # prints values every second
|
||||
# while True:
|
||||
# print("Sensing")
|
||||
# print_sensor_values()
|
||||
# # ultrasonic.wait(10000)
|
||||
# pyb.delay(100)
|
|
@ -0,0 +1,41 @@
|
|||
# Control bot that throws treats using a servo
|
||||
|
||||
import pyb
|
||||
|
||||
servoNum = 1
|
||||
servoCenter = 1440
|
||||
servoSpeed = 100
|
||||
servoTime = 1450
|
||||
ledNum = 3
|
||||
triggerInput = 'X3'
|
||||
|
||||
def runservo( aServo, aSpeed, aDelay ):
|
||||
aServo.speed(aSpeed)
|
||||
pyb.delay(aDelay)
|
||||
aServo.speed(0)
|
||||
|
||||
def main( ) :
|
||||
s1 = pyb.Servo(servoNum)
|
||||
btn = pyb.Pin(triggerInput, pyb.Pin.IN, pyb.Pin.PULL_UP)
|
||||
mn, mx, _, a, s = s1.calibration()
|
||||
s1.calibration(mn, mx, servoCenter, a, s)
|
||||
s1.speed(0)
|
||||
l = pyb.LED(ledNum)
|
||||
|
||||
def throwit( ):
|
||||
l.on()
|
||||
runservo(s1, servoSpeed, servoTime)
|
||||
l.off()
|
||||
|
||||
sw = pyb.Switch()
|
||||
# sw.callback(throwit)
|
||||
|
||||
while(1):
|
||||
if (btn.value() == 0):
|
||||
throwit()
|
||||
if sw():
|
||||
break;
|
||||
pyb.delay(20)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,63 @@
|
|||
|
||||
import pyb
|
||||
import time
|
||||
from ST7735 import Point, CYAN, RED, GREEN, YELLOW, TFTColor
|
||||
|
||||
#todo: Pick a ransom spot, random radius, random color
|
||||
#todo: Animate the spot
|
||||
|
||||
colorA = [CYAN, RED, GREEN, YELLOW]
|
||||
|
||||
class bomb(object):
|
||||
"""Animate a circle on the screen."""
|
||||
def __init__(self, aPos, aRadius, aColor, aSpeed):
|
||||
self.pos = aPos
|
||||
self.radius = aRadius
|
||||
self.color = aColor
|
||||
self.speed = aSpeed
|
||||
self.curradius = 0.0
|
||||
self.state = 0
|
||||
|
||||
def update( self, aDisplay, aTime ) :
|
||||
self.curradius += self.speed * aTime
|
||||
rad = self.curradius
|
||||
color = self.color
|
||||
if self.curradius > self.radius:
|
||||
rad = self.radius
|
||||
self.state += 1
|
||||
self.color = 0
|
||||
self.curradius = 1.0
|
||||
|
||||
aDisplay.fillcircle(self.pos, rad, color)
|
||||
|
||||
return self.state != 2
|
||||
|
||||
def randval( aVal ) :
|
||||
v = pyb.rng() & 0xFFFF
|
||||
return aVal * (v / 65535.0)
|
||||
|
||||
class bomber(object):
|
||||
"""Control a bunch of bombs."""
|
||||
def __init__(self, aDisplay):
|
||||
self.display = aDisplay
|
||||
self.numbombs = 4
|
||||
self.bombs = []
|
||||
self.sw = pyb.Switch()
|
||||
|
||||
def addbomb( self ) :
|
||||
x = int(randval(self.display.size.x))
|
||||
y = int(randval(self.display.size.y))
|
||||
rad = randval(20) + 5
|
||||
r = pyb.rng() & 0xFF
|
||||
g = pyb.rng() & 0xFF
|
||||
b = pyb.rng() & 0xFF
|
||||
spd = randval(30.0) + 1.0
|
||||
clr = TFTColor(r,g,b) #colorA[pyb.rng() & 0x03]
|
||||
self.bombs.insert(0, bomb(Point(x, y), rad, clr, spd))
|
||||
|
||||
def run( self ) :
|
||||
while self.sw() == False :
|
||||
pyb.delay(100)
|
||||
if len(self.bombs) < self.numbombs:
|
||||
self.addbomb()
|
||||
self.bombs = [b for b in self.bombs if b.update(self.display, 0.1) ]
|
|
@ -0,0 +1,70 @@
|
|||
#Show level bubble run by the accelerometer
|
||||
|
||||
import pyb
|
||||
from ST7735 import RED, CYAN, Point
|
||||
import terminalfont
|
||||
|
||||
ZeroPoint = Point(0, 0)
|
||||
|
||||
class Bubble(object):
|
||||
"""Circle simulating the level bubble."""
|
||||
|
||||
def __init__(self, aCenter, aSpeed, aRadius, aColor):
|
||||
self.center = aCenter.clone()
|
||||
self.pos = aCenter.clone()
|
||||
self.oldpos = pos.clone()
|
||||
self.speed = aSpeed
|
||||
self.radius = aRadius
|
||||
self.color = aColor
|
||||
self.accel = pyb.Accel()
|
||||
|
||||
def update( self, aDisplay, aTime ) :
|
||||
xtilt, ytilt, _ = self.accel.filtered_xyz()
|
||||
# xtilt = self.accel.x()
|
||||
# ytilt = self.accel.y()
|
||||
|
||||
xs = (aDisplay.size.x / 2) / 70.0
|
||||
ys = (aDisplay.size.y / 2) / 60.0
|
||||
|
||||
self.oldpos.x = self.pos.x
|
||||
self.oldpos.y = self.pos.y
|
||||
self.pos.x = int(self.center.x + xtilt * xs)
|
||||
self.pos.y = int(self.center.y - ytilt * ys)
|
||||
s = "x: " + str(xtilt) + " y: " + str(ytilt)
|
||||
aDisplay.fillrect(ZeroPoint, Point(aDisplay.size.x, 10), 0)
|
||||
aDisplay.drawstring(ZeroPoint, s, CYAN, terminalfont.terminalfont)
|
||||
# aTime *= self.speed
|
||||
# self.pos.x += xtilt * aTime
|
||||
# self.pos.y -= ytilt * aTime
|
||||
|
||||
self._clamp(aDisplay)
|
||||
aDisplay.fillcircle(self.oldpos, self.radius, 0)
|
||||
self._draw(aDisplay, self.color)
|
||||
|
||||
def _draw( self, aDisplay, aColor ) :
|
||||
aDisplay.fillcircle(self.pos, self.radius, aColor)
|
||||
|
||||
def _clamp( self, aDisplay ) :
|
||||
l = self.radius
|
||||
t = l
|
||||
r = aDisplay.size.x - l
|
||||
b = aDisplay.size.y - l
|
||||
self.pos.x = max(l, min(self.pos.x, r))
|
||||
self.pos.y = max(t, min(self.pos.y, b))
|
||||
|
||||
class Level(object):
|
||||
"""Simulate a level by controlling a bubble on the aDisplay
|
||||
controlled by the accelerometer."""
|
||||
def __init__(self, aDisplay):
|
||||
self.display = aDisplay
|
||||
center = aDisplay.size.clone()
|
||||
center.x /= 2
|
||||
center.y /= 2
|
||||
self.bubble = Bubble(center, 10.0, 5, RED)
|
||||
|
||||
def run( self ) :
|
||||
self.display.fill(0)
|
||||
sw = pyb.Switch()
|
||||
while sw() == False :
|
||||
pyb.delay(100)
|
||||
self.bubble.update(self.display, 0.1)
|
|
@ -0,0 +1,31 @@
|
|||
# main.py -- put your code here!
|
||||
|
||||
# import TreatThrower
|
||||
# import Balance
|
||||
|
||||
# Balance.main()
|
||||
|
||||
from basicfont import *
|
||||
from seriffont import *
|
||||
from terminalfont import *
|
||||
from bombs import bomber
|
||||
from level import Level
|
||||
|
||||
t = makeg()
|
||||
|
||||
def tst( aColor ):
|
||||
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=_+[]{}l;'<>?,./!@#$%^&*():"
|
||||
t.drawstring(Point(0, 0), s, aColor, basicfont)
|
||||
t.drawstring(Point(0, 40), s, aColor, seriffont)
|
||||
t.drawstring(Point(0, 80), s, aColor, terminalfont)
|
||||
|
||||
# tst(BLUE)
|
||||
|
||||
def s(aRot, aColor):
|
||||
t.setrotation(aRot)
|
||||
tst(aColor)
|
||||
|
||||
# b = bomber(t)
|
||||
t.setrotation(2)
|
||||
l = Level(t)
|
||||
l.run()
|
Ładowanie…
Reference in New Issue