ti/screen.h

#include <ti/screen.h>

Programs that don’t need fancy graphics can use TI’s screen routines instead of <graphx.h>.

If you want to print text to the homescreen and have it support automatic scrolling, then cursor locations are based on a character grid. Most of the text routines work this way. In particular, os_GetStringInput and os_PutStr* work this way.

However, you can also draw text to arbitrary pixel locations using either the large or small font. Those routines have Font in their name and also let you use color.

API Documentation

TI CE OS screen functions. If you want to print to the screen without using GraphX, this is the file.

Authors

Matt “MateoConLechuga” Waltz

Jacob “jacobly” Young

Defines

os_ClrHome()

Resets the OS homescreen; accounts for split screen.

os_ClrHomeFull()

Resets the OS homescreen fully; ignores split screen mode.

os_SmallFont

TIOS small font.

See also

os_FontSelect

os_LargeFont

TIOS large font.

See also

os_FontSelect

os_CurRow

uint8_t: Font row position

os_CurCol

uint8_t: Font column position

os_TextFGColor

uint16_t: Large font foreground 565 BGR color

os_TextBGColor

uint16_t: Large font background 565 BGR color

os_PenCol

uint24_t: Small font column position

os_PenRow

uint8_t: Small font row position

os_DrawBGColor

uint16_t: Small font background 565 BGR color

os_DrawFGColor

uint16_t: Small font foreground 565 BGR color

os_DrawColorCode

uint8_t: Small OS font color code

os_GraphBGColor

uint16_t: Graph background 565 BGR color

os_FillRectColor

uint16_t: OS Rect draw 565 BGR color

Typedefs

typedef struct font font_t

Structure of font description.

See also

os_FontSelect

Functions

void boot_NewLine(void)

Inserts a new line at the current cursor posistion on the homescreen Does not scroll.

void os_NewLine(void)

Inserts a new line at the current cursor posistion on the homescreen.

Does scroll.

void os_DisableCursor(void)

Disables the OS cursor.

void os_EnableCursor(void)

Enables the OS cursor.

void os_SetCursorPos(uint8_t curRow, uint8_t curCol)

Set the cursor posistion used on the homescreen.

Parameters
  • curRow[in] The row aligned offset

  • curCol[in] The column aligned offset

void os_GetCursorPos(unsigned int *curRow, unsigned int *curCol)

Gets the cursor posistion used on the homescreen.

Parameters
  • curRow[in] Pointer to store the row aligned offset

  • curCol[in] Pointer to store the column aligned offset

uint24_t os_PutStrFull(const char *string)

Puts some text at the current homescreen cursor location.

Parameters

string[in] Text to put on homescreen

Returns

1 if string fits on screen, 0 otherwise

uint24_t os_PutStrLine(const char *string)

Puts some text at the current homescreen cursor location.

Parameters

string[in] Text to put on homescreen

Returns

1 if string fits on line, 0 otherwise

void os_MoveUp(void)

Routine to scroll homescreen up.

void os_MoveDown(void)

Routine to scroll homescreen down.

void os_HomeUp(void)

Routine to move row and column posistion to (0,0)

void os_ClrLCDFull(void)

Routine to clear the homescreen lcd.

void os_ClrLCD(void)

Routine to clear the homescreen lcd.

Accounts for split screen

void os_ClrTxtShd(void)

Invalidate and clear text shadow area.

void os_DisableHomeTextBuffer(void)

Disable text buffering on the homescreen.

C programs use this area by default for the BSS / Heap.

void os_EnableHomeTextBuffer(void)

Enables text buffering on the homescreen.

C programs use this area by default for the BSS / Heap.

void os_GetStringInput(char *string, char *buf, size_t bufsize)

Custom implementation input routine for use in conjunction with the TIOS.

It is HIGHLY recommended you implement your own routine, this routine has some quirks. It is good enough for getting basic input however.

Parameters
  • string[in] Input prompt string to be displayed to the user

  • buf[in] Storage location to store input string

  • bufsize[in] Available storage size for input string. -1 for null termination.

Returns

None

void os_FontSelect(font_t *font)

Selects the (monospace) font to use when drawing text.

Parameters

font[in]

font id/pointer to use os_SmallFont

os_LargeFont

font_t *os_FontGetID(void)

Gets the font to use when drawing text.

Returns

0: small font

1: large monospace font

uint24_t os_FontGetWidth(const char *string)
Parameters

string[in] String to get pixel width of

Returns

The width of a string in the variable-width format

uint24_t os_FontGetHeight(void)
Returns

[in] The height of the font characters

uint24_t os_FontDrawText(const char *string, uint16_t col, uint8_t row)

Draws text using the small font to the screen.

Parameters
  • string[in] String to draw

  • col[in] Column to start drawing at

  • row[in] Row to start drawing at

Returns

The end column

uint24_t os_FontDrawTransText(const char *string, uint16_t col, uint8_t row)

Draws transparent text using the small font to the screen.

Parameters
  • string[in] String to draw

  • col[in] Column to start drawing at

  • row[in] Row to start drawing at

Returns

The end column

void os_SetDrawFGColor(uint24_t color)

Sets the foreground color used to draw text.

Parameters

color[in] 565 BGR color to set text foreground to

uint24_t os_GetDrawFGColor(void)

Gets the foreground color used to draw text.

Returns

565 BGR color of text foreground

void os_SetDrawBGColor(uint24_t color)

Sets the background color used to draw text.

Parameters

color[in] 565 BGR color to set text background to

uint24_t os_GetDrawBGColor(void)

Gets the background color used to draw text.

Warning

Only useable in OS 5.2 and above; use at your own risk

Returns

565 BGR color of text nackground

struct font
#include <screen.h>

Structure of font description.

See also

os_FontSelect

Public Members

struct font *font

Points to this font itself, yuck!

void (*drawChar)(char c)

Draws a character using this font.

Param c

The character

uint24_t (*getWidth)(char c)

Gets the width of a character in this font.

Param c

The character

uint24_t (*getHeight)(void)

Gets the height of this font.