COSA
An Object-Oriented Platform for Arduino Programming
|
#include <ST7565.hh>
Public Types | |
enum | TextMode { NORMAL_TEXT_MODE = 0x00, INVERTED_TEXT_MODE = 0xff } |
Public Member Functions | |
ST7565 (LCD::IO *io, Board::DigitalPin dc=Board::D8, Font *font=&system5x7) | |
virtual bool | begin () |
virtual bool | end () |
virtual void | display_contrast (uint8_t level) |
virtual void | display_on () |
virtual void | display_off () |
virtual void | display_normal () |
virtual void | display_inverse () |
virtual void | display_clear () |
virtual void | set_cursor (uint8_t x, uint8_t y) |
Font * | get_text_font () const |
Font * | set_text_font (Font *font) |
void | draw_icon (const uint8_t *bp) |
void | draw_bitmap (uint8_t *bp, uint8_t width, uint8_t height) |
void | draw_bar (uint8_t percent, uint8_t width, uint8_t pattern=0x55) |
virtual int | putchar (char c) |
virtual void | backlight_on () |
virtual void | backlight_off () |
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 void *buf, size_t size) |
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 () |
Static Public Attributes | |
static const uint8_t | WIDTH = 128 |
static const uint8_t | HEIGHT = 64 |
static const uint8_t | LINES = 8 |
Protected Types | |
enum | { DISPLAY_OFF = 0xAE, DISPLAY_ON = 0xAF, SET_DISPLAY_START = 0x40, DISPLAY_START_MASK = 0x3f, SET_Y_ADDR = 0xB0, Y_ADDR_MASK = 0x0f, SET_X_ADDR = 0x10, X_ADDR_MASK = 0x0f, ADC_NORMAL = 0xA0, ADC_REVERSE = 0xA1, DISPLAY_NORMAL = 0xA6, DISPLAY_REVERSE = 0xA7, DISPLAY_64X128_POINTS = 0xA4, DISPLAY_65X132_POINTS = 0xA5, LCD_BIAS_9 = 0xA2, LCD_BIAS_7 = 0xA3, X_ADDR_INC = 0xE0, X_ADDR_CLEAR = 0xEE, INTERNAL_RESET = 0xE2, COM_OUTPUT_NORMAL = 0xC0, COM_OUTPUT_REVERSE = 0xC8, SET_POWER_CONTROL = 0x28, POWER_MASK = 0x07, SET_RESISTOR_RATIO = 0x20, RESISTOR_MASK = 0x07, SET_CONSTRAST = 0x81, CONSTRAST_MASK = 0x3f, INDICATOR_OFF = 0xAC, INDICATOR_ON = 0xAD, FLASHING_OFF = 0x00, FLASHING_ON = 0x01, SET_BOOSTER_RATIO = 0xF8, BOOSTER_RATIO_234X = 0, BOOSTER_RATIO_5X = 1, BOOSTER_RATIO_6X = 3, NOP = 0xE3, SCRIPT_PAUSE = 0xF0, SCRIPT_END = 0xFF } |
Protected Member Functions | |
void | set (uint8_t cmd) |
void | set (uint8_t x, uint8_t y) |
void | fill (uint8_t data, uint16_t count) |
Protected Attributes | |
LCD::IO * | m_io |
Display adapter. More... | |
OutputPin | m_dc |
Data(1) or command(0). More... | |
uint8_t | m_line |
Display start line. More... | |
Font * | m_font |
Font. More... | |
uint8_t | m_x |
Cursor position x. More... | |
uint8_t | m_y |
Cursor position y. More... | |
uint8_t | m_tab |
Tab step. More... | |
uint8_t | m_mode |
Text mode. More... | |
bool | m_blocking |
Mode | m_eol |
Static Protected Attributes | |
static const uint8_t | script [] |
ST7565 64x128 pixels matrix LCD controller/driver, device driver for IOStream/LCD access. Binding to trace, etc. Support natural text scroll, cursor, and handling of special characters such as carriage-return, form-feed, back-space, horizontal tab and new-line. Graphics should be performed with OffScreen Canvas and copied to the display with draw_bitmap().
|
protected |
Instruction set (table 16, pp. 52).
|
inherited |
ST7565::ST7565 | ( | LCD::IO * | io, |
Board::DigitalPin | dc = Board::D8 , |
||
Font * | font = &system5x7 |
||
) |
Construct display device driver with given io adapter, chip select pin and font.
[in] | io | adapter; |
[in] | dc | data/command control pin (default D8/D2). |
[in] | font | bitmap (default System 5X7). |
Definition at line 43 of file ST7565.cpp.
|
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.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
Start interaction with display.
Implements LCD::Device.
Definition at line 82 of file ST7565.cpp.
|
inlineinherited |
Set blocking mode.
Definition at line 85 of file IOStream.hh.
|
virtual |
Clear display and move cursor to home.
Implements LCD::Device.
Definition at line 144 of file ST7565.cpp.
|
virtual |
Set display contrast (0..63).
[in] | level. |
Reimplemented from LCD::Device.
Definition at line 109 of file ST7565.cpp.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
void ST7565::draw_bar | ( | uint8_t | percent, |
uint8_t | width, | ||
uint8_t | pattern = 0x55 |
||
) |
Draw a bar at the current position with the given width. The bar is filled from left to right proportional to the given percent (0..100).
[in] | percent | filled from left to right. |
[in] | width | of bar. |
[in] | pattern | of filled section of bar. |
Definition at line 197 of file ST7565.cpp.
void ST7565::draw_bitmap | ( | uint8_t * | bp, |
uint8_t | width, | ||
uint8_t | height | ||
) |
Draw bitmap in the current mode.
[in] | bp. | |
[in] | width. | |
[in] | height. |
Definition at line 182 of file ST7565.cpp.
void ST7565::draw_icon | ( | const uint8_t * | bp | ) |
Draw icon in the current mode. The icon must be stored in program memory with width, height and data.
[in] | bp |
Definition at line 165 of file ST7565.cpp.
|
virtualinherited |
Empty internal device buffers.
Reimplemented in Soft::UART, UART, and IOBuffer< SIZE >.
Definition at line 175 of file IOStream_Device.cpp.
|
virtual |
Stop sequence of interaction with device.
Implements LCD::Device.
Definition at line 102 of file ST7565.cpp.
|
inlineinherited |
Set end of line mode.
[in] | mode | for end of line. |
Definition at line 103 of file IOStream.hh.
|
inlineinherited |
|
protected |
Fill display with given data.
[in] | data | to fill with. |
[in] | count | number of bytes to fill. |
Definition at line 74 of file ST7565.cpp.
|
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 |
|
inline |
|
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 |
|
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 220 of file ST7565.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.
|
protected |
Set the given command code.
[in] | cmd | command code. |
Definition at line 52 of file ST7565.cpp.
|
protected |
Set display address for next data block.
[in] | x | position (0..WIDTH-1). |
[in] | y | position (0..LINES-1). |
Definition at line 62 of file ST7565.cpp.
|
virtual |
Set cursor to given position.
[in] | x | pixel position (0..WIDTH-1). |
[in] | y | line position (0..LINES-1). |
Implements LCD::Device.
Definition at line 154 of file ST7565.cpp.
|
inlineinherited |
|
virtualinherited |
Write data from buffer with given size to device.
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
Reimplemented in FAT16::File, HD44780, CFFS::File, VLCD, Socket, and CC3000::Driver.
Definition at line 65 of file IOStream_Device.cpp.
|
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.
|
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.
|
protectedinherited |
Blocking state
Definition at line 248 of file IOStream.hh.
|
protectedinherited |
End of line mode
Definition at line 251 of file IOStream.hh.
|
protected |
|
protectedinherited |
|
protectedinherited |
|
staticprotected |
|
static |