Exploring BeagleBone  V1.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LCDCharacterDisplay.h
Go to the documentation of this file.
1 /*
2  * LCDCharacterDisplay.h Created on: 24 May 2014
3  * Copyright (c) 2014 Derek Molloy (www.derekmolloy.ie)
4  * Made available for the book "Exploring BeagleBone"
5  * See: www.exploringbeaglebone.com
6  * Licensed under the EUPL V.1.1
7  *
8  * This Software is provided to You under the terms of the European
9  * Union Public License (the "EUPL") version 1.1 as published by the
10  * European Union. Any use of this Software, other than as authorized
11  * under this License is strictly prohibited (to the extent such use
12  * is covered by a right of the copyright holder of this Software).
13  *
14  * This Software is provided under the License on an "AS IS" basis and
15  * without warranties of any kind concerning the Software, including
16  * without limitation merchantability, fitness for a particular purpose,
17  * absence of defects or errors, accuracy, and non-infringement of
18  * intellectual property rights other than copyright. This disclaimer
19  * of warranty is an essential part of the License and a condition for
20  * the grant of any rights to this Software.
21  *
22  * For more details, see http://www.derekmolloy.ie/
23  */
24 
25 #ifndef LCDCHARACTERDISPLAY_H_
26 #define LCDCHARACTERDISPLAY_H_
27 #include "../bus/SPIDevice.h"
28 #include <string>
29 
30 namespace exploringBB {
31 
40 
41 private:
42  SPIDevice *device;
43  int width, height;
44  void command(char i);
45  void setup4bit();
46  unsigned char cursorState;
47  unsigned char displayState;
48  unsigned char entryState;
49  void writeCursorState();
50  void writeDisplayState();
51  void writeEntryState();
52 
53 public:
54  LCDCharacterDisplay(SPIDevice *device, int width, int height);
55 
56  virtual void write(char c);
57  virtual void print(std::string message);
58 
59  virtual void clear();
60  virtual void home();
61  virtual int setCursorPosition(int row, int column);
62  virtual void setDisplayOff(bool displayOff);
63  virtual void setCursorOff(bool cursorOff);
64  virtual void setCursorBlink(bool isBlink);
65  virtual void setCursorMoveOff(bool cursorMoveOff);
66  virtual void setCursorMoveLeft(bool cursorMoveLeft);
67  virtual void setAutoscroll(bool isAutoscroll);
68  virtual void setScrollDisplayLeft(bool scrollLeft);
69 
70  virtual ~LCDCharacterDisplay();
71 };
72 
73 } /* namespace exploringBB */
74 
75 #endif /* LCDCHARACTERDISPLAY_H_ */
virtual void setScrollDisplayLeft(bool scrollLeft)
Definition: LCDCharacterDisplay.cpp:319
virtual int setCursorPosition(int row, int column)
Definition: LCDCharacterDisplay.cpp:215
virtual void clear()
Definition: LCDCharacterDisplay.cpp:191
virtual void setCursorOff(bool cursorOff)
Definition: LCDCharacterDisplay.cpp:244
virtual void print(std::string message)
Definition: LCDCharacterDisplay.cpp:155
virtual void setCursorMoveLeft(bool cursorMoveLeft)
Definition: LCDCharacterDisplay.cpp:289
virtual ~LCDCharacterDisplay()
Definition: LCDCharacterDisplay.cpp:334
Generic SPI Device class that can be used to connect to any type of SPI device and read or write to i...
Definition: SPIDevice.h:39
virtual void setDisplayOff(bool displayOff)
Definition: LCDCharacterDisplay.cpp:229
virtual void write(char c)
Definition: LCDCharacterDisplay.cpp:174
Definition: BusDevice.cpp:27
virtual void setCursorMoveOff(bool cursorMoveOff)
Definition: LCDCharacterDisplay.cpp:274
virtual void setCursorBlink(bool isBlink)
Definition: LCDCharacterDisplay.cpp:259
A class that provides an interface to an LCD character module. It provices support for multiple rows ...
Definition: LCDCharacterDisplay.h:39
virtual void home()
Definition: LCDCharacterDisplay.cpp:199
LCDCharacterDisplay(SPIDevice *device, int width, int height)
Definition: LCDCharacterDisplay.cpp:65
virtual void setAutoscroll(bool isAutoscroll)
Definition: LCDCharacterDisplay.cpp:304