TinyScreen Library Functions

Following is the list of all the functions available via the TinyScreen library. The library is often updated to include new functions or changes and we will try to update this page as possible. The latest version of the TinyScreen library is available here.

When you use these function in your program, you need to prefix them with ‘display.’ as in the examples shown before.

TinyScreen Initialization Functions

  • TinyScreen(TinyScreenPlus) – This is a TinyScreen constructor to specify the TinyScreen board being used. For O Watch you need to set board type as TinyScreenPlus
  • begin() – Initializes the TinyScreen. This is required at the start of each program. Usually called first in the setup.
  • on() – Turns display on
  • off() – Turns display off
  • setFlip(value) – Flips the display vertically. Value’false’ is default. ‘true’ is flipped. Use ‘true’ in O Watch.
  • setMirror(value) – Flips the display horizontally creating a mirror image. default ‘false’ is normal, ‘true’ is flipped.
  • setBitDepth(value) – Sets bit depth. default 0 is 8 bit and 1 is 16 bit. Usually used for games and high color graphics.
  • setBrightness(value) – sets the screen brightness (current level), valid levels(values) that can be passed are 0-15. Set to a 10 or lower to use less battery

Drawing Commands

  • drawPixel(x, y, color) – Set the color of a pixel at x, y with a specified color. Refer to predefined color values below.
  • drawLine(x1, y1, x2, y2, color) – Draws a line from x1, y1 to x2, y2 with a specific color.
  • drawRect(x start, y start, width, height, fill, color) – Draws a rectangle from x,y with specified width, height and color. Specify whether the rectangle is to be filled(1) or not(0).
  • clearWindow(x start, y start, width, height) – Clears the screen within a specific rectangular area starting at x,y with specified width and height.
  • clearScreen() – Clears entire display- the same as clearWindow(0,0,96,64)


  • getButtons(button-name) – Returns a boolean 1 if the named button is pressed, 0 if not. Button-names are TSButtonUpperLeft, TSButtonUpperRight, TSButtonLowerLeft,TSButtonLowerRight.
  • getButtons() – Returns pressed button values as 1 (TSButtonLowerLeft), 2 (TSButtonUpperLeft), 4 (TSButtonUpperRight) or 8 (TSButtonLowerRight).

Font Settings

  • setFont(FontName) – Sets the font to an available font type. See default fonts available with TinyScreen below
  • getFontHeight(FontName) – Returns the height of a specified font.
  • getFontHeight() – Returns the height in pixels of the current font
  • getPrintWidth(char *) – Returns the width in pixels of a given character string
  • setCursor(x, y) – Sets the cursor to a specific x,y position on screen. The next print command will print from this position.
  • fontColor(fontcolor, bgcolor) – Sets the font color and the background for text.

Advanced graphics commands

  • writePixel(color) – Write the current pixel to specified color. Faster than drawPixel
  • writeBuffer(buffer,count) – Optimized write of a large buffer of 8 bit data. Must be wrapped with startData() and endTransfer(), but there can be any amount of calls to writeBuffer between.
  • goTo(x,y) – Set screen memory to pixel address (x,y) with wrap around at x and y max
  • setX(x start, x end) – Set screen memory to pixel x start, wrap around at x end
  • setY(y start, y end) – Set screen memort to pixel y start, wrap around at y end

Advanced OLED Screen Driver Commands

  • writeGPIO(address, data) – Write to SX1505 GPIO chip
  • startCommand() – Write SSD1331(OLED screen driver chip) select active with data/command signalling a command
  • startData() – Write SSD1331 chip select active with data/command signalling data
  • endTransfer() – Write SSD1331 chip select inactive

Pre-Defined Colors

(Name and Value)

    8 bit colors. BBBG GGRR

  • TS_8b_Black = 0x00;
  • TS_8b_Gray = 0x6D;
  • TS_8b_White = 0xFF;
  • TS_8b_Blue = 0xE0;
  • TS_8b_DarkBlue = 0x60;
  • TS_8b_Red = 0x03;
  • TS_8b_DarkRed = 0x01;
  • TS_8b_Green = 0x1C;
  • TS_8b_DarkGreen = 0x0C;
  • TS_8b_Brown = 0x32;
  • TS_8b_DarkBrown = 0x22;
  • TS_8b_Yellow = 0x1F;
    16 bit colors: BBBB BGGG GGGR RRRR

  • TS_16b_Black = 0x0000;
  • TS_16b_Gray = 0x7BEF;
  • TS_16b_DarkGray = 0x39E7;
  • TS_16b_White = 0xFFFF;
  • TS_16b_Blue = 0xF800;
  • TS_16b_DarkBlue = 0x7800;
  • TS_16b_Red = 0x001F;
  • TS_16b_DarkRed = 0x000F;
  • TS_16b_Green = 0x07E0;
  • TS_16b_DarkGreen = 0x03E0;
  • TS_16b_Brown = 0x0C10;
  • TS_16b_DarkBrown = 0x0810;
  • TS_16b_Yellow = 0x07FF;

Included Fonts

  • liberationSans_8ptFontInfo
  • liberationSans_10ptFontInfo
  • liberationSans_12ptFontInfo
  • liberationSans_14ptFontInfo
  • liberationSans_16ptFontInfo
  • liberationSans_22ptFontInfo
  • liberationSansNarrow_8ptFontInfo
  • liberationSansNarrow_10ptFontInfo
  • liberationSansNarrow_12ptFontInfo
  • liberationSansNarrow_14ptFontInfo
  • liberationSansNarrow_16ptFontInfo
  • liberationSansNarrow_22ptFontInfo
  • thinPixel7_10ptFontInfo

<< Back: TinyScreen Demo Program | Next: O Watch Programming >>