Arduino-LCD
LCD library for Arduino
MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN > Class Template Reference

#include <MAX72XX.h>

Inheritance diagram for MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >:
Inheritance graph
Collaboration diagram for MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >:
Collaboration graph

Public Member Functions

 MAX72XX (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 cursor_set (uint8_t x, uint8_t y)
 
virtual size_t write (uint8_t c)
 
virtual void backlight_on ()
 
virtual void backlight_off ()
 
virtual void display_normal ()
 
virtual void display_inverse ()
 
virtual void cursor_blink_on ()
 
virtual void cursor_blink_off ()
 
void cursor_get (uint8_t &x, uint8_t &y) const
 
virtual void cursor_home ()
 
virtual void cursor_update ()
 
uint8_t tab_step () const
 
void tab_step (uint8_t step)
 
uint8_t text_mode () const
 
void text_normal_mode ()
 
void text_inverted_mode ()
 

Static Public Attributes

static const uint8_t WIDTH = 8
 
static const uint8_t HEIGHT = 1
 

Protected Types

enum  {
  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 (uint8_t reg, uint8_t value)
 

Protected Attributes

GPIO< SCE_PIN > m_sce
 Chip enable pin. More...
 
SRPO< MSBFIRST, SDIN_PIN, SCLK_PIN > m_srpo
 Serial output. 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...
 

Detailed Description

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
class MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >

Device driver for MAX72XX Serially Interfaced, 8-Digit LED Display Drivers.

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.

References

  1. Product Specification, MAXIM, MAX7219/7221, 19-5542, Rev.4, 7/03. http://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf
Parameters
[in]SCE_PINscreen chip enable pin.
[in]SDIN_PINscreen data pin.
[in]SCLK_PINscreen clock pin.

Definition at line 46 of file MAX72XX.h.

Member Enumeration Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
anonymous enum
protected

Register Address Map (Table 2, pp 7).

Enumerator
NOP 

No-operation.

DIGIT0 

Digit 0 (encode or segment data).

DIGIT1 

Digit 1 (encode or segment data).

DIGIT2 

Digit 2 (encode or segment data).

DIGIT3 

Digit 3 (encode or segment data).

DIGIT4 

Digit 4 (encode or segment data).

DIGIT5 

Digit 5 (encode or segment data).

DIGIT6 

Digit 6 (encode or segment data).

DIGIT7 

Digit 7 (encode or segment data).

DECODE_MODE 

Decode Mode (0..255, digit bitset).

INTENSITY 

Intensity (0..15, level).

SCAN_LIMIT 

Scan Limit (0..7, digits 1..8).

DISPLAY_MODE 

Display Mode (shutdown, normal).

DISPLAY_TEST 

Display Test (0..1, on/off).

Definition at line 329 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
anonymous enum
protected

Shutdown Register Format (Table 3, pp. 7).

Enumerator
SHUTDOWN_MODE 

Shutdown mode.

NORMAL_OPERATION 

Normal operation.

Definition at line 362 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
anonymous enum
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 370 of file MAX72XX.h.

Constructor & Destructor Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::MAX72XX ( const uint8_t *  font = NULL)
inline

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). No-Decode Mode Data Bits and Corresponding Segment Lines (Table 6, pp 8.).

A
+---+
F| G |B
+---+ Standard 7-Segment LED
E| |C
+---+ DP
D
D7 D6 D5 D4 D3 D2 D1 D0
DP A B C D E F G
Parameters
[in]fontprogram memory (Default NULL).

Default font table; SPACE(0x20) to DEL(0x7f).

Definition at line 73 of file MAX72XX.h.

Member Function Documentation

virtual void LCD::Device::backlight_off ( )
inlinevirtualinherited

Turn display backlight off.

Reimplemented in HD44780, and LCD4884.

Definition at line 70 of file LCD.h.

virtual void LCD::Device::backlight_on ( )
inlinevirtualinherited

Turn display backlight on.

Reimplemented in HD44780, and LCD4884.

Definition at line 64 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual bool MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::begin ( )
inlinevirtual

Start interaction with display. Turns display on, clears and sets the contrast/intensity to mid-level(7).

Returns
true(1) if successful otherwise false(0)

Implements LCD::Device.

Definition at line 186 of file MAX72XX.h.

virtual void LCD::Device::cursor_blink_off ( )
inlinevirtualinherited

Turn cursor blink off.

Reimplemented in HD44780.

Definition at line 119 of file LCD.h.

virtual void LCD::Device::cursor_blink_on ( )
inlinevirtualinherited

Turn cursor blink on.

Reimplemented in HD44780.

Definition at line 113 of file LCD.h.

void LCD::Device::cursor_get ( uint8_t &  x,
uint8_t &  y 
) const
inlineinherited

Get current cursor position.

Parameters
[out]x.
[out]y.

Definition at line 126 of file LCD.h.

virtual void LCD::Device::cursor_home ( )
inlinevirtualinherited

Set cursor to home position (0, 0).

Reimplemented in HD44780.

Definition at line 145 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::cursor_set ( uint8_t  x,
uint8_t  y 
)
inlinevirtual

Set cursor to given position.

Parameters
[in]xpixel position (0..WIDTH-1).
[in]yline position (0..HEIGHT-1).

Implements LCD::Device.

Definition at line 254 of file MAX72XX.h.

virtual void LCD::Device::cursor_update ( )
inlinevirtualinherited

Call frequently to allow cursor blink.

Definition at line 154 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::display_clear ( )
inlinevirtual

Clear display and move cursor to home (0, 0).

Implements LCD::Device.

Definition at line 241 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::display_contrast ( uint8_t  level)
inlinevirtual

Set display contrast/intensity level (0..15).

Parameters
[in]contrastlevel.

Reimplemented from LCD::Device.

Definition at line 214 of file MAX72XX.h.

virtual void LCD::Device::display_inverse ( )
inlinevirtualinherited

Display inverse mode.

Reimplemented in PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >, and PCD8544< BOARD::D5, BOARD::D4, BOARD::D3, BOARD::D2 >.

Definition at line 101 of file LCD.h.

virtual void LCD::Device::display_normal ( )
inlinevirtualinherited

Display normal mode.

Reimplemented in PCD8544< SCE_PIN, DC_PIN, SDIN_PIN, SCLK_PIN >, and PCD8544< BOARD::D5, BOARD::D4, BOARD::D3, BOARD::D2 >.

Definition at line 95 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::display_off ( )
inlinevirtual

Turn display off.

Implements LCD::Device.

Definition at line 232 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::display_on ( )
inlinevirtual

Turn display on.

Implements LCD::Device.

Definition at line 223 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual bool MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::end ( )
inlinevirtual

Stop sequence of interaction with device. Puts the display in shutdown mode.

Returns
true(1) if successful otherwise false(0)

Reimplemented from LCD::Device.

Definition at line 203 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
void MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::set ( uint8_t  reg,
uint8_t  value 
)
inlineprotected

Set register to the given value.

Parameters
[in]regregister address.
[in]value.

Definition at line 351 of file MAX72XX.h.

uint8_t LCD::Device::tab_step ( ) const
inlineinherited

Get tab step.

Returns
tab step.

Definition at line 160 of file LCD.h.

void LCD::Device::tab_step ( uint8_t  step)
inlineinherited

Set tab step to given value.

Parameters
[in]steptab.

Definition at line 170 of file LCD.h.

void LCD::Device::text_inverted_mode ( )
inlineinherited

Set inverted text mode.

Definition at line 197 of file LCD.h.

uint8_t LCD::Device::text_mode ( ) const
inlineinherited

Get text mode. Return 0x00 for normal mode, 0xff inverted mode.

Definition at line 179 of file LCD.h.

void LCD::Device::text_normal_mode ( )
inlineinherited

Set normal text mode.

Definition at line 188 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
virtual size_t MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::write ( uint8_t  c)
inlinevirtual

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 number of characters(1) or zero(0) on error.

Parameters
[in]ccharacter to write.
Returns
number of characters written(1) or zero(0) for error.

Definition at line 272 of file MAX72XX.h.

Member Data Documentation

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::HEIGHT = 1
static

Definition at line 50 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t* MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::m_font
protected

Font in program memory.

Definition at line 377 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
char MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::m_latest
protected

Latest character code.

Definition at line 378 of file MAX72XX.h.

uint8_t LCD::Device::m_mode
protectedinherited

Text mode.

Definition at line 207 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
GPIO<SCE_PIN> MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::m_sce
protected

Chip enable pin.

Definition at line 375 of file MAX72XX.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
SRPO<MSBFIRST, SDIN_PIN, SCLK_PIN> MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::m_srpo
protected

Serial output.

Definition at line 376 of file MAX72XX.h.

uint8_t LCD::Device::m_tab
protectedinherited

Tab step.

Definition at line 206 of file LCD.h.

uint8_t LCD::Device::m_x
protectedinherited

Cursor position x.

Definition at line 204 of file LCD.h.

uint8_t LCD::Device::m_y
protectedinherited

Cursor position y.

Definition at line 205 of file LCD.h.

template<BOARD::pin_t SCE_PIN, BOARD::pin_t SDIN_PIN, BOARD::pin_t SCLK_PIN>
const uint8_t MAX72XX< SCE_PIN, SDIN_PIN, SCLK_PIN >::WIDTH = 8
static

Display size.

Definition at line 49 of file MAX72XX.h.


The documentation for this class was generated from the following file: