Skip to content

Commit 05c9f64

Browse files
authored
Update README.md
1 parent b975c97 commit 05c9f64

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Next, you have to create a `Graphics` and `Touch` object that will be used by th
2525
Graphics graphics(tft);
2626
Touch touch(ts, YP, XM);
2727
```
28-
And then create a Screen template object with the number of UI elements in it. For example, if you need `5` button use the following:
28+
Then create a Screen template object with the number of UI elements in it. For example, if you need `5` button use the following:
2929
```
3030
Screen<5> screen(graphics, touch);
3131
```
@@ -44,7 +44,7 @@ When creating the `Graphics` object you have to pass an `Adafruit_GFX` object or
4444
MCUFRIEND_kbv tft;
4545
Graphics graphics(tft);
4646
```
47-
If you are doing the same you may want to setup your screen as usual in the `setup()` function:
47+
If you are doing the same you may want to set up your screen as usual in the `setup()` function:
4848
```
4949
setup() {
5050
tft.reset();
@@ -68,29 +68,29 @@ TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
6868
int rotation = 0;
6969
Touch touch(ts, YP, XM, rotation);
7070
```
71-
And then you have to `begin` to prompt the user to the calibration in the setup by passing the screen size and the `Graphics` object:
71+
Then you have to `begin` to prompt the user to the calibration in the setup passing the screen size and the `Graphics` object:
7272
```
7373
Touch::Calibration calibration = touch.begin(320, 240, graphics);
7474
// ... save the calibration
7575
7676
```
77-
This will returns a `Calibration` struct that you can save (for e.g into the prog-mem or an SD card) and then you can use after the next restart:
77+
This will return a `Calibration` struct that you can save (e.g into the prog-mem or an SD card) and then you can use after the next restart:
7878
```
7979
// ... load the calibration and or prompt the user "if" this is the first start:
8080
touch.begin(320, 240, calibration.tsMinX, calibration.tsMinY, calibration.tsMaxX, calibration.tsMaxY, calibration.alpha, calibration.cmax, calibration.cmin);
8181
8282
```
8383
## `Touch::Calibration` and `Touch::begin()`
8484

85-
For touch screen anti-spin the `Touch` object use and EMA (exponential moving average calculation with high/low threshold) that could be differ on each device thepending on the touch-screen sensiticity and device speed, you have to make an estimated pre-calculation to find the best parameters. By default the following constats are used:
85+
For touch screen anti-spin the `Touch` object use and EMA (exponential moving average calculation with high/low threshold) could differ on each device depending on the touch-screen sensitivity and device speed, you have to make an estimated pre-calculation to find the best parameters. By default, the following constants are used:
8686
```
8787
#define SCREEN_DEFAULT_CLK_ALPHA 10
8888
#define SCREEN_DEFAULT_CLK_MAX 150
8989
#define SCREEN_DEFAULT_CLK_MIN 30
9090
```
9191
You can predefine them before including the `Screen.h` or by passing them directly to the `Touch::begin` function as optional parameters.
9292

93-
The `Touch::begin` function calibration parameters and the `Calibration` sturct:
93+
The `Touch::begin` function calibration parameters and the `Calibration` struct:
9494
```
9595
struct Calibration {
9696
@@ -110,31 +110,31 @@ struct Calibration {
110110
```
111111

112112
## `Screen`
113-
After you created a `Screen` object, for e.g:
113+
After you create a `Screen` object, for e.g:
114114
```
115115
Screen<5> screen(gfx, ts);
116116
```
117-
then you can access to each element as an array like:
117+
then you can access each element as an array like:
118118
```
119119
Screen::Elem elem = screen[n]; // where `n` is the index of UI element (starts from zero)
120120
```
121121

122122
## `Screen::reset(size_t size)`
123-
Resets the screen and redraw all element. `size` parameter is optional, tells the `Screen` object how many elemet you are using. It's usefull when you set different pages and just redefined the screen elements bt using less or even more elements.
123+
Resets the screen and redraw all elements. `size` parameter is optional, and tells the `Screen` object how many elements you are using. It's useful when you set different pages and just redefine the screen elements by using fewer or even more elements.
124124

125125
Example:
126126
```
127127
screen.reset(3); // the screen.loop() method will taking care only the first 3 elements
128128
```
129129
## `Screen::size(size_t size)`
130-
Same as the `Screen::reset(size_t size)` but it won't reset the elements onli re-size the screen.
130+
Same as the `Screen::reset(size_t size)` but it won't reset the elements only re-size the screen.
131131

132132
Example:
133133
```
134134
screen.size(3); // the screen.loop() method will taking care only the first 3 elements
135135
```
136136
## `Screen::refresh()`
137-
Refreshes the screen. Usefull when you re-define the UI elements or re-size the screen.
137+
Refreshes the screen. Useful when you re-define the UI elements or re-size the screen.
138138

139139
Example:
140140
```
@@ -146,7 +146,7 @@ The default Screen background color is defined by the theme file (`ScreenThemeXX
146146
```
147147
screen.color = COLOR(EGA_BRIGHT_BLUE);
148148
```
149-
or by using the direct `Color` type which is different on each platform. If you are using SDL library, the Color will be an RED/GREEN/BLUE/Alpha SDL_Color struct:
149+
or by using the direct `Color` type which is different on each platform. If you are using the SDL library, the Color will be a RED/GREEN/BLUE/Alpha SDL_Color struct:
150150
```
151151
struct SDL_Color_ext {
152152
Uint8 r;
@@ -161,7 +161,7 @@ color = 0x1234;
161161
```
162162

163163
## `Screen::Elem` struct
164-
Each UI elements (buttons) on the screen represented by the `Elem` struct and it's properties can be overwritten any time and the `Screen::loop()` function will update it accordingly
164+
Each UI element (buttons) on the screen is represented by the `Elem` struct and its properties can be overwritten at any time and the `Screen::loop()` function will update it accordingly
165165
```
166166
struct Elem {
167167
uint16_t top = 0, left = 0, slider = 0, width = SCREEN_THEME_ELEM_WIDTH, height = SCREEN_THEME_ELEM_HEIGHT;
@@ -176,7 +176,7 @@ struct Elem {
176176
```
177177

178178
## `Screen::Elem::Top/Left/Width/Height/Text`
179-
The size and text of an elemenet.
179+
The size and text of an element.
180180

181181
Example:
182182
```
@@ -188,7 +188,7 @@ scr[n].text = "Touch ME!"
188188
```
189189

190190
## `Screen::touch/release/move`
191-
The event handlers that can be attached to an element.
191+
The event handlers can be attached to an element.
192192

193193
Example:
194194
```
@@ -200,7 +200,7 @@ void touch_event(int x, int y) {
200200
201201
screen[n].touch = touch_event;
202202
```
203-
Note: each event handler needs two (x/y) parameter that will be passed where the event happend.
203+
Note: each event handler needs two (x/y) parameters that will be passed where the event happened.
204204

205205
## Screen::Elem::props
206206
Elem properties, packed into a single `uint16_t` variable containing the following properties:

0 commit comments

Comments
 (0)