Software to control a 128x64 graphic LCD with KS0107B and KS0108B controller. Slight modification to Anders Hörnfeldts Code which increases framerate by up to 300%.

Committer:
hapoo
Date:
Sat Dec 25 10:14:10 2010 +0000
Revision:
0:0cc7719c6d87

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hapoo 0:0cc7719c6d87 1 #ifndef DISPLAY_H
hapoo 0:0cc7719c6d87 2 #define DISPLAY_H
hapoo 0:0cc7719c6d87 3
hapoo 0:0cc7719c6d87 4 #define RS_f = 1
hapoo 0:0cc7719c6d87 5 #define RW_f = 2
hapoo 0:0cc7719c6d87 6 #define CS1_f = 4
hapoo 0:0cc7719c6d87 7 #define CS2_f = 8
hapoo 0:0cc7719c6d87 8
hapoo 0:0cc7719c6d87 9 #include "mbed.h"
hapoo 0:0cc7719c6d87 10 #include "font.h"
hapoo 0:0cc7719c6d87 11
hapoo 0:0cc7719c6d87 12 class Display {
hapoo 0:0cc7719c6d87 13 public:
hapoo 0:0cc7719c6d87 14 // Constructor:
hapoo 0:0cc7719c6d87 15 Display (PinName _RS, PinName _RW, PinName _E, PinName _CS1, PinName _CS2, PinName DB0, PinName DB1, PinName DB2, PinName DB3, PinName DB4, PinName DB5, PinName DB6, PinName DB7);
hapoo 0:0cc7719c6d87 16 // Send write command to Display
hapoo 0:0cc7719c6d87 17 // Page 0-7, y 0-127
hapoo 0:0cc7719c6d87 18 void write (int page, int y, unsigned int data);
hapoo 0:0cc7719c6d87 19 //
hapoo 0:0cc7719c6d87 20 void SetAddress(int);
hapoo 0:0cc7719c6d87 21 int SendCommand(unsigned int, int);
hapoo 0:0cc7719c6d87 22 // Row 0-7, col 0-122
hapoo 0:0cc7719c6d87 23 void writec(int row, int Y, int c);
hapoo 0:0cc7719c6d87 24
hapoo 0:0cc7719c6d87 25 private:
hapoo 0:0cc7719c6d87 26 int prevPage;
hapoo 0:0cc7719c6d87 27 int prevY;
hapoo 0:0cc7719c6d87 28 BusInOut DB;
hapoo 0:0cc7719c6d87 29 DigitalOut RS;
hapoo 0:0cc7719c6d87 30 DigitalOut RW;
hapoo 0:0cc7719c6d87 31 DigitalOut E;
hapoo 0:0cc7719c6d87 32 DigitalOut CS1;
hapoo 0:0cc7719c6d87 33 DigitalOut CS2;
hapoo 0:0cc7719c6d87 34 int CurCol;
hapoo 0:0cc7719c6d87 35 };
hapoo 0:0cc7719c6d87 36
hapoo 0:0cc7719c6d87 37 class DisplayTTY : public Stream {
hapoo 0:0cc7719c6d87 38 public:
hapoo 0:0cc7719c6d87 39 DisplayTTY (Display *d, int _row, int _startY, int _numOfChars=10, int _numOfRows=1, int _charOffset=6, int _flags=0);
hapoo 0:0cc7719c6d87 40 void cls();
hapoo 0:0cc7719c6d87 41 protected:
hapoo 0:0cc7719c6d87 42 virtual int _putc (int c);
hapoo 0:0cc7719c6d87 43 virtual int _getc();
hapoo 0:0cc7719c6d87 44 virtual void newline();
hapoo 0:0cc7719c6d87 45 Display *kalle;
hapoo 0:0cc7719c6d87 46 int row;
hapoo 0:0cc7719c6d87 47 int startY;
hapoo 0:0cc7719c6d87 48 int numOfChars;
hapoo 0:0cc7719c6d87 49 int numOfRows;
hapoo 0:0cc7719c6d87 50 int charOffset;
hapoo 0:0cc7719c6d87 51 int flags;
hapoo 0:0cc7719c6d87 52 int CursPosY;
hapoo 0:0cc7719c6d87 53 int CursPosW;
hapoo 0:0cc7719c6d87 54 };
hapoo 0:0cc7719c6d87 55
hapoo 0:0cc7719c6d87 56 #endif