Library for Sure Electronics HT1632 based LED matrix displays. Supports multiple displays connected together.

Dependents:   HT1632MsgScroller SMS_LEDMatrixPrinter

Embed: (wiki syntax)

« Back to documentation index

HT1632_LedMatrix Class Reference

HT1632_LedMatrix Class Reference

class HT1632_LedMatrix More...

#include <HT1632_LedMatrix.h>

Public Member Functions

 HT1632_LedMatrix (PinName clk, PinName dat, PinName cs1, PinName cs2, PinName cs3, PinName cs4)
 Default Constructor for the display driver.
void init (uint8_t, uint8_t, uint8_t displayType=HT1632_08x32)
 Initialise the library with the display configuration.
void displayOff (void)
 Turn off the display.
void displayOn (void)
 Turn on the display.
void clear (void)
 Clear the display, and the shadow memory, and the snapshot memory.
void setBrightness (unsigned char)
 Set display brightness.
uint8_t putChar (int, int, char)
 Copy a character glyph from the font data structure to display memory, with its upper left at the given coordinate This is unoptimized and simply uses plot() to draw each dot.
void write (uint8_t)
 Copy a character glyph from the font data structure to display memory, with its upper left at the given coordinate This is a wrapper for putChar that uses current cursor position.
void putString (int, int, char *)
 Write a string at the position specified x and y start from 0 and count number of pixels, 2nd row on a 2 row display is y=8.
void plot (int, int, char)
 Plot a point on the display, with the upper left hand corner being (0,0), and the lower right hand corner being (xMax-1, yMax-1).
void gotoXY (int, int)
 Set cursor position.
void getXY (int *, int *)
 Return the current cursor position.
void getXYMax (int *, int *)
 Return the maximum size of the display.
void shiftCursorX (int)
 Shift cursor X position a number of positions either left or right.
void setCustomChar (int, unsigned char[])
 Create a custom character.
void setCustomChar (int, unsigned char[], uint8_t)
 Create a custom character.
void scrollLeft (uint8_t, uint8_t)
 Scroll row to the left.
void putShadowRam ()
 Write shaddow ram to display.
void putShadowRam (uint8_t)
 Write shadow ram to a specific dasipaly board.
void drawLine (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char c)
 Draws a line between two points on the display.
void drawRectangle (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char c)
 Draw a rectangle given to top left and bottom right points.
void drawFilledRectangle (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char c)
 Draw a filled rectangle given to top left and bottom right points.
void drawCircle (unsigned char xc, unsigned char yc, unsigned char r, unsigned char c)
 Draw a circle using Bresenham's algorithm.

Detailed Description

class HT1632_LedMatrix

Definition at line 87 of file HT1632_LedMatrix.h.


Constructor & Destructor Documentation

HT1632_LedMatrix ( PinName  clk,
PinName  dat,
PinName  cs1,
PinName  cs2,
PinName  cs3,
PinName  cs4 
)

Default Constructor for the display driver.

Definition at line 108 of file HT1632_LedMatrix.cpp.


Member Function Documentation

void clear ( void   )

Clear the display, and the shadow memory, and the snapshot memory.

This uses the "write multiple words" capability of the chipset by writing all 96 words of memory without raising the chipselect signal.

Definition at line 261 of file HT1632_LedMatrix.cpp.

void displayOff ( void   )

Turn off the display.

Definition at line 165 of file HT1632_LedMatrix.cpp.

void displayOn ( void   )

Turn on the display.

Definition at line 173 of file HT1632_LedMatrix.cpp.

void drawCircle ( unsigned char  xc,
unsigned char  yc,
unsigned char  r,
unsigned char  c 
)

Draw a circle using Bresenham's algorithm.

Some small circles will look like squares!!

Parameters:
centrecolumn
centrerow
radius
pointon or off, off to erase, on to draw

Definition at line 659 of file HT1632_LedMatrix.cpp.

void drawFilledRectangle ( unsigned char  x1,
unsigned char  y1,
unsigned char  x2,
unsigned char  y2,
unsigned char  c 
)

Draw a filled rectangle given to top left and bottom right points.

Parameters:
topleft column
topleft row
bottomright column
bottomright row
pointon or off, off to erase, on to draw

Definition at line 641 of file HT1632_LedMatrix.cpp.

void drawLine ( unsigned char  x1,
unsigned char  y1,
unsigned char  x2,
unsigned char  y2,
unsigned char  c 
)

Draws a line between two points on the display.

