Skip to content

Commit 5c0fc43

Browse files
committed
Prior to further refactor.
1 parent 194b065 commit 5c0fc43

32 files changed

+1933
-1805
lines changed

README.md

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1+
TODO
2+
Installation
3+
lbt skips screens sometimes
4+
15
# micropython-lcd160gui
26

3-
V0.13 20th Oct 2020 Support Jim Mussared's fast text rendering.
7+
V0.20 20th Oct 2020 Refactor as a Python package. Support Jim Mussared's fast
8+
text rendering. The refactor is a breaking change: applications will need to
9+
change import statements. The aim is to remove the need for cross compilation.
10+
Unused widgets no longer consume RAM. This also facilitates adding new widgets.
11+
412
V0.12 21st Sep 2020 Updated for (and requires) uasyncio V3.
5-
V0.11 21st Feb 2017 This doc updated May 2019.
613

714
Provides a simple touch driven event based GUI interface for the Pyboard when
815
used with the official LCD160CR colour display. It is based on the official
9-
driver and uses uasyncio for scheduling. The V1.1 display enables a Pyboard D
16+
driver and uses `uasyncio` for scheduling. The V1.1 display enables a Pyboard D
1017
to be plugged in. The GUI has been tested in this configuration.
1118

1219
It is targeted at hardware control and display applications. GUI objects are
@@ -51,8 +58,9 @@ The Plot module: Cartesian and polar graphs.
5158
1. [Pre requisites](./README.md#1-pre-requisites)
5259
1.1 [Pre installation](./README.md#11-pre-installation)
5360
1.2 [Library Documentation](./README.md#12-library-documentation)
54-
1.3 [Dependencies and Python files](./README.md#13-dependencies-and-python-files)
55-
1.4 [A performance boost](./README.md#14-a-performance-boost)
61+
1.3 [Installation](./README.md#13-installation)
62+
1.4 [Dependencies and Python files](./README.md#14-dependencies-and-python-files)
63+
1.5 [A performance boost](./README.md#15-a-performance-boost)
5664
2. [Concepts](./README.md#2-concepts)
5765
2.1 [Terminology](./README.md#21-terminology)
5866
2.2 [Coordinates](./README.md#22-coordinates)
@@ -91,12 +99,6 @@ The Plot module: Cartesian and polar graphs.
9199
Before running the GUI the hardware should be tested by working through the
92100
[tutorial](https://docs.micropython.org/en/latest/pyboard/pyboard/tutorial/lcd160cr_skin.html).
93101

94-
Owing to the size of the library and depending on the size of your application
95-
it may be necessary to freeze modules as bytecode. Users should therefore be
96-
familiar with building Micropython from source, and installing Python modules
97-
as persistent bytecode. Instructions on doing this may be found
98-
[here](http://forum.micropython.org/viewtopic.php?f=6&t=1776).
99-
100102
Familiarity with callbacks and event driven programming will assist in
101103
developing applications. No knowledge of `uasyncio` is required for application
102104
development as the API is callback-based, but the GUI is compatible with
@@ -112,10 +114,10 @@ Other references:
112114
[Proposed standard font format](https://github.com/peterhinch/micropython-font-to-py)
113115
[uasyncio libraries and notes](https://github.com/peterhinch/micropython-async)
114116

115-
## 1.3 Dependencies and Python files
117+
## 1.3 Installation
116118

117-
Version 3 of uasyncio is included in firmware V1.13 and later. This is a
118-
requirement.
119+
This comprises copying files and directories to the root directory on the
120+
target (typically `/flash` or `/sd`). The demos and their associated font
119121

120122
Clone the repo [uasyncio libraries and notes](https://github.com/peterhinch/micropython-async)
121123
to your PC and navigate to the V3 directory. Copy the directory `primitives`
@@ -124,19 +126,38 @@ these files are required:
124126
1. `__init__.py`
125127
2. `delay_ms.py`
126128

127-
Core files:
128-
1. `lcd160_gui.py` The micro GUI library.
129-
2. `lcd_local.py` Local hardware definition. This file should be edited to
129+
Copy the following files to the root directory on the target (`/flash` or
130+
`/sd`):
131+
`lcd160cr.py`, `lcd160_gui.py`, `lcd_local.py`, `constants.py`, `lplot.py`
132+
(optional)
133+
Copy the following directories with their contents to the root:
134+
`widgets`, `demos` (optional), `framebuf_utils` (optional, see below).
135+
136+
## 1.4 Dependencies and Python files
137+
138+
Version 3 of uasyncio is included in firmware V1.13 and later. This is a
139+
requirement.
140+
141+
Files in top level directory:
142+
1. `lcd_local.py` Local hardware definition. This file should be edited to
130143
match your hardware. On Pyboard D select the "X" connection.
144+
2. `font6.py` Font files used in demos. These may be frozen as bytecode to
145+
conserve RAM.
146+
3. `font10.py`
147+
4. `font14.py`
148+
149+
The fonts are generated from the free font FreeSans.ttf. See
150+
[External fonts](./README.md#81-external-fonts).
151+
152+
Core files in `core` directory:
153+
1. `lcd160cr.py` Official driver. Check for a newer version in the source tree
154+
(`drivers/display`).
155+
2. `lcd160_gui.py` The micro GUI library.
131156
3. `constants.py` Constants such as colors and shapes (import using
132-
`from constants import *`).
157+
`from core.constants import *`).
158+
4. `lplot.py` Optional graph plotting extension.
133159

134-
Optional files used by test programs:
135-
1. `font6.py` Font file.
136-
2. `font10.py` Ditto.
137-
3. `font14.py` Ditto. These are generated from the free font FreeSans.ttf.
138-
139-
Test/demo programs:
160+
Test/demo programs in `demos` directory:
140161
1. `lvst.py` A test program for vertical linear sliders. Also demos an
141162
asynchronous coroutine and linked sliders.
142163
2. `lhst.py` Tests horizontal slider controls, meter and LED. Demos
@@ -148,17 +169,22 @@ Test/demo programs:
148169
5. `ldd.py` Dropdown list and Listbox controls.
149170
6. `ldb.py` Modal dialog boxes.
150171
7. `ldb_if.py` As above but using an internal font.
172+
8. `lpt.py` Demo of plot module.
173+
9. `lptg.py` Plot with `TSequence` real time data acquisition.
174+
175+
Synchronisation primitives in `primitives` directory. This directory has a
176+
minimum subset
177+
178+
The organisation as a Python package means that cross compilation of
179+
`lcd160_gui.py` is no longer required on a Pyboard 1.1. To conserve RAM it is
180+
recommended that font files are implemented as frozen bytecode. To further
181+
reduce RAM this may be applied to other Python files.
151182

152-
By the standards of the Pyboard this is a large library. The `lcd160_gui.py`
153-
program is too large to be compiled on-board (unless using a Pyboard D) and
154-
must be cross-compiled. The test programs have been run with a standard
155-
firmware build. If memory problems are encountered Python code (including font
156-
files) may be implemented as frozen bytecode.
183+
It is wise to issue ctrl-D to soft reset the Pyboard before importing a module
184+
which uses the library. The test programs require a ctrl-D before import.
157185

158-
It is also wise to issue ctrl-D to soft reset the Pyboard before importing a
159-
module which uses the library. The test programs require a ctrl-D before import.
160186

161-
## 1.4 A performance boost
187+
## 1.5 A performance boost
162188

163189
This will only make a significant difference to applications which render
164190
substantial amounts of text using Python fonts.

core/__init__.py

Whitespace-only changes.
File renamed without changes.

0 commit comments

Comments
 (0)