-
Notifications
You must be signed in to change notification settings - Fork 59
/
test.py
58 lines (42 loc) · 1.75 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from time import sleep
import argparse
from test_functions import *
def parse_args():
p = argparse.ArgumentParser(description='Test EPD functionality')
p.add_argument('-v', '--virtual', action='store_true',
help='display using a Tkinter window instead of the '
'actual e-paper device (for testing without a '
'physical device)')
p.add_argument('-r', '--rotate', default=None, choices=['CW', 'CCW', 'flip'],
help='run the tests with the display rotated by the specified value')
p.add_argument('-m', '--mirror', action='store_true',
help='Mirror the display (use this if text appears backwards)')
return p.parse_args()
def main():
args = parse_args()
tests = []
if not args.virtual:
from IT8951.display import AutoEPDDisplay
print('Initializing EPD...')
# here, spi_hz controls the rate of data transfer to the device, so a higher
# value means faster display refreshes. the documentation for the IT8951 device
# says the max is 24 MHz (24000000), but my device seems to still work as high as
# 80 MHz (80000000)
display = AutoEPDDisplay(vcom=-2.15, rotate=args.rotate, mirror=args.mirror, spi_hz=24000000)
print('VCOM set to', display.epd.get_vcom())
tests += [print_system_info]
else:
from IT8951.display import VirtualEPDDisplay
display = VirtualEPDDisplay(dims=(800, 600), rotate=args.rotate, mirror=args.mirror)
tests += [
clear_display,
display_gradient,
partial_update,
display_image_8bpp,
]
for t in tests:
t(display)
sleep(1)
print('Done!')
if __name__ == '__main__':
main()