Display text on LCD displays (even on multiple ones). Allow to create windows (frames) on display, and to combine them (split, add, duplicate, scroll). See http://mbed.org/users/hlipka/notebook/lcdwindow/ for more information.

Dependents:   Mbell

Committer:
hlipka
Date:
Tue Feb 22 22:57:44 2011 +0000
Revision:
9:2fe93daa2106
Parent:
2:5ac5bab7daaf
fixed semaphore handling - should now be really thread safe (can be called from interrupts)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hlipka 2:5ac5bab7daaf 1 /*
hlipka 2:5ac5bab7daaf 2 * mbed LCDWindow library
hlipka 2:5ac5bab7daaf 3 * Copyright (c) 2010 Hendrik Lipka
hlipka 2:5ac5bab7daaf 4 *
hlipka 2:5ac5bab7daaf 5 * Permission is hereby granted, free of charge, to any person obtaining a copy
hlipka 2:5ac5bab7daaf 6 * of this software and associated documentation files (the "Software"), to deal
hlipka 2:5ac5bab7daaf 7 * in the Software without restriction, including without limitation the rights
hlipka 2:5ac5bab7daaf 8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
hlipka 2:5ac5bab7daaf 9 * copies of the Software, and to permit persons to whom the Software is
hlipka 2:5ac5bab7daaf 10 * furnished to do so, subject to the following conditions:
hlipka 2:5ac5bab7daaf 11 *
hlipka 2:5ac5bab7daaf 12 * The above copyright notice and this permission notice shall be included in
hlipka 2:5ac5bab7daaf 13 * all copies or substantial portions of the Software.
hlipka 2:5ac5bab7daaf 14 *
hlipka 2:5ac5bab7daaf 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
hlipka 2:5ac5bab7daaf 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
hlipka 2:5ac5bab7daaf 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
hlipka 2:5ac5bab7daaf 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
hlipka 2:5ac5bab7daaf 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
hlipka 2:5ac5bab7daaf 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
hlipka 2:5ac5bab7daaf 21 * THE SOFTWARE.
hlipka 2:5ac5bab7daaf 22 */
hlipka 2:5ac5bab7daaf 23
hlipka 2:5ac5bab7daaf 24 #ifndef KS0108_8BIT_H_
hlipka 2:5ac5bab7daaf 25 #define KS0108_8BIT_H_
hlipka 2:5ac5bab7daaf 26
hlipka 2:5ac5bab7daaf 27 #include "lcd.h"
hlipka 2:5ac5bab7daaf 28
hlipka 2:5ac5bab7daaf 29 #include "BusOut.h"
hlipka 2:5ac5bab7daaf 30 #include "DigitalOut.h"
hlipka 2:5ac5bab7daaf 31
hlipka 2:5ac5bab7daaf 32 using namespace mbed;
hlipka 2:5ac5bab7daaf 33
hlipka 2:5ac5bab7daaf 34 /**
hlipka 2:5ac5bab7daaf 35 * class for connecting graphical KS0108-based LCD-Display (or using similiar controllers)
hlipka 2:5ac5bab7daaf 36 * displays are connected in 8bit-mode
hlipka 2:5ac5bab7daaf 37 * for displaying ASCII, the vincent font from http://forum.osdev.org/viewtopic.php?f=2&t=22033 is used (courtesy to Quinn Evans)
hlipka 2:5ac5bab7daaf 38 */
hlipka 2:5ac5bab7daaf 39 class KS0108LCD8bit: public TextLCDBase
hlipka 2:5ac5bab7daaf 40 {
hlipka 2:5ac5bab7daaf 41 public:
hlipka 2:5ac5bab7daaf 42 /**
hlipka 2:5ac5bab7daaf 43 * @param columns number of chars per line (using an 8x8 font)
hlipka 2:5ac5bab7daaf 44 * @param rows number of lines (using an 8x8 font)
hlipka 2:5ac5bab7daaf 45 * @param data the bus object used for sending data (must be 8bit)
hlipka 2:5ac5bab7daaf 46 * @param enable the pin name for the enable line (1=active)
hlipka 2:5ac5bab7daaf 47 * @param rs the pin name for the register select line (0=cmd, 1=data)
hlipka 2:5ac5bab7daaf 48 * @param leftCS the pin name for the left display half (1=active)
hlipka 2:5ac5bab7daaf 49 * @param rightCS the pin name for the right display half (1=active, use NC for smaller displays)
hlipka 2:5ac5bab7daaf 50 */
hlipka 2:5ac5bab7daaf 51 KS0108LCD8bit(const unsigned int columns, const unsigned int rows, BusOut *data, const PinName enable, const PinName rs, const PinName leftCS, const PinName rightCS);
hlipka 2:5ac5bab7daaf 52 virtual void init();
hlipka 2:5ac5bab7daaf 53 virtual void writeText(const unsigned int column, const unsigned int row, const char text[]);
hlipka 2:5ac5bab7daaf 54 virtual void clear();
hlipka 2:5ac5bab7daaf 55 virtual void character(int column, int row, int c);
hlipka 2:5ac5bab7daaf 56
hlipka 2:5ac5bab7daaf 57 protected:
hlipka 2:5ac5bab7daaf 58 void clearHalf(DigitalOut *cs);
hlipka 2:5ac5bab7daaf 59
hlipka 2:5ac5bab7daaf 60 void sendCmd(const unsigned char byte, DigitalOut *cs);
hlipka 2:5ac5bab7daaf 61 void sendData(const unsigned char byte, DigitalOut *cs);
hlipka 2:5ac5bab7daaf 62
hlipka 2:5ac5bab7daaf 63 void sendByte(const unsigned char byte, DigitalOut *cs);
hlipka 2:5ac5bab7daaf 64
hlipka 2:5ac5bab7daaf 65 BusOut* _data;
hlipka 2:5ac5bab7daaf 66 DigitalOut *_enable, *_rs, *_left, *_right;
hlipka 2:5ac5bab7daaf 67 };
hlipka 0:ae5037e3d6e0 68 #endif