TEST

Dependencies:   max32630fthr Adafruit_FeatherOLED USBDevice

Committer:
wwwarunraj
Date:
Sun Apr 19 11:19:57 2020 +0000
Revision:
4:291477e8690d
Parent:
1:f60eafbf009a
19/04

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gmehmet 1:f60eafbf009a 1 /* mbed TextDisplay Library Base Class
gmehmet 1:f60eafbf009a 2 * Copyright (c) 2007-2009 sford
gmehmet 1:f60eafbf009a 3 * Released under the MIT License: http://mbed.org/license/mit
gmehmet 1:f60eafbf009a 4 *
gmehmet 1:f60eafbf009a 5 * A common base class for Text displays
gmehmet 1:f60eafbf009a 6 * To port a new display, derive from this class and implement
gmehmet 1:f60eafbf009a 7 * the constructor (setup the display), character (put a character
gmehmet 1:f60eafbf009a 8 * at a location), rows and columns (number of rows/cols) functions.
gmehmet 1:f60eafbf009a 9 * Everything else (locate, printf, putc, cls) will come for free
gmehmet 1:f60eafbf009a 10 *
gmehmet 1:f60eafbf009a 11 * The model is the display will wrap at the right and bottom, so you can
gmehmet 1:f60eafbf009a 12 * keep writing and will always get valid characters. The location is
gmehmet 1:f60eafbf009a 13 * maintained internally to the class to make this easy
gmehmet 1:f60eafbf009a 14 */
gmehmet 1:f60eafbf009a 15
gmehmet 1:f60eafbf009a 16 #ifndef MBED_TEXTDISPLAY_H
gmehmet 1:f60eafbf009a 17 #define MBED_TEXTDISPLAY_H
gmehmet 1:f60eafbf009a 18
gmehmet 1:f60eafbf009a 19 #include "mbed.h"
gmehmet 1:f60eafbf009a 20 #include "LCDSettings.h"
gmehmet 1:f60eafbf009a 21
gmehmet 1:f60eafbf009a 22 class TextDisplay {
gmehmet 1:f60eafbf009a 23 public:
gmehmet 1:f60eafbf009a 24
gmehmet 1:f60eafbf009a 25 // functions needing implementation in derived implementation class
gmehmet 1:f60eafbf009a 26 /** Create a TextDisplay interface
gmehmet 1:f60eafbf009a 27 *
gmehmet 1:f60eafbf009a 28 * @param name The name used in the path to access the strean through the filesystem
gmehmet 1:f60eafbf009a 29 */
gmehmet 1:f60eafbf009a 30 TextDisplay(const char *name = NULL);
gmehmet 1:f60eafbf009a 31
gmehmet 1:f60eafbf009a 32 /** output a character at the given position
gmehmet 1:f60eafbf009a 33 *
gmehmet 1:f60eafbf009a 34 * @param column column where charater must be written
gmehmet 1:f60eafbf009a 35 * @param row where character must be written
gmehmet 1:f60eafbf009a 36 * @param c the character to be written to the TextDisplay
gmehmet 1:f60eafbf009a 37 */
gmehmet 1:f60eafbf009a 38 virtual void character(int column, int row, int c) = 0;
gmehmet 1:f60eafbf009a 39
gmehmet 1:f60eafbf009a 40 /** return number if rows on TextDisplay
gmehmet 1:f60eafbf009a 41 * @result number of rows
gmehmet 1:f60eafbf009a 42 */
gmehmet 1:f60eafbf009a 43 virtual int rows() = 0;
gmehmet 1:f60eafbf009a 44
gmehmet 1:f60eafbf009a 45 /** return number if columns on TextDisplay
gmehmet 1:f60eafbf009a 46 * @result number of rows
gmehmet 1:f60eafbf009a 47 */
gmehmet 1:f60eafbf009a 48 virtual int columns() = 0;
gmehmet 1:f60eafbf009a 49
gmehmet 1:f60eafbf009a 50 // Sets external font usage, eg. dispaly.set_font(Arial12x12);
gmehmet 1:f60eafbf009a 51 // This uses pixel positioning.
gmehmet 1:f60eafbf009a 52 // display.set_font(NULL); returns to internal default font.
gmehmet 1:f60eafbf009a 53 void set_font(const unsigned char * f);
gmehmet 1:f60eafbf009a 54
gmehmet 1:f60eafbf009a 55 // set position of the next character or string print.
gmehmet 1:f60eafbf009a 56 // External font, set pixel x(column),y(row) position.
gmehmet 1:f60eafbf009a 57 // internal(default) font, set character column and row position
gmehmet 1:f60eafbf009a 58 virtual void locate(int column, int row);
gmehmet 1:f60eafbf009a 59
gmehmet 1:f60eafbf009a 60 // functions that come for free, but can be overwritten
gmehmet 1:f60eafbf009a 61
gmehmet 1:f60eafbf009a 62 /** clear screen
gmehmet 1:f60eafbf009a 63 */
gmehmet 1:f60eafbf009a 64 virtual void cls();
gmehmet 1:f60eafbf009a 65 virtual void foreground(uint16_t colour);
gmehmet 1:f60eafbf009a 66 virtual void background(uint16_t colour);
gmehmet 1:f60eafbf009a 67 // putc (from Stream)
gmehmet 1:f60eafbf009a 68 // printf (from Stream)
gmehmet 1:f60eafbf009a 69 virtual void printf(const char* format, ...);
gmehmet 1:f60eafbf009a 70
gmehmet 1:f60eafbf009a 71 protected:
gmehmet 1:f60eafbf009a 72
gmehmet 1:f60eafbf009a 73 virtual int _putc(int value);
gmehmet 1:f60eafbf009a 74 virtual int _getc();
gmehmet 1:f60eafbf009a 75
gmehmet 1:f60eafbf009a 76 // external font functions
gmehmet 1:f60eafbf009a 77 const unsigned char* font;
gmehmet 1:f60eafbf009a 78 int externalfont;
gmehmet 1:f60eafbf009a 79
gmehmet 1:f60eafbf009a 80 // character location
gmehmet 1:f60eafbf009a 81 uint16_t _column;
gmehmet 1:f60eafbf009a 82 uint16_t _row;
gmehmet 1:f60eafbf009a 83 unsigned int char_x;
gmehmet 1:f60eafbf009a 84 unsigned int char_y;
gmehmet 1:f60eafbf009a 85
gmehmet 1:f60eafbf009a 86 // colours
gmehmet 1:f60eafbf009a 87 uint16_t _foreground;
gmehmet 1:f60eafbf009a 88 uint16_t _background;
gmehmet 1:f60eafbf009a 89 char *_path;
gmehmet 1:f60eafbf009a 90 };
gmehmet 1:f60eafbf009a 91
gmehmet 1:f60eafbf009a 92 #endif