COSA
An Object-Oriented Platform for Arduino Programming
|
#include <MAX72XX.hh>
Public Types | |
enum | TextMode { NORMAL_TEXT_MODE = 0x00, INVERTED_TEXT_MODE = 0xff } |
Public Member Functions | |
MAX72XX (LCD::IO *io, const uint8_t *font=NULL) | |
virtual bool | begin () |
virtual bool | end () |
virtual void | display_contrast (uint8_t level) |
virtual void | display_on () |
virtual void | display_off () |
virtual void | display_clear () |
virtual void | set_cursor (uint8_t x, uint8_t y) |
virtual int | putchar (char c) |
virtual void | backlight_on () |
virtual void | backlight_off () |
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 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 = 8 |
static const uint8_t | HEIGHT = 1 |
static const uint8_t | LINES = 1 |
Protected Types | |
enum | Register { NOP = 0x00, DIGIT0 = 0x01, DIGIT1 = 0x02, DIGIT2 = 0x03, DIGIT3 = 0x04, DIGIT4 = 0x05, DIGIT5 = 0x06, DIGIT6 = 0x07, DIGIT7 = 0x08, DECODE_MODE = 0x09, INTENSITY = 0x0a, SCAN_LIMIT = 0x0b, DISPLAY_MODE = 0x0c, DISPLAY_TEST = 0x0f } |
enum | { SHUTDOWN_MODE = 0x00, NORMAL_OPERATION = 0x01 } |
enum | { NO_DECODE = 0x00, ALL_DECODE = 0xff } |
Protected Member Functions | |
void | set (Register reg, uint8_t value) |
Protected Attributes | |
LCD::IO * | m_io |
Display adapter. More... | |
const uint8_t * | m_font |
Font in program memory. More... | |
char | m_latest |
Latest character code. 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 | font [] |
MAX72XX Serially Interfaced, 8-Digit LED Display Drivers, device driver for IOStream access.
The MAX7219/MAX7221 are compact, serial input/output common-cathode display drivers that interface microprocessors (μPs) to 7-segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and an 8x8 static RAM that stores each digit.
Definition at line 64 of file MAX72XX.hh.
|
protected |
Shutdown Register Format (Table 3, pp. 7).
Enumerator | |
---|---|
SHUTDOWN_MODE |
Shutdown mode. |
NORMAL_OPERATION |
Normal operation. |
Definition at line 163 of file MAX72XX.hh.
|
protected |
Decode-Mode Register (Table 4, pp. 7).
Enumerator | |
---|---|
NO_DECODE |
No decode for digits 7-0. |
ALL_DECODE |
Code B decode for digits 7-0. |
Definition at line 171 of file MAX72XX.hh.
|
protected |
Register Address Map (Table 2, pp 7).
Definition at line 143 of file MAX72XX.hh.
|
inherited |
Construct display device driver with given io adapter and font. The font should be a character to segment mapping table in program memory for character codes SPACE(0x20) to DEL(0x7f).
[in] | io | adapter, SPI or in/output pin based. |
[in] | font | program memory (Default NULL). |
Definition at line 137 of file MAX72XX.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. Turns display on, clears and sets the contrast/intensity to mid-level(7).
Implements LCD::Device.
Definition at line 154 of file MAX72XX.cpp.
|
inlineinherited |
Set blocking mode.
Definition at line 85 of file IOStream.hh.
|
virtual |
Clear display and move cursor to home (0, 0).
Implements LCD::Device.
Definition at line 184 of file MAX72XX.cpp.
|
virtual |
Set display contrast/intensity level (0..15).
[in] | contrast | level. |
Reimplemented from LCD::Device.
Definition at line 192 of file MAX72XX.cpp.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
|
virtual |
|
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 165 of file MAX72XX.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 |
|
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, backspace, alert, horizontal tab and form-feed. The period character is translated to the 7-segment LED decimal point of the previous written character. Returns character or EOF on error.
[in] | c | character to write. |
Reimplemented from IOStream::Device.
Definition at line 205 of file MAX72XX.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 register to the given value.
[in] | reg | register address. |
[in] | value. |
Definition at line 145 of file MAX72XX.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 198 of file MAX72XX.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.
|
staticprotected |
Default font.
Definition at line 177 of file MAX72XX.hh.
|
static |
Definition at line 68 of file MAX72XX.hh.
|
static |
Definition at line 69 of file MAX72XX.hh.
|
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 |
Font in program memory.
Definition at line 181 of file MAX72XX.hh.
|
protected |
|
protected |
Latest character code.
Definition at line 182 of file MAX72XX.hh.
|
protectedinherited |
|
protectedinherited |
|
static |
Display size.
Definition at line 67 of file MAX72XX.hh.