Skip to content

Display

Jaroslav Páral edited this page Jun 6, 2017 · 5 revisions

Display library is mostly ported from official Pololu 3pi library.

Usage:

display.function();

eg.

display.print("Hello");

will print "Hello" to display.

Functions you are interested in:

inline void print(const char *str);

Prints str to current cursor position.

template <typename T>
void printNumber(T n, uint8_t width = 0);

Prints number to current cursor position. If you specify width, final string will be at least this chars wide, no matter the lenght of number itself - free positions will be filled with spaces (" ").

inline void send_data(uint8_t data);

Prints one ASCII char to current position.

inline void clear();

Clears display's content.

void showCursor(uint8_t cursorType);

Shows cursor. cursorType must be either LCD_SHOW_BLINK or LCD_SHOW_SOLID.

inline void hideCursor();

Hides the cursor, obviously.

void moveCursor(uint8_t direction, uint8_t num);

Moves the cursor in given direction (LCD_LEFT or LCD_RIGHT) by num positions.

void scroll(uint8_t direction, uint8_t num, uint16_t delay_time);

Scrolls displays content in direction (LCD_LEFT or LCD_RIGHT) by num positions. After each position shift, there will be delay of delay_time ms. This should be used to text scrolling. WARNING: this is blocking call.

void gotoXY(uint8_t x, uint8_t y)

Moves cursor to x y position. X must be in range from 0 to 7, Y in range from 0 to 1.

inline void printToXY(const char *str, uint8_t x, uint8_t y);

template <typename T>
inline void printNumToXY(T num, uint8_t x, uint8_t y);

Helpers. Prints str/num to x and y position. Shifts the cursor.

Command functions:

inline void send_cmd(uint8_t cmd);
inline void send_4bit_cmd(uint8_t cmd);

Clone this wiki locally