DUDS
Distributed Update of Data from Something
HD44780.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2017 Jeff Jackowski
9  */
13 #include <chrono>
14 
15 namespace duds { namespace ui { namespace graphics {
16  class BppImage;
17 } } }
18 
19 namespace duds { namespace hardware { namespace devices { namespace displays {
20 
64  std::vector<duds::hardware::interface::DigitalPinConfig> outcfg;
70  std::chrono::high_resolution_clock::time_point soonestSend;
74  std::chrono::nanoseconds nibblePeriod;
75  enum {
79  dataMask = 0xFF,
84  textFlag = 0x100,
88  writeFlag = 0x200, // not presently supported; wire to ground
93  nibbleFlag = 0x400
94  };
103  void wait() const;
107  struct Access {
117  };
127  void preparePins(Access &acc);
140  void sendByte(Access &acc, int val);
141  virtual void moveImpl(unsigned int c, unsigned int r);
147  virtual void writeImpl(int c);
148  void writeImpl(Access &acc, const std::string &text);
149  virtual void writeImpl(const std::string &text);
150  virtual void writeImpl(
151  const std::string &text,
152  unsigned int c,
153  unsigned int r
154  );
155 public:
159  HD44780();
203  HD44780(
206  unsigned int c,
207  unsigned int r,
208  std::chrono::nanoseconds delay = std::chrono::nanoseconds(8000)
209  );
213  virtual ~HD44780();
257  void configure(
260  unsigned int c,
261  unsigned int r,
262  std::chrono::nanoseconds delay = std::chrono::nanoseconds(8000)
263  );
277  void initialize();
285  void off();
293  void on();
299  virtual void clear();
346  void setGlyph(
347  const std::shared_ptr<duds::ui::graphics::BppImage> &glyph,
348  int idx
349  );
350 };
351 
352 } } } }
Implements text output to HD44780 and compatible display controllers, such as the SPLC780D...
Definition: HD44780.hpp:42
Provides access to multiple pins on a DigitalPort.
std::chrono::high_resolution_clock::time_point soonestSend
The soonest time a new command can be sent to the display.
Definition: HD44780.hpp:70
duds::hardware::interface::ChipSelect enable
Used to represent the enable line of the LCD.
Definition: HD44780.hpp:60
An object to wrap together a ChipSelectManager and chip ID to simplify code that needs to repeatedly ...
Definition: ChipSelect.hpp:24
duds::hardware::interface::DigitalPinSetAccess output
The set used for the 4 data pins and the text flag, more commonly referred to as "RS".
Definition: HD44780.hpp:112
Represents a set of pins on a single DigitalPort.
An object used to provide chip select control to a single user at a time.
Definition: ChipAccess.hpp:22
Stores access objects together.
Definition: HD44780.hpp:107
std::basic_ostream< Char, Traits > & clear(std::basic_ostream< Char, Traits > &os)
Display stream manipulator that clears all text from the display and places the cursor in the upper l...
std::vector< duds::hardware::interface::DigitalPinConfig > outcfg
The best output configuration for the display bus given the port in use.
Definition: HD44780.hpp:64
duds::hardware::interface::DigitalPinSet outputs
Represents the 5 output lines, other than enable, that are needed to communicate with the LCD...
Definition: HD44780.hpp:52
General graphics related code.
Definition: HD44780.hpp:15
duds::hardware::interface::ChipAccess enable
Used to assert the enable line of the LCD.
Definition: HD44780.hpp:116
std::chrono::nanoseconds nibblePeriod
The amount of time to allow the display to read data.
Definition: HD44780.hpp:74
A fairly generic interface to a character based display that lacks color.
Definition: TextDisplay.hpp:31
An image that uses a single bit to represent the state of each pixel; a black or white picture...
Definition: BppImage.hpp:321