Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi size #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ Any orientation of the M5StickC can be used!

## How it works:

A text buffer is used to store the text which is to be displayed. Depending on whether the display is used in portrait or landscape orientation, the text buffer has 5 lines or 10 lines.
A text buffer is used to store the text which is to be displayed. With text size 2 (the default), depending on whether the display is used in portrait or landscape orientation, the text buffer has 5 lines or 10 lines.
New characters are always written in the last line of the buffer, so that the text scrolls up like a classic terminal.
The number of possible characters per line varies between characters. In the portrait orientation, between 8 and 23 characters fit in one line. A typical text needs 9 to 11 characters. In the landscape orientation between 19 and 50 characters fit in one line. A typical text requires between 21 and 24 characters.
When a new character is to be displayed, it draws the function on the display and checks if the position behind the character is outside the display. If so, the line is automatically wrapped and the character is displayed as the first character in the new line.

With larger text sizes, fewer characters will fit per line, and fewer lines will fit on the screen.

An example can be viewed here:
[Example Video](https://youtu.be/PCo_sT5_lpc)

Expand All @@ -26,6 +28,11 @@ The initialization is very simple. You only need to call the init function with
```c++
void tb_display_init(int ScreenRotation);
```
Or, to specify an alternative text size:
```c++
void tb_display_init(int ScreenRotation, int TextSize)
```

Either single characters can be written into the buffer, or a whole string. The following functions are available:
```c++
void tb_display_print_char(byte data);
Expand All @@ -37,8 +44,7 @@ With the global variable tb_display_word_wrap the word-wrapping function can be

## Environment:

The files work fine with PlatformIO. For use with the Arduino IDE only really minor changes are required:
Change main.cpp to tb_display.ino and place the .cpp .h and .ino into a directory.
The files work fine with PlatformIO. For use with the Arduino IDE, point your IDE to the tb_display dir in lib

## Changelog

Expand All @@ -52,3 +58,6 @@ Change main.cpp to tb_display.ino and place the .cpp .h and .ino into a director
* Add a word wrapping fuction inside the print_char function
* v1.3
* Bugfix if the character that causes a word wrap is a space character
* v1.4
* Support arbitrary text size.
* Code restructuring for platformio conventions and Arduino compatibility.
Loading