Skip to content

Commit 68e29e3

Browse files
committed
Text section
1 parent c4209b5 commit 68e29e3

File tree

3 files changed

+97
-2
lines changed

3 files changed

+97
-2
lines changed
4.22 KB
Loading
879 Bytes
Loading

content/hardware/03.nano/boards/nano-matter/tutorials/getting-started-matter-display/getting-started-matter-display.md

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,105 @@ With the Weather Station properly commissioned, now you can deploy it on an inte
838838

839839
## Nano Matter Display Sensors and Actuators
840840

841+
In the following sections we are going to highlight some of the Nano Matter Display main features and learn how to use them.
842+
841843
### E-ink Display
842844

843-
- Text
844-
- Orientation
845+
The API basic functions to control the E-ink display are shown below.
846+
847+
- Define the screen object using the Pervasive Displays class and initialize it:
848+
849+
```arduino
850+
Screen_EPD_EXT4_Fast <screen-name>(eScreen_EPD_290_KS_0F, boardArduinoNanoMatter);
851+
852+
<screen-name>.begin();
853+
```
854+
Replace the `<screen-name>` with a custom designation of your display for further usage. For this guide we are going to use `EPD`.
855+
856+
#### Screen Orientation
857+
858+
**Orientation options:**
859+
860+
- `0`: default
861+
- `1`: right rotated
862+
- `2`: reverse default
863+
- `3`: left rotated
864+
- `6`: ORIENTATION_PORTRAIT
865+
- `7`: ORIENTATION_LANDSCAPE
866+
867+
Define the screen orientation using the following function:
868+
869+
```arduino
870+
EPD.setOrientation(7);
871+
```
872+
![Screen Orientation](assets/orientation.gif)
873+
874+
#### Text
875+
876+
To display text on the E-ink screen you need to define different screen parameters such as **font**, **orientation**, the **string** to be shown and its **color**.
877+
878+
**Fonts available:**
879+
880+
- `Font_Terminal6x8`
881+
- `Font_Terminal8x12`
882+
- `Font_Terminal12x16`
883+
- `Font_Terminal16x24`
884+
885+
Define the font using the following function:
886+
887+
```arduino
888+
EPD.selectFont(Font_Terminal8x12);
889+
```
890+
891+
**Text writing:**
892+
893+
Display text using the `gText` function, pass the coordinates and string:
894+
895+
```arduino
896+
EPD.gText(<x_coordinate>, <y_coordinate>, <string>);
897+
```
898+
899+
For example:
900+
901+
```arduino
902+
EPD.gText(0, 0, "Hello World");
903+
EPD.flush(); // update the screen to show the text on buffer
904+
```
905+
906+
**Colors:**
907+
908+
The `gText` function also admits color definition for the text and the screen background. These are the available colors for this **Monochrome** display:
909+
910+
- `myColours.black`: default
911+
- `myColours.white`: use when background color is not _white_
912+
- `myColours.gray`: simulates gray using black and white dots (not gray scale).
913+
914+
For example:
915+
916+
```arduino
917+
EPD.gText(0, 0, "Hello World", myColours.black, myColours.white);
918+
EPD.flush(); // update the screen to show the text on buffer
919+
```
920+
921+
To print inverted color text you must clear the screen in black, then show white text using the following method:
922+
923+
```arduino
924+
EPD.clear(myColours.black);
925+
EPD.gText(0, 0, "Hello World", myColours.white, myColours.black);
926+
EPD.flush(); // update the screen to show the text on buffer
927+
```
928+
929+
**Text Size:**
930+
931+
You can choose between different fonts to achieve different text size or use the `gTextLarge` to make the text shown bigger.
932+
933+
```arduino
934+
EPD.gTextLarge(0, 0, "Hello World");
935+
EPD.flush(); // update the screen to show the text on buffer
936+
```
937+
938+
![Text display](assets/text.png)
939+
845940
- Forms
846941
- Refresh
847942

0 commit comments

Comments
 (0)