Erik van de Coevering / UC1701

Dependents:   Opensmart_LCD_UC1701

Committer:
Anaesthetix
Date:
Sun Dec 18 21:12:40 2016 +0000
Revision:
1:f396898c2963
Parent:
0:a8cfaf48d064
Child:
2:d9e9d326c4bb
Added header

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anaesthetix 0:a8cfaf48d064 1 /**
Anaesthetix 0:a8cfaf48d064 2 * This is a simple library for UC1701 controlled graphic LCD's.
Anaesthetix 0:a8cfaf48d064 3 * Written for a cheap OPEN-SMART 1.8" 128x64 display
Anaesthetix 0:a8cfaf48d064 4 * See http://www.dx.com/p/open-smart-1-8-128-64-lcd-display-breakout-module-w-blue-backlit-444694
Anaesthetix 1:f396898c2963 5 *
Anaesthetix 0:a8cfaf48d064 6 * Written by: Erik van de Coevering
Anaesthetix 0:a8cfaf48d064 7 * With special thanks to Tim Barr from whom I've reused some code
Anaesthetix 0:a8cfaf48d064 8 * Use this code in whatever way you like, as long as it stays free of charge!
Anaesthetix 0:a8cfaf48d064 9 */
Anaesthetix 0:a8cfaf48d064 10
Anaesthetix 0:a8cfaf48d064 11 #ifndef UC1701_H
Anaesthetix 0:a8cfaf48d064 12 #define UC1701_H
Anaesthetix 0:a8cfaf48d064 13
Anaesthetix 0:a8cfaf48d064 14 #include "mbed.h"
Anaesthetix 0:a8cfaf48d064 15 #include "font_4x5.h"
Anaesthetix 0:a8cfaf48d064 16 #include "font_5x8.h"
Anaesthetix 0:a8cfaf48d064 17 #include "font_6x6.h"
Anaesthetix 0:a8cfaf48d064 18 #include "font_6x8.h"
Anaesthetix 0:a8cfaf48d064 19 #include "font_7x7.h"
Anaesthetix 0:a8cfaf48d064 20 #include "font_8x8.h"
Anaesthetix 0:a8cfaf48d064 21 #include "font_8x8_1.h"
Anaesthetix 0:a8cfaf48d064 22 #include "test_15x16.h"
Anaesthetix 0:a8cfaf48d064 23 #include "bold_font.h"
Anaesthetix 0:a8cfaf48d064 24 #include "font2d_hunter.h"
Anaesthetix 0:a8cfaf48d064 25 #include "font2d_formplex12.h"
Anaesthetix 0:a8cfaf48d064 26 #include "biohazard.h"
Anaesthetix 0:a8cfaf48d064 27 #include "highvoltage.h"
Anaesthetix 0:a8cfaf48d064 28 #include "einstein.h"
Anaesthetix 0:a8cfaf48d064 29 #include "test.h"
Anaesthetix 0:a8cfaf48d064 30 #include "copter.h"
Anaesthetix 0:a8cfaf48d064 31
Anaesthetix 0:a8cfaf48d064 32 #define LCDWIDTH 128
Anaesthetix 0:a8cfaf48d064 33 #define LCDHEIGHT 64
Anaesthetix 0:a8cfaf48d064 34 #define LCDPAGES 8
Anaesthetix 0:a8cfaf48d064 35
Anaesthetix 0:a8cfaf48d064 36 class UC1701
Anaesthetix 0:a8cfaf48d064 37 {
Anaesthetix 0:a8cfaf48d064 38 public:
Anaesthetix 0:a8cfaf48d064 39
Anaesthetix 0:a8cfaf48d064 40 // Constructor
Anaesthetix 0:a8cfaf48d064 41 UC1701(SPI &spi, DigitalOut &lcd_cs, DigitalOut &cd);
Anaesthetix 0:a8cfaf48d064 42
Anaesthetix 0:a8cfaf48d064 43 // Initialize LCD
Anaesthetix 0:a8cfaf48d064 44 void init(void);
Anaesthetix 0:a8cfaf48d064 45
Anaesthetix 0:a8cfaf48d064 46 // Place cursor at position
Anaesthetix 0:a8cfaf48d064 47 void setCursor(char column, char line);
Anaesthetix 0:a8cfaf48d064 48
Anaesthetix 0:a8cfaf48d064 49 // Clear screen
Anaesthetix 0:a8cfaf48d064 50 void clear(void);
Anaesthetix 0:a8cfaf48d064 51
Anaesthetix 0:a8cfaf48d064 52 // Fill screen by writing each pixel -> used for optimizing. Use command 0xA5
Anaesthetix 0:a8cfaf48d064 53 void fill(void);
Anaesthetix 0:a8cfaf48d064 54
Anaesthetix 0:a8cfaf48d064 55 // Write text to LCD where font format is a 2-dimensional array (only 96x8, 8x8 pixel fonts supported)
Anaesthetix 0:a8cfaf48d064 56 void writeText2d(char column, char page, const char font_address[96][8], const char *text, int size);
Anaesthetix 0:a8cfaf48d064 57
Anaesthetix 0:a8cfaf48d064 58 // Write text to LCD where font format is a 1-dimensional array
Anaesthetix 0:a8cfaf48d064 59 void writeText(char column, char page, const char *font_address, const char *str, const uint8_t size);
Anaesthetix 0:a8cfaf48d064 60
Anaesthetix 0:a8cfaf48d064 61 // Draw a 128x64 pixel bitmap
Anaesthetix 0:a8cfaf48d064 62 void drawBitmap(const char *data);
Anaesthetix 0:a8cfaf48d064 63
Anaesthetix 0:a8cfaf48d064 64 private:
Anaesthetix 0:a8cfaf48d064 65
Anaesthetix 0:a8cfaf48d064 66 SPI *_lcd;
Anaesthetix 0:a8cfaf48d064 67 DigitalOut *_lcd_cs;
Anaesthetix 0:a8cfaf48d064 68 DigitalOut *_lcd_cd;
Anaesthetix 0:a8cfaf48d064 69 uint8_t _lcdbuffer[LCDWIDTH*LCDPAGES];
Anaesthetix 0:a8cfaf48d064 70
Anaesthetix 0:a8cfaf48d064 71 };
Anaesthetix 0:a8cfaf48d064 72
Anaesthetix 0:a8cfaf48d064 73 #endif