Parameters:
startcolumn
startrow
endcolumn
endrow
pointon or off, off to erase, on to draw

Definition at line 545 of file HT1632_LedMatrix.cpp.

void drawRectangle ( unsigned char  x1,
unsigned char  y1,
unsigned char  x2,
unsigned char  y2,
unsigned char  c 
)

Draw a rectangle given to top left and bottom right points.

Parameters:
topleft column
topleft row
bottomright column
bottomright row
pointon or off, off to erase, on to draw

Definition at line 622 of file HT1632_LedMatrix.cpp.

void getXY ( int *  x,
int *  y 
)

Return the current cursor position.

Parameters:
columnpointer
rowpointer

Definition at line 444 of file HT1632_LedMatrix.cpp.

void getXYMax ( int *  x,
int *  y 
)

Return the maximum size of the display.

Parameters:
columnpointer
rowpointer

Definition at line 450 of file HT1632_LedMatrix.cpp.

void gotoXY ( int  x,
int  y 
)

Set cursor position.

Parameters:
xor column position, 0 is to left
yor row position, 0 is at top

Definition at line 438 of file HT1632_LedMatrix.cpp.

void init ( uint8_t  xDevices,
uint8_t  yDevices,
uint8_t  displayType = HT1632_08x32 
)

Initialise the library with the display configuration.

Parameters:
Numberof horizontal displays, max 4
Numberof vertical displays, max 4
Typeof displays being used, either 32x8 or 24x16

Definition at line 117 of file HT1632_LedMatrix.cpp.

void plot ( int  x,
int  y,
char  val 
)

Plot a point on the display, with the upper left hand corner being (0,0), and the lower right hand corner being (xMax-1, yMax-1).

Note that Y increases going "downward" in contrast with most mathematical coordiate systems, but in common with many displays basic bounds checking used.

Parameters:
column
row
pointon or off

Definition at line 470 of file HT1632_LedMatrix.cpp.

uint8_t putChar ( int  x,
int  y,
char  c 
)

Copy a character glyph from the font data structure to display memory, with its upper left at the given coordinate This is unoptimized and simply uses plot() to draw each dot.

returns number of columns that didn't fit

Parameters:
column
row
characterto write
Returns:
the number of columns that couldnt be displayed on current matrix

Definition at line 352 of file HT1632_LedMatrix.cpp.

void putShadowRam (  )

Write shaddow ram to display.

Definition at line 523 of file HT1632_LedMatrix.cpp.

void putShadowRam ( uint8_t  chipno )

Write shadow ram to a specific dasipaly board.

Parameters:
chipor display number

Definition at line 529 of file HT1632_LedMatrix.cpp.

void putString ( int  x,
int  y,
char *  str 
)

Write a string at the position specified x and y start from 0 and count number of pixels, 2nd row on a 2 row display is y=8.

Parameters:
xposition
yposition
pointerto character data to display

Definition at line 327 of file HT1632_LedMatrix.cpp.

void scrollLeft ( uint8_t  numberCols,
uint8_t  lineNum 
)

Scroll row to the left.

Parameters:
numberfo columns to scroll
rownumber to scroll, used when displays are stacked vertically or when more than 8 high displays are used

Definition at line 510 of file HT1632_LedMatrix.cpp.

void setBrightness ( unsigned char  brightness )

Set display brightness.

Brighness is from 0 to 15

Parameters:
brightnessvalue, range x-y

Definition at line 281 of file HT1632_LedMatrix.cpp.

void setCustomChar ( int  charNum,
unsigned char  cgchar[],
uint8_t  numCols 
)

Create a custom character.

8 character slots are availabe.

Parameters:
characternumber, 0 to 7
arrayof character bit maps
widthof chaaracter in columns

Definition at line 500 of file HT1632_LedMatrix.cpp.

void setCustomChar ( int  charNum,
unsigned char  cgchar[] 
)

Create a custom character.

8 character slots are availabe.

Parameters:
characternumber, 0 to 7
arrayof character bit maps

Definition at line 491 of file HT1632_LedMatrix.cpp.

void shiftCursorX ( int  xinc )

Shift cursor X position a number of positions either left or right.

Parameters:
increment,-1for one position left, 1 for right

Definition at line 457 of file HT1632_LedMatrix.cpp.

void write ( uint8_t  c )

Copy a character glyph from the font data structure to display memory, with its upper left at the given coordinate This is a wrapper for putChar that uses current cursor position.

Definition at line 341 of file HT1632_LedMatrix.cpp.