light text library for 5110 nokia lcd * easy to modify * proportional font, bold / inverse modes * easy to add / change fonts * fixed rows for fast update
Library finished! :-) If you use 5110 and need fast menus - try this library. No overhead - small and robust, optimized for this display type only, fast update. Nice looking font. Power management. Displays from 5110 and 3110 are cheap as dirt :-)
medvdv5110.h
- Committer:
- medvdv
- Date:
- 2012-07-14
- Revision:
- 0:0a6619901f2e
- Child:
- 2:65df20ffef51
File content as of revision 0:0a6619901f2e:
// // 5110 LCD Driver // (c) 2012 medvdv.com // Alexander Medvedev // #define DEFAULT_CONTRAST 60 typedef struct { char first_code; char glyphs_total; const char* widths; const char** glyphs; } lcd5110font; class lcd5110 { SPI* spi; DigitalOut* rst; DigitalOut* sce; DigitalOut* dc; lcd5110font font; char contrast; bool invert; bool bold; int X, Y; void write(char byte, bool cmd = false); public: lcd5110(PinName mosi= p11, PinName sclk = p13, PinName dc = p10, PinName sce = p8, PinName rst = p9); void Init(); void Reset(); void Clear(char pattern = 0); void Contrast(char contrast = DEFAULT_CONTRAST ); void PowerOff(); void Invert(bool invert = true); void Bold(bool bold = true); void XY(int x = 0, int y = 0); void Write(char byte); void Write(char byte, int count); void Write(char* data, int size); void Write2(char* data, int size); void Character(char chr); int CharacterWidth(char chr); void String(char* str); int StringWidth(char* str); void Row(int Y, char* str = ""); ~lcd5110(); };