Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.
Mammad900 edited this page Feb 28, 2021 · 45 revisions

Features

  • Support for multi-page programs
    You can add as many as 32767 pages
  • Support for button, label, check-box, slider and radio-button
  • Ability to include another sketch in the program (experimental)
    Just paste the code of the second sketch, rename the functions and variables to avoid conflicts, and call runsketch(setup,loop)
  • Flexibility
    You can customize almost everything of the elements.
    There are a lot of optional things.
  • Automatic font size for buttons
    Font size will automatically calculated to fit into the button
  • Screen time-out
    TFT screen will turn off after inactivity to reduce power usage and avoid image persistance (optional)
  • Ease of use
    Almost every action only needs one function call, and some of them are automatically done.
    And only one configuration is needed for most of the modules (Multi-page, buttons, check-boxes, sliders, screen-timeout, screen brightness, fonts, screen-off animation, touch)

Installation

  1. Reference the library file (library.ino) in your project (e.g. #include "library.ino")
  2. Copy the contents of config.ino to your sketch (BEFORE THE #include STATEMENT)
  3. Adjust the constants specific to your project.

Reference

Main

start(): Inits the TFT screen and draws page 0
navigatePage(): Used to navigate between pages
checkPage(): Call regularly to make your application responsible to touches

Elements

Properties

addbutton(): Adds a new button
button_pressed[page][index]: Indicates whether a button is pressed

Modification

changeButtonProperty(): Modifies a button

Labels

Properties

addlabel(): Adds a new label

Modification

changeLabelXPos(): Changes the X position of a label
changeLabelYPos(): Changes the Y position of a label
changeLabelText(): Changes the text of a label
changeLabelTextColor(): Changes the color of a label
changeLabelFont(): Changes the font object used when drawing a label
changeLabelEnabled(): Disables or enables a label
changeLabelVisible(): Shows or hides a label
changeLabelTextSize(): Changes the zoom of a label (but makes it blocky, because it 'zoom's a raster font)

Check-boxes

Properties

addcheckBox(): Adds a new check-box
checkbox_checked[page][index]: Indicates whether a check-box is checked

Modification

changeCheckBoxXPos(): Moves a check-box to left or right
changeCheckBoxYPos(): Moves a check-box to up or down
changeCheckBoxText(): Changes the text shown beside the check-box
changeCheckBoxSize(): Makes a check-box bigger or smaller
changeCheckBoxCheckColor(): Changes the tick color of a check-box
changeCheckBoxTextColor(): Changes the text color of a check-box
changeCheckBoxBoxColor(): Changes the box background color of a check-box
changeCheckBoxBoxBorderColor(): Changes the box border color of a check-box
changeCheckBoxChecked(): Checks or unchecks the check-box
changeCheckBoxEnabled(): Enables or disables the check-box
changeCheckBoxVisible(): Shows or hides the check-box

Sliders

Properties

addslider(): Adds a new slider
getSliderValue(): Gets the value of a slider

Modification

These functions have their specific page as they are a lot.

Radio-buttons

addradioButton(): Adds a new radio-button
radioButton_checked[page][index]: Indicates whether a radio-button is selected

Modification

selectRadioButton(): Selects a radio button, as if it was clicked.

Other functions

changeBrightness(): Dims or brightens the screen
Centre(): Calculates the required position to center-align an object
calculateListY(): Calculates the Y position of a button in a list of buttons
inRegion(): Returns true if the given coordinate is inside a given range
Touch_getXY(): Reads touch
dim(): Dims an rgb565 color
Reset(): Software-resets the Arduino board. Has no parameters and returns nothing

Clone this wiki locally