diff --git a/examples/framerate.py b/examples/framerate.py index fea1c0c..e42eacd 100644 --- a/examples/framerate.py +++ b/examples/framerate.py @@ -20,6 +20,7 @@ # THE SOFTWARE. import time import math +import sys from PIL import Image from PIL import ImageDraw @@ -27,6 +28,18 @@ import ST7735 as ST7735 SPI_SPEED_MHZ = 10 # Higher speed = higher framerate +if len(sys.argv) > 1: + SPI_SPEED_MHZ = int(sys.argv[1]) + +print(""" +framerate.py - Test LCD framerate. + +If you're using Breakout Garden, plug the 0.96" LCD (SPI) +breakout into the rear slot. + +Running at: {}MHz +""".format(SPI_SPEED_MHZ)) + # Create ST7735 LCD display class. disp = ST7735.ST7735( port=0, @@ -34,7 +47,7 @@ disp = ST7735.ST7735( dc=9, backlight=18, rotation=90, - spi_speed_hz=10 * 1000000 + spi_speed_hz=SPI_SPEED_MHZ * 1000000 ) WIDTH = disp.width @@ -65,7 +78,7 @@ while True: count += 1 time_current = time.time() - time_start if count % 120 == 0: - print("Time: {}, Frames: {}, FPS: {}".format( + print("Time: {:8.3f}, Frames: {:6d}, FPS: {:8.3f}".format( time_current, count, count / time_current)) diff --git a/examples/gif.py b/examples/gif.py index 8c24ee0..81f5559 100644 --- a/examples/gif.py +++ b/examples/gif.py @@ -23,6 +23,13 @@ import ST7735 import time import sys +print(""" +gif.py - Display a gif on the LCD. + +If you're using Breakout Garden, plug the 0.96" LCD (SPI) +breakout into the rear slot. +""") + if len(sys.argv) > 1: image_file = sys.argv[1] else: diff --git a/examples/image.py b/examples/image.py index e5fb562..3c74a29 100644 --- a/examples/image.py +++ b/examples/image.py @@ -23,6 +23,13 @@ import sys from PIL import Image import ST7735 as ST7735 +print(""" +image.py - Display an image on the LCD. + +If you're using Breakout Garden, plug the 0.96" LCD (SPI) +breakout into the rear slot. +""") + if len(sys.argv) < 2: print("Usage: {} ".format(sys.argv[0])) sys.exit(1) @@ -42,8 +49,6 @@ disp = ST7735.ST7735( WIDTH = disp.width HEIGHT = disp.height -print(WIDTH, HEIGHT) - # Initialize display. disp.begin()