bluemarble.py
Convert bluemarble.jpg to bitmap module
utils/image_converter.py bluemarble.jpg 8 >bluemarble.py
Since the bitmap is large use mpy-cross to precompile the bluemarble.py module to save memory.
mpy-cross bluemarble.py
Upload the compiled bitmap module bluemarble.mpy and example program pbitmap.py
Bluemarble image courtesy of the NASA image and video gallery available at https://images.nasa.gov/
1"""
2bluemarble.py
3=============
4
5 .. figure:: /_static/bluemarble.png
6 :align: center
7
8 Draw a full screen bitmap on the display.
9
10 Convert bluemarble.jpg to bitmap module
11
12 .. code-block:: console
13
14 utils/image_converter.py bluemarble.jpg 8 >bluemarble.py
15
16 Since the bitmap is large use mpy-cross to precompile the bluemarble.py module to save memory.
17
18 .. code-block:: console
19
20 mpy-cross bluemarble.py
21
22 Upload the compiled bitmap module `bluemarble.mpy` and example program `pbitmap.py`
23
24 Bluemarble image courtesy of the NASA image and video gallery available at
25 https://images.nasa.gov/
26"""
27
28import gc
29import time
30import gc9a01
31import tft_config
32
33import bluemarble_bitmap
34
35
36def main():
37 """
38 Draw the bitmap on the display
39 """
40 gc.enable()
41 gc.collect()
42
43 # initialize display
44 tft = tft_config.config(tft_config.TALL)
45
46 # enable display and clear screen
47 tft.init()
48 tft.fill(gc9a01.BLACK)
49
50 # display bitmap
51 tft.pbitmap(bluemarble_bitmap, 0, 0)
52
53
54main()