Simple library for UC1701 based GLCD's
Dependents: Opensmart_LCD_UC1701
With lots of fonts! Will include more in the future. A couple bitmaps have also been added.
UC1701.h
- Committer:
- Anaesthetix
- Date:
- 2016-12-18
- Revision:
- 2:d9e9d326c4bb
- Parent:
- 1:f396898c2963
- Child:
- 3:baaa16e24adc
File content as of revision 2:d9e9d326c4bb:
/** * This is a simple library for UC1701 controlled graphic LCD's. * Written for a cheap OPEN-SMART 1.8" 128x64 display * See http://www.dx.com/p/open-smart-1-8-128-64-lcd-display-breakout-module-w-blue-backlit-444694 * * Written by: Erik van de Coevering * With special thanks to Tim Barr from whom I've reused some code * Use this code in whatever way you like, as long as it stays free of charge! */ #ifndef UC1701_H #define UC1701_H #include "mbed.h" #include "font_4x5.h" #include "font_5x8.h" #include "font_6x6.h" #include "font_6x8.h" #include "font_7x7.h" #include "font_8x8.h" #include "font_8x8_1.h" #include "bold_font.h" #include "font2d_hunter.h" #include "font2d_formplex12.h" #include "biohazard.h" #include "highvoltage.h" #include "einstein.h" #include "test.h" #include "copter.h" #define LCDWIDTH 128 #define LCDHEIGHT 64 #define LCDPAGES 8 class UC1701 { public: // Constructor UC1701(SPI &spi, DigitalOut &lcd_cs, DigitalOut &cd); // Initialize LCD void init(void); // Place cursor at position void setCursor(char column, char line); // Clear screen void clear(void); // Fill screen by writing each pixel -> used for optimizing. Use command 0xA5 void fill(void); // Write text to LCD where font format is a 2-dimensional array (only 96x8, 8x8 pixel fonts supported) void writeText2d(char column, char page, const char font_address[96][8], const char *text, int size); // Write text to LCD where font format is a 1-dimensional array void writeText(char column, char page, const char *font_address, const char *str, const uint8_t size); // Draw a 128x64 pixel bitmap void drawBitmap(const char *data); private: SPI *_lcd; DigitalOut *_lcd_cs; DigitalOut *_lcd_cd; uint8_t _lcdbuffer[LCDWIDTH*LCDPAGES]; }; #endif