COSA
An Object-Oriented Platform for Arduino Programming
|
#include <HD44780.hh>
Classes | |
class | IO |
class | Port4b |
class | SR3W |
class | SR3WSPI |
class | SR4W |
Public Types | |
enum | { CLEAR_DISPLAY = 0x01, RETURN_HOME = 0x02, ENTRY_MODE_SET = 0x04, CONTROL_SET = 0x08, SHIFT_SET = 0x10, FUNCTION_SET = 0x20, SET_CGRAM_ADDR = 0x40, SET_CGRAM_MASK = 0x3f, SET_DDRAM_ADDR = 0x80, SET_DDRAM_MASK = 0x7f, BIAS_RESISTOR_SET = 0x04, BIAS_RESISTOR_MASK = 0x03, COM_SEG_SET = 0x40, COM_SET_MASK = 0x0f, SET_DDATA_LENGTH = 0x80, SET_DDATA_MASK = 0x7f } |
enum | { DISPLAY_SHIFT = 0x01, INCREMENT = 0x02, DECREMENT = 0x00 } |
enum | { BLINK_ON = 0x01, CURSOR_ON = 0x02, DISPLAY_ON = 0x04 } |
enum | { MOVE_LEFT = 0x00, MOVE_RIGHT = 0x04, CURSOR_MODE = 0x00, DISPLAY_MOVE = 0x08 } |
enum | { DATA_LENGTH_4BITS = 0x00, DATA_LENGTH_8BITS = 0x10, NR_LINES_1 = 0x00, NR_LINES_2 = 0x08, FONT_5X8DOTS = 0x00, FONT_5X10DOTS = 0x04, BASIC_SET = 0x00, EXTENDED_SET = 0x04 } |
enum | TextMode { NORMAL_TEXT_MODE = 0x00, INVERTED_TEXT_MODE = 0xff } |
Public Member Functions | |
HD44780 (IO *io, uint8_t width=16, uint8_t height=2) | |
virtual bool | begin () |
virtual bool | end () |
virtual void | backlight_on () |
virtual void | backlight_off () |
virtual void | display_on () |
virtual void | display_off () |
void | display_scroll_left () |
void | display_scroll_right () |
virtual void | display_clear () |
void | line_clear () |
void | cursor_home () |
void | cursor_underline_on () |
void | cursor_underline_off () |
void | cursor_blink_on () |
void | cursor_blink_off () |
virtual void | set_cursor (uint8_t x, uint8_t y) |
void | text_flow_left_to_right () |
void | text_flow_right_to_left () |
void | text_scroll_left_adjust () |
void | text_scroll_right_adjust () |
void | set_custom_char (uint8_t id, const uint8_t *bitmap) |
void | set_custom_char_P (uint8_t id, const uint8_t *bitmap) |
virtual int | putchar (char c) |
virtual int | write (const void *buf, size_t size) |
void | write (uint8_t data) |
void | set (uint8_t &cmd, uint8_t mask) |
void | clear (uint8_t &cmd, uint8_t mask) |
void | set_data_mode () |
void | set_instruction_mode () |
virtual void | display_contrast (uint8_t level) |
virtual void | display_normal () |
virtual void | display_inverse () |
void | get_cursor (uint8_t &x, uint8_t &y) const |
uint8_t | get_tab_step () const |
void | set_tab_step (uint8_t step) |
TextMode | text_mode (TextMode mode) |
void | non_blocking () |
void | blocking () |
bool | is_blocking () const |
void | eol (Mode mode) |
Mode | eol () const |
virtual int | available () |
virtual int | room () |
virtual int | puts (const char *s) |
virtual int | puts (str_P s) |
virtual int | write (const iovec_t *vec) |
virtual int | write_P (const void *buf, size_t size) |
virtual int | peekchar () |
virtual int | peekchar (char c) |
virtual int | getchar () |
virtual char * | gets (char *s, size_t count) |
virtual int | read (void *buf, size_t size) |
virtual int | read (iovec_t *vec) |
virtual int | flush () |
virtual void | empty () |
Public Attributes | |
const uint8_t | WIDTH |
const uint8_t | HEIGHT |
IO * | m_io |
IO port handler. More... | |
uint8_t | m_mode |
Entry mode. More... | |
uint8_t | m_cntl |
Control. More... | |
uint8_t | m_func |
Function set. More... | |
const uint8_t * | m_offset |
Row offset table. More... | |
Static Public Attributes | |
static const uint8_t | BITMAP_MAX = 8 |
static const uint16_t | LONG_EXEC_TIME = 1600 |
static const uint16_t | POWER_ON_TIME = 48 |
static const uint16_t | INIT0_TIME = 4500 |
static const uint16_t | INIT1_TIME = 150 |
static const uint8_t | offset0 [] |
static const uint8_t | offset1 [] = { 0x00, 0x40, 0x10, 0x50 } |
Protected Attributes | |
uint8_t | m_x |
Cursor position x. More... | |
uint8_t | m_y |
Cursor position y. More... | |
uint8_t | m_tab |
Tab step. More... | |
bool | m_blocking |
Mode | m_eol |
HD44780 (LCD-II) Dot Matix Liquid Crystal Display Controller/Driver for LCD/IOStream access. Binding to trace, etc. Supports simple text scroll, cursor, and handling of special characters such as carriage- return, form-feed, back-space, horizontal tab and new-line.
Definition at line 37 of file HD44780.hh.
anonymous enum |
Instructions (Table 6, pp. 24), RS(0), RW(0).
Definition at line 843 of file HD44780.hh.
anonymous enum |
ENTRY_MODE_SET attributes.
Enumerator | |
---|---|
DISPLAY_SHIFT |
Shift the entire display not cursor. |
INCREMENT |
Increment (right) on write. |
DECREMENT |
Decrement (left) on write. |
Definition at line 865 of file HD44780.hh.
anonymous enum |
CONTROL_SET attributes.
Enumerator | |
---|---|
BLINK_ON |
The character indicated by cursor blinks. |
CURSOR_ON |
The cursor is displayed. |
DISPLAY_ON |
The display is on. |
Definition at line 874 of file HD44780.hh.
anonymous enum |
SHIFT_SET attributes.
Enumerator | |
---|---|
MOVE_LEFT |
Moves cursor and shifts display. |
MOVE_RIGHT |
without changing DDRAM contents. |
CURSOR_MODE | |
DISPLAY_MOVE |
Definition at line 883 of file HD44780.hh.
anonymous enum |
FUNCTION_SET attributes.
Definition at line 893 of file HD44780.hh.
|
inherited |
|
inline |
Construct HD44780 LCD connected to given io port handler. The display is initiated when calling begin().
[in] | io | handler. |
[in] | width | of display, characters per line (Default 16). |
[in] | height | of display, number of lines (Default 2). |
Definition at line 108 of file HD44780.hh.
|
virtualinherited |
Number of bytes available (possible to read).
Reimplemented in W5200::Driver, W5500::Driver, W5100::Driver, Soft::UART, UART, IOBuffer< SIZE >, and CC3000::Driver.
Definition at line 24 of file IOStream_Device.cpp.
|
virtual |
Turn display backlight off.
Reimplemented from LCD::Device.
Definition at line 80 of file HD44780.cpp.
|
virtual |
Turn display backlight on.
Reimplemented from LCD::Device.
Definition at line 74 of file HD44780.cpp.
|
virtual |
Start display for text output. Returns true if successful otherwise false.
Implements LCD::Device.
Definition at line 30 of file HD44780.cpp.
|
inlineinherited |
Set blocking mode.
Definition at line 85 of file IOStream.hh.
|
inline |
Clear display attribute and update driver mirror variable.
[in,out] | cmd | command variable. |
[in] | mask | function. |
Definition at line 941 of file HD44780.hh.
|
inline |
Turn cursor blink off.
Definition at line 225 of file HD44780.hh.
|
inline |
Turn cursor blink on.
Definition at line 216 of file HD44780.hh.
void HD44780::cursor_home | ( | ) |
Move cursor to home position(0, 0) .
Definition at line 108 of file HD44780.cpp.
|
inline |
Turn underline cursor off.
Definition at line 207 of file HD44780.hh.
|
inline |
Turn underline cursor on.
Definition at line 198 of file HD44780.hh.
|
virtual |
Clear display and move cursor to home(0, 0).
Implements LCD::Device.
Definition at line 98 of file HD44780.cpp.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
|
virtual |
|
inline |
Set display scrolling left.
Definition at line 161 of file HD44780.hh.
|
inline |
Set display scrolling right.
Definition at line 170 of file HD44780.hh.
|
virtualinherited |
Empty internal device buffers.
Reimplemented in Soft::UART, UART, and IOBuffer< SIZE >.
Definition at line 175 of file IOStream_Device.cpp.
|
virtual |
Stop display and power down. Returns true if successful otherwise false.
Implements LCD::Device.
Definition at line 67 of file HD44780.cpp.
|
inlineinherited |
Set end of line mode.
[in] | mode | for end of line. |
Definition at line 103 of file IOStream.hh.
|
inlineinherited |
|
virtualinherited |
Flush internal device buffers. Wait for device to become idle.
Reimplemented in W5200::Driver, W5500::Driver, W5100::Driver, UART, IOBuffer< SIZE >, CC3000::Driver, and WIO.
Definition at line 169 of file IOStream_Device.cpp.
|
inlineinherited |
|
inlineinherited |
|
virtualinherited |
Read character from device.
Reimplemented in FAT16::File, CFFS::File, Soft::UART, UART, IOBuffer< SIZE >, and Socket.
Definition at line 112 of file IOStream_Device.cpp.
|
virtualinherited |
Read string terminated by new-line or until size into given string buffer. Returns pointer to string or NULL if empty line.
[in] | s | string buffer to read into. |
[in] | count | max number of bytes to read. |
Definition at line 118 of file IOStream_Device.cpp.
|
inlineinherited |
|
inline |
Clear to end of line.
Definition at line 185 of file HD44780.hh.
|
inlineinherited |
Set non-blocking mode.
Definition at line 77 of file IOStream.hh.
|
virtualinherited |
Peek at the next character from device.
Reimplemented in Soft::UART, UART, and IOBuffer< SIZE >.
Definition at line 99 of file IOStream_Device.cpp.
|
virtualinherited |
Peek for the given character in device buffer. Return number of characters or EOF(-1).
[in] | c | character to peek for. |
Reimplemented in Soft::UART, UART, and IOBuffer< SIZE >.
Definition at line 105 of file IOStream_Device.cpp.
|
virtual |
Write character to display. Handles carriage-return-line-feed, back- space, alert, horizontal tab and form-feed. Returns character or EOF on error.
[in] | c | character to write. |
Reimplemented from IOStream::Device.
Definition at line 152 of file HD44780.cpp.
|
virtualinherited |
Write null terminated string to device. Terminating null is not written.
[in] | s | string to write. |
Definition at line 43 of file IOStream_Device.cpp.
|
virtualinherited |
Write null terminated string from program memory to device. Terminating null is not written.
[in] | s | string in program memory to write. |
Definition at line 54 of file IOStream_Device.cpp.
|
virtualinherited |
Read data to given buffer with given size from device.
[in] | buf | buffer to read into. |
[in] | size | number of bytes to read. |
Reimplemented in FAT16::File, W5200::Driver, W5500::Driver, W5100::Driver, CFFS::File, Socket, and CC3000::Driver.
Definition at line 144 of file IOStream_Device.cpp.
|
virtualinherited |
Read data to given buffers in null terminated io vector.
[in] | vec | io vector with buffers to read into. |
Definition at line 157 of file IOStream_Device.cpp.
|
virtualinherited |
Number of bytes room (write without blocking).
Reimplemented in W5200::Driver, W5500::Driver, W5100::Driver, UART, IOBuffer< SIZE >, CC3000::Driver, and WIO.
Definition at line 30 of file IOStream_Device.cpp.
|
inline |
Set display attribute and update driver mirror variable.
[in,out] | cmd | command variable. |
[in] | mask | function. |
Definition at line 930 of file HD44780.hh.
|
virtual |
Set cursor position to given position.
[in] | x. | |
[in] | y. |
Implements LCD::Device.
Definition at line 117 of file HD44780.cpp.
void HD44780::set_custom_char | ( | uint8_t | id, |
const uint8_t * | bitmap | ||
) |
Set custom character bitmap for given identity (0..7).
[in] | id | character. |
[in] | bitmap | pointer to bitmap. |
Definition at line 128 of file HD44780.cpp.
void HD44780::set_custom_char_P | ( | uint8_t | id, |
const uint8_t * | bitmap | ||
) |
Set custom character bitmap to given identity (0..7). The bitmap should be stored in program memory.
[in] | id | character. |
[in] | bitmap | pointer to program memory bitmap. |
Definition at line 140 of file HD44780.cpp.
|
inline |
Set communication in data stream mode.
Definition at line 950 of file HD44780.hh.
|
inline |
Set communication in instruction stream mode.
Definition at line 959 of file HD44780.hh.
|
inlineinherited |
|
inline |
Set text flow left-to-right.
Definition at line 242 of file HD44780.hh.
|
inline |
Set text flow right-to-left.
Definition at line 251 of file HD44780.hh.
|
inline |
Set text scroll left adjust.
Definition at line 260 of file HD44780.hh.
|
inline |
Set text scroll right adjust.
Definition at line 269 of file HD44780.hh.
|
virtualinherited |
Write data from buffers in null terminated io vector.
[in] | vec | io vector with buffers to write. |
Definition at line 87 of file IOStream_Device.cpp.
|
virtual |
Write data from buffer with given size to device.
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
Reimplemented from IOStream::Device.
Definition at line 219 of file HD44780.cpp.
|
inline |
Write data or command to display.
[in] | data | to write. |
Definition at line 919 of file HD44780.hh.
|
virtualinherited |
Write data from buffer in program memory with given size to device.
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
Reimplemented in CFFS::File, Socket, and CC3000::Driver.
Definition at line 76 of file IOStream_Device.cpp.
|
static |
Max size of custom character font bitmap.
Definition at line 93 of file HD44780.hh.
const uint8_t HD44780::HEIGHT |
Display height (lines).
Definition at line 99 of file HD44780.hh.
|
static |
Definition at line 837 of file HD44780.hh.
|
static |
Definition at line 838 of file HD44780.hh.
|
static |
Bus Timing Characteristics (in micro-seconds), fig. 25, pp. 50.
Definition at line 835 of file HD44780.hh.
|
protectedinherited |
Blocking state
Definition at line 248 of file IOStream.hh.
uint8_t HD44780::m_cntl |
Control.
Definition at line 911 of file HD44780.hh.
|
protectedinherited |
End of line mode
Definition at line 251 of file IOStream.hh.
uint8_t HD44780::m_func |
Function set.
Definition at line 912 of file HD44780.hh.
IO* HD44780::m_io |
IO port handler.
Display pins and state (mirror of device registers).
Definition at line 909 of file HD44780.hh.
uint8_t HD44780::m_mode |
Entry mode.
Definition at line 910 of file HD44780.hh.
const uint8_t* HD44780::m_offset |
Row offset table.
Definition at line 913 of file HD44780.hh.
|
protectedinherited |
|
protectedinherited |
|
static |
Row offset tables for display dimensions (16X1, 16X2, 16X4, 20X4).
Definition at line 905 of file HD44780.hh.
|
static |
Definition at line 906 of file HD44780.hh.
|
static |
Definition at line 836 of file HD44780.hh.
const uint8_t HD44780::WIDTH |
Display width (characters per line).
Definition at line 96 of file HD44780.hh.