Library for Sure Electronics HT1632 based LED matrix displays. Supports multiple displays connected together.
Dependents: HT1632MsgScroller SMS_LEDMatrixPrinter
HT1632_LedMatrix.h@9:8a3c981babd9, 2012-11-28 (annotated)
- Committer:
- SomeRandomBloke
- Date:
- Wed Nov 28 14:03:35 2012 +0000
- Revision:
- 9:8a3c981babd9
- Parent:
- 6:80f554fd77a0
- Child:
- 10:af973a9c48b2
Added documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SomeRandomBloke | 6:80f554fd77a0 | 1 | /** Library for Holtek HT1632 LED driver chip, |
SomeRandomBloke | 6:80f554fd77a0 | 2 | * As implemented on the Sure Electronics DE-DP10X display board |
SomeRandomBloke | 6:80f554fd77a0 | 3 | * 8 x 32 dot matrix LED module.) |
SomeRandomBloke | 6:80f554fd77a0 | 4 | * |
SomeRandomBloke | 6:80f554fd77a0 | 5 | * Original code by: |
SomeRandomBloke | 6:80f554fd77a0 | 6 | * Nov, 2008 by Bill Westfield ("WestfW") |
SomeRandomBloke | 6:80f554fd77a0 | 7 | * Copyrighted and distributed under the terms of the Berkely license |
SomeRandomBloke | 6:80f554fd77a0 | 8 | * (copy freely, but include this notice of original author.) |
SomeRandomBloke | 6:80f554fd77a0 | 9 | * |
SomeRandomBloke | 6:80f554fd77a0 | 10 | * Adapted for 8x32 display by FlorinC. |
SomeRandomBloke | 6:80f554fd77a0 | 11 | * |
SomeRandomBloke | 6:80f554fd77a0 | 12 | * Arduino Library Created and updated by Andrew Lindsay October/November 2009 |
SomeRandomBloke | 6:80f554fd77a0 | 13 | * |
SomeRandomBloke | 6:80f554fd77a0 | 14 | * Ported to Mbed platform by Andrew Lindsay, November 2012 |
SomeRandomBloke | 6:80f554fd77a0 | 15 | * |
SomeRandomBloke | 6:80f554fd77a0 | 16 | * @author Andrew Lindsay |
SomeRandomBloke | 6:80f554fd77a0 | 17 | * |
SomeRandomBloke | 6:80f554fd77a0 | 18 | * @section LICENSE |
SomeRandomBloke | 6:80f554fd77a0 | 19 | * |
SomeRandomBloke | 6:80f554fd77a0 | 20 | * Copyright (c) 2012 Andrew Lindsay (andrew [at] thiseldo [dot] co [dot] uk) |
SomeRandomBloke | 6:80f554fd77a0 | 21 | * |
SomeRandomBloke | 6:80f554fd77a0 | 22 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
SomeRandomBloke | 6:80f554fd77a0 | 23 | * of this software and associated documentation files (the "Software"), to deal |
SomeRandomBloke | 6:80f554fd77a0 | 24 | * in the Software without restriction, including without limitation the rights |
SomeRandomBloke | 6:80f554fd77a0 | 25 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
SomeRandomBloke | 6:80f554fd77a0 | 26 | * copies of the Software, and to permit persons to whom the Software is |
SomeRandomBloke | 6:80f554fd77a0 | 27 | * furnished to do so, subject to the following conditions: |
SomeRandomBloke | 6:80f554fd77a0 | 28 | |
SomeRandomBloke | 6:80f554fd77a0 | 29 | * The above copyright notice and this permission notice shall be included in |
SomeRandomBloke | 6:80f554fd77a0 | 30 | * all copies or substantial portions of the Software. |
SomeRandomBloke | 6:80f554fd77a0 | 31 | * |
SomeRandomBloke | 6:80f554fd77a0 | 32 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
SomeRandomBloke | 6:80f554fd77a0 | 33 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
SomeRandomBloke | 6:80f554fd77a0 | 34 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
SomeRandomBloke | 6:80f554fd77a0 | 35 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
SomeRandomBloke | 6:80f554fd77a0 | 36 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
SomeRandomBloke | 6:80f554fd77a0 | 37 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
SomeRandomBloke | 6:80f554fd77a0 | 38 | * THE SOFTWARE. |
SomeRandomBloke | 6:80f554fd77a0 | 39 | * |
SomeRandomBloke | 6:80f554fd77a0 | 40 | * @section DESCRIPTION |
SomeRandomBloke | 6:80f554fd77a0 | 41 | * Definitions for Holtek HT1632 LED driver |
SomeRandomBloke | 6:80f554fd77a0 | 42 | * |
SomeRandomBloke | 6:80f554fd77a0 | 43 | */ |
SomeRandomBloke | 4:7513dd37efed | 44 | |
SomeRandomBloke | 4:7513dd37efed | 45 | #ifndef _HT1632_LEDMATRIX_H |
SomeRandomBloke | 4:7513dd37efed | 46 | #define _HT1632_LEDMATRIX_H |
SomeRandomBloke | 4:7513dd37efed | 47 | |
SomeRandomBloke | 9:8a3c981babd9 | 48 | #include <inttypes.h> |
SomeRandomBloke | 9:8a3c981babd9 | 49 | |
SomeRandomBloke | 6:80f554fd77a0 | 50 | // To include the graphic functions use the following. Comment out to exclude them |
SomeRandomBloke | 4:7513dd37efed | 51 | #define USE_GRAPHIC |
SomeRandomBloke | 4:7513dd37efed | 52 | |
SomeRandomBloke | 9:8a3c981babd9 | 53 | // Defines for display sizes |
SomeRandomBloke | 9:8a3c981babd9 | 54 | #define HT1632_32x08 1 |
SomeRandomBloke | 9:8a3c981babd9 | 55 | #define HT1632_24x16 2 |
SomeRandomBloke | 4:7513dd37efed | 56 | |
SomeRandomBloke | 4:7513dd37efed | 57 | /* |
SomeRandomBloke | 4:7513dd37efed | 58 | * commands written to the chip consist of a 3 bit "ID", followed by |
SomeRandomBloke | 4:7513dd37efed | 59 | * either 9 bits of "Command code" or 7 bits of address + 4 bits of data. |
SomeRandomBloke | 4:7513dd37efed | 60 | */ |
SomeRandomBloke | 4:7513dd37efed | 61 | #define HT1632_ID_CMD 4 /* ID = 100 - Commands */ |
SomeRandomBloke | 4:7513dd37efed | 62 | #define HT1632_ID_RD 6 /* ID = 110 - Read RAM */ |
SomeRandomBloke | 4:7513dd37efed | 63 | #define HT1632_ID_WR 5 /* ID = 101 - Write RAM */ |
SomeRandomBloke | 4:7513dd37efed | 64 | |
SomeRandomBloke | 4:7513dd37efed | 65 | #define HT1632_CMD_SYSDIS 0x00 /* CMD= 0000-0000-x Turn off oscil */ |
SomeRandomBloke | 4:7513dd37efed | 66 | #define HT1632_CMD_SYSON 0x01 /* CMD= 0000-0001-x Enable system oscil */ |
SomeRandomBloke | 4:7513dd37efed | 67 | #define HT1632_CMD_LEDOFF 0x02 /* CMD= 0000-0010-x LED duty cycle gen off */ |
SomeRandomBloke | 4:7513dd37efed | 68 | #define HT1632_CMD_LEDON 0x03 /* CMD= 0000-0011-x LEDs ON */ |
SomeRandomBloke | 4:7513dd37efed | 69 | #define HT1632_CMD_BLOFF 0x08 /* CMD= 0000-1000-x Blink ON */ |
SomeRandomBloke | 4:7513dd37efed | 70 | #define HT1632_CMD_BLON 0x09 /* CMD= 0000-1001-x Blink Off */ |
SomeRandomBloke | 4:7513dd37efed | 71 | #define HT1632_CMD_SLVMD 0x10 /* CMD= 0001-00xx-x Slave Mode */ |
SomeRandomBloke | 4:7513dd37efed | 72 | #define HT1632_CMD_MSTMD 0x14 /* CMD= 0001-01xx-x Master Mode */ |
SomeRandomBloke | 4:7513dd37efed | 73 | #define HT1632_CMD_RCCLK 0x18 /* CMD= 0001-10xx-x Use on-chip clock */ |
SomeRandomBloke | 4:7513dd37efed | 74 | #define HT1632_CMD_EXTCLK 0x1C /* CMD= 0001-11xx-x Use external clock */ |
SomeRandomBloke | 4:7513dd37efed | 75 | #define HT1632_CMD_COMS00 0x20 /* CMD= 0010-ABxx-x commons options */ |
SomeRandomBloke | 4:7513dd37efed | 76 | #define HT1632_CMD_COMS01 0x24 /* CMD= 0010-ABxx-x commons options */ |
SomeRandomBloke | 4:7513dd37efed | 77 | #define HT1632_CMD_COMS10 0x28 /* CMD= 0010-ABxx-x commons options */ |
SomeRandomBloke | 4:7513dd37efed | 78 | #define HT1632_CMD_COMS11 0x2C /* CMD= 0010-ABxx-x commons options */ |
SomeRandomBloke | 4:7513dd37efed | 79 | #define HT1632_CMD_PWM 0xA0 /* CMD= 101x-PPPP-x PWM duty cycle */ |
SomeRandomBloke | 4:7513dd37efed | 80 | |
SomeRandomBloke | 4:7513dd37efed | 81 | #define PIXEL_OFF 0 |
SomeRandomBloke | 4:7513dd37efed | 82 | #define PIXEL_ON 1 |
SomeRandomBloke | 4:7513dd37efed | 83 | |
SomeRandomBloke | 6:80f554fd77a0 | 84 | /** class HT1632_LedMatrix |
SomeRandomBloke | 6:80f554fd77a0 | 85 | */ |
SomeRandomBloke | 9:8a3c981babd9 | 86 | class HT1632_LedMatrix |
SomeRandomBloke | 4:7513dd37efed | 87 | { |
SomeRandomBloke | 4:7513dd37efed | 88 | private: |
SomeRandomBloke | 9:8a3c981babd9 | 89 | /** Select a specific display, numbers as 0 to 3 |
SomeRandomBloke | 6:80f554fd77a0 | 90 | * |
SomeRandomBloke | 6:80f554fd77a0 | 91 | * @param chip number |
SomeRandomBloke | 6:80f554fd77a0 | 92 | */ |
SomeRandomBloke | 4:7513dd37efed | 93 | void chipselect( uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 94 | /** Deselect a specific display, numbers as 0 to 3 |
SomeRandomBloke | 9:8a3c981babd9 | 95 | * |
SomeRandomBloke | 9:8a3c981babd9 | 96 | * @param chip number |
SomeRandomBloke | 9:8a3c981babd9 | 97 | */ |
SomeRandomBloke | 4:7513dd37efed | 98 | void chipfree( uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 99 | |
SomeRandomBloke | 9:8a3c981babd9 | 100 | /** Write bits to HT1632 on pins HT1632_DATA, HT1632_WRCLK |
SomeRandomBloke | 9:8a3c981babd9 | 101 | * Chip is assumed to already be chip-selected |
SomeRandomBloke | 9:8a3c981babd9 | 102 | * Bits are shifted out from MSB to LSB, with the first bit sent |
SomeRandomBloke | 9:8a3c981babd9 | 103 | * being (bits & firstbit), shifted till firsbit is zero. |
SomeRandomBloke | 9:8a3c981babd9 | 104 | * @param bits |
SomeRandomBloke | 9:8a3c981babd9 | 105 | * @param firstbit |
SomeRandomBloke | 9:8a3c981babd9 | 106 | */ |
SomeRandomBloke | 4:7513dd37efed | 107 | void writebits( uint8_t, uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 108 | |
SomeRandomBloke | 9:8a3c981babd9 | 109 | /** Write databits to HT1632 on pins HT1632_DATA, HT1632_WRCLK |
SomeRandomBloke | 9:8a3c981babd9 | 110 | * Chip is assumed to already be chip-selected |
SomeRandomBloke | 9:8a3c981babd9 | 111 | * Bits are shifted out from LSB to MSB |
SomeRandomBloke | 9:8a3c981babd9 | 112 | * @param bits |
SomeRandomBloke | 9:8a3c981babd9 | 113 | * @param count |
SomeRandomBloke | 9:8a3c981babd9 | 114 | */ |
SomeRandomBloke | 4:7513dd37efed | 115 | void writedatabits( uint8_t, uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 116 | |
SomeRandomBloke | 9:8a3c981babd9 | 117 | /** * Send a command to the ht1632 chip. |
SomeRandomBloke | 9:8a3c981babd9 | 118 | * A command consists of a 3-bit "CMD" ID, an 8bit command, and |
SomeRandomBloke | 9:8a3c981babd9 | 119 | * one "don't care bit". |
SomeRandomBloke | 9:8a3c981babd9 | 120 | * Select 1 0 0 c7 c6 c5 c4 c3 c2 c1 c0 xx Free |
SomeRandomBloke | 9:8a3c981babd9 | 121 | * @param chipno the number of the chip/display to write command to |
SomeRandomBloke | 9:8a3c981babd9 | 122 | * @param command to send |
SomeRandomBloke | 9:8a3c981babd9 | 123 | */ |
SomeRandomBloke | 4:7513dd37efed | 124 | void sendcmd( uint8_t, uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 125 | |
SomeRandomBloke | 9:8a3c981babd9 | 126 | /** Send a nibble (4 bits) of data to a particular memory location of the |
SomeRandomBloke | 9:8a3c981babd9 | 127 | * ht1632. The command has 3 bit ID, 7 bits of address, and 4 bits of data. |
SomeRandomBloke | 9:8a3c981babd9 | 128 | * Select 1 0 1 A6 A5 A4 A3 A2 A1 A0 D0 D1 D2 D3 Free |
SomeRandomBloke | 9:8a3c981babd9 | 129 | * Note that the address is sent MSB first, while the data is sent LSB first! |
SomeRandomBloke | 9:8a3c981babd9 | 130 | * This means that somewhere a bit reversal will have to be done to get |
SomeRandomBloke | 9:8a3c981babd9 | 131 | * zero-based addressing of words and dots within words. |
SomeRandomBloke | 9:8a3c981babd9 | 132 | * @param chipno |
SomeRandomBloke | 9:8a3c981babd9 | 133 | * @param address |
SomeRandomBloke | 9:8a3c981babd9 | 134 | * @param data |
SomeRandomBloke | 9:8a3c981babd9 | 135 | */ |
SomeRandomBloke | 4:7513dd37efed | 136 | void senddata( uint8_t, uint8_t, uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 137 | |
SomeRandomBloke | 9:8a3c981babd9 | 138 | /** Send a byte of data to a particular memory location of the |
SomeRandomBloke | 9:8a3c981babd9 | 139 | * ht1632. The command has 3 bit ID, 7 bits of address, and 8 bits of data. |
SomeRandomBloke | 9:8a3c981babd9 | 140 | * Select 1 0 1 A6 A5 A4 A3 A2 A1 A0 D0 D1 D2 D3 D4 D5 D6 D7 D8 Free |
SomeRandomBloke | 9:8a3c981babd9 | 141 | * Note that the address is sent MSB first, while the data is sent LSB first! |
SomeRandomBloke | 9:8a3c981babd9 | 142 | * This means that somewhere a bit reversal will have to be done to get |
SomeRandomBloke | 9:8a3c981babd9 | 143 | * zero-based addressing of words and dots within words. |
SomeRandomBloke | 9:8a3c981babd9 | 144 | * @param chipno |
SomeRandomBloke | 9:8a3c981babd9 | 145 | * @param address |
SomeRandomBloke | 9:8a3c981babd9 | 146 | * @param data |
SomeRandomBloke | 9:8a3c981babd9 | 147 | */ |
SomeRandomBloke | 4:7513dd37efed | 148 | void sendcol( uint8_t, uint8_t, uint8_t ); |
SomeRandomBloke | 4:7513dd37efed | 149 | |
SomeRandomBloke | 4:7513dd37efed | 150 | public: |
SomeRandomBloke | 9:8a3c981babd9 | 151 | /** Default Constructor for the display driver |
SomeRandomBloke | 6:80f554fd77a0 | 152 | */ |
SomeRandomBloke | 4:7513dd37efed | 153 | HT1632_LedMatrix( ); |
SomeRandomBloke | 4:7513dd37efed | 154 | |
SomeRandomBloke | 9:8a3c981babd9 | 155 | /** Initialise the library with the display configuration |
SomeRandomBloke | 9:8a3c981babd9 | 156 | * @param Number of horizontal displays, max 4 |
SomeRandomBloke | 9:8a3c981babd9 | 157 | * @param Number of vertical displays, max 4 |
SomeRandomBloke | 9:8a3c981babd9 | 158 | * @param Type of displays being used, either 32x8 or 24x16 |
SomeRandomBloke | 9:8a3c981babd9 | 159 | */ |
SomeRandomBloke | 9:8a3c981babd9 | 160 | void init( uint8_t, uint8_t, uint8_t displayType = HT1632_32x08 ); |
SomeRandomBloke | 9:8a3c981babd9 | 161 | |
SomeRandomBloke | 9:8a3c981babd9 | 162 | /** Turn off the display |
SomeRandomBloke | 9:8a3c981babd9 | 163 | */ |
SomeRandomBloke | 9:8a3c981babd9 | 164 | void displayOff( void ); |
SomeRandomBloke | 9:8a3c981babd9 | 165 | |
SomeRandomBloke | 9:8a3c981babd9 | 166 | /** Turn on the display |
SomeRandomBloke | 9:8a3c981babd9 | 167 | */ |
SomeRandomBloke | 9:8a3c981babd9 | 168 | void displayOn( void ); |
SomeRandomBloke | 9:8a3c981babd9 | 169 | |
SomeRandomBloke | 9:8a3c981babd9 | 170 | /** Clear the display, and the shadow memory, and the snapshot |
SomeRandomBloke | 9:8a3c981babd9 | 171 | * memory. This uses the "write multiple words" capability of |
SomeRandomBloke | 9:8a3c981babd9 | 172 | * the chipset by writing all 96 words of memory without raising |
SomeRandomBloke | 9:8a3c981babd9 | 173 | * the chipselect signal. |
SomeRandomBloke | 9:8a3c981babd9 | 174 | */ |
SomeRandomBloke | 4:7513dd37efed | 175 | void clear(void); |
SomeRandomBloke | 9:8a3c981babd9 | 176 | |
SomeRandomBloke | 9:8a3c981babd9 | 177 | /** Set display brightness. Brighness is from 0 to 15 |
SomeRandomBloke | 9:8a3c981babd9 | 178 | * @param brightness value, range x-y |
SomeRandomBloke | 9:8a3c981babd9 | 179 | */ |
SomeRandomBloke | 4:7513dd37efed | 180 | void setBrightness( unsigned char ); |
SomeRandomBloke | 9:8a3c981babd9 | 181 | |
SomeRandomBloke | 9:8a3c981babd9 | 182 | /** Copy a character glyph from the font data structure to |
SomeRandomBloke | 9:8a3c981babd9 | 183 | * display memory, with its upper left at the given coordinate |
SomeRandomBloke | 9:8a3c981babd9 | 184 | * This is unoptimized and simply uses plot() to draw each dot. |
SomeRandomBloke | 9:8a3c981babd9 | 185 | * returns number of columns that didn't fit |
SomeRandomBloke | 9:8a3c981babd9 | 186 | * @param column |
SomeRandomBloke | 9:8a3c981babd9 | 187 | * @param row |
SomeRandomBloke | 9:8a3c981babd9 | 188 | * @param character to write |
SomeRandomBloke | 9:8a3c981babd9 | 189 | * @returns the number of columns that couldnt be displayed on current matrix |
SomeRandomBloke | 9:8a3c981babd9 | 190 | */ |
SomeRandomBloke | 4:7513dd37efed | 191 | uint8_t putChar( int, int, char ); |
SomeRandomBloke | 9:8a3c981babd9 | 192 | |
SomeRandomBloke | 9:8a3c981babd9 | 193 | /** Copy a character glyph from the font data structure to |
SomeRandomBloke | 9:8a3c981babd9 | 194 | * display memory, with its upper left at the given coordinate |
SomeRandomBloke | 9:8a3c981babd9 | 195 | * This is a wrapper for putChar that uses current cursor position |
SomeRandomBloke | 9:8a3c981babd9 | 196 | */ |
SomeRandomBloke | 4:7513dd37efed | 197 | void write( uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 198 | |
SomeRandomBloke | 9:8a3c981babd9 | 199 | /** Write a string at the position specified |
SomeRandomBloke | 9:8a3c981babd9 | 200 | * x and y start from 0 and count number of pixels, 2nd row on a 2 row display is y=8 |
SomeRandomBloke | 9:8a3c981babd9 | 201 | * @param x position |
SomeRandomBloke | 9:8a3c981babd9 | 202 | * @param y position |
SomeRandomBloke | 9:8a3c981babd9 | 203 | * @param pointer to character data to display |
SomeRandomBloke | 9:8a3c981babd9 | 204 | */ |
SomeRandomBloke | 4:7513dd37efed | 205 | void putString( int, int, char* ); |
SomeRandomBloke | 9:8a3c981babd9 | 206 | |
SomeRandomBloke | 9:8a3c981babd9 | 207 | /** Plot a point on the display, with the upper left hand corner |
SomeRandomBloke | 9:8a3c981babd9 | 208 | * being (0,0), and the lower right hand corner being (xMax-1, yMax-1). |
SomeRandomBloke | 9:8a3c981babd9 | 209 | * Note that Y increases going "downward" in contrast with most |
SomeRandomBloke | 9:8a3c981babd9 | 210 | * mathematical coordiate systems, but in common with many displays |
SomeRandomBloke | 9:8a3c981babd9 | 211 | * basic bounds checking used. |
SomeRandomBloke | 9:8a3c981babd9 | 212 | * @param column |
SomeRandomBloke | 9:8a3c981babd9 | 213 | * @param row |
SomeRandomBloke | 9:8a3c981babd9 | 214 | * @param point on or off |
SomeRandomBloke | 9:8a3c981babd9 | 215 | */ |
SomeRandomBloke | 4:7513dd37efed | 216 | void plot( int, int, char ); |
SomeRandomBloke | 9:8a3c981babd9 | 217 | |
SomeRandomBloke | 9:8a3c981babd9 | 218 | /** Set cursor position |
SomeRandomBloke | 9:8a3c981babd9 | 219 | * @param x or column position, 0 is to left |
SomeRandomBloke | 9:8a3c981babd9 | 220 | * @param y or row position, 0 is at top |
SomeRandomBloke | 9:8a3c981babd9 | 221 | */ |
SomeRandomBloke | 4:7513dd37efed | 222 | void gotoXY(int , int); |
SomeRandomBloke | 9:8a3c981babd9 | 223 | |
SomeRandomBloke | 9:8a3c981babd9 | 224 | /** Return the current cursor position |
SomeRandomBloke | 9:8a3c981babd9 | 225 | * @param column pointer |
SomeRandomBloke | 9:8a3c981babd9 | 226 | * @param row pointer |
SomeRandomBloke | 9:8a3c981babd9 | 227 | */ |
SomeRandomBloke | 4:7513dd37efed | 228 | void getXY(int* , int*); |
SomeRandomBloke | 9:8a3c981babd9 | 229 | |
SomeRandomBloke | 9:8a3c981babd9 | 230 | /** Return the maximum size of the display |
SomeRandomBloke | 9:8a3c981babd9 | 231 | * @param column pointer |
SomeRandomBloke | 9:8a3c981babd9 | 232 | * @param row pointer |
SomeRandomBloke | 9:8a3c981babd9 | 233 | */ |
SomeRandomBloke | 4:7513dd37efed | 234 | void getXYMax(int*, int*); |
SomeRandomBloke | 9:8a3c981babd9 | 235 | |
SomeRandomBloke | 9:8a3c981babd9 | 236 | /** Shift cursor X position a number of positions either left or right. |
SomeRandomBloke | 9:8a3c981babd9 | 237 | * @param increment, -1 for one position left, 1 for right |
SomeRandomBloke | 9:8a3c981babd9 | 238 | */ |
SomeRandomBloke | 4:7513dd37efed | 239 | void shiftCursorX(int ); |
SomeRandomBloke | 9:8a3c981babd9 | 240 | |
SomeRandomBloke | 9:8a3c981babd9 | 241 | /** Create a custom character. 8 character slots are availabe. |
SomeRandomBloke | 9:8a3c981babd9 | 242 | * @param character number, 0 to 7 |
SomeRandomBloke | 9:8a3c981babd9 | 243 | * @param array of character bit maps |
SomeRandomBloke | 9:8a3c981babd9 | 244 | */ |
SomeRandomBloke | 4:7513dd37efed | 245 | void setCustomChar( int, unsigned char[]); |
SomeRandomBloke | 9:8a3c981babd9 | 246 | |
SomeRandomBloke | 9:8a3c981babd9 | 247 | /** Create a custom character. 8 character slots are availabe. |
SomeRandomBloke | 9:8a3c981babd9 | 248 | * @param character number, 0 to 7 |
SomeRandomBloke | 9:8a3c981babd9 | 249 | * @param array of character bit maps |
SomeRandomBloke | 9:8a3c981babd9 | 250 | * @param width of chaaracter in columns |
SomeRandomBloke | 9:8a3c981babd9 | 251 | */ |
SomeRandomBloke | 4:7513dd37efed | 252 | void setCustomChar( int, unsigned char[], uint8_t ); |
SomeRandomBloke | 9:8a3c981babd9 | 253 | |
SomeRandomBloke | 9:8a3c981babd9 | 254 | /** Scroll row to the left |
SomeRandomBloke | 9:8a3c981babd9 | 255 | * @param number fo columns to scroll |
SomeRandomBloke | 9:8a3c981babd9 | 256 | * @param row number to scroll, used when displays are stacked vertically or when more than 8 high displays are used |
SomeRandomBloke | 9:8a3c981babd9 | 257 | */ |
SomeRandomBloke | 4:7513dd37efed | 258 | void scrollLeft(uint8_t, uint8_t); |
SomeRandomBloke | 9:8a3c981babd9 | 259 | |
SomeRandomBloke | 9:8a3c981babd9 | 260 | /** Write shaddow ram to display |
SomeRandomBloke | 9:8a3c981babd9 | 261 | */ |
SomeRandomBloke | 4:7513dd37efed | 262 | void putShadowRam(); |
SomeRandomBloke | 9:8a3c981babd9 | 263 | |
SomeRandomBloke | 9:8a3c981babd9 | 264 | /** Write shadow ram to a specific dasipaly board |
SomeRandomBloke | 9:8a3c981babd9 | 265 | * @param chip or display number |
SomeRandomBloke | 9:8a3c981babd9 | 266 | */ |
SomeRandomBloke | 4:7513dd37efed | 267 | void putShadowRam(uint8_t); |
SomeRandomBloke | 4:7513dd37efed | 268 | // Graphic functions |
SomeRandomBloke | 4:7513dd37efed | 269 | #ifdef USE_GRAPHIC |
SomeRandomBloke | 9:8a3c981babd9 | 270 | |
SomeRandomBloke | 9:8a3c981babd9 | 271 | /** Draws a line between two points on the display |
SomeRandomBloke | 9:8a3c981babd9 | 272 | * @param start column |
SomeRandomBloke | 9:8a3c981babd9 | 273 | * @param start row |
SomeRandomBloke | 9:8a3c981babd9 | 274 | * @param end column |
SomeRandomBloke | 9:8a3c981babd9 | 275 | * @param end row |
SomeRandomBloke | 9:8a3c981babd9 | 276 | * @param point on or off, off to erase, on to draw |
SomeRandomBloke | 9:8a3c981babd9 | 277 | */ |
SomeRandomBloke | 4:7513dd37efed | 278 | void drawLine(unsigned char x1, unsigned char y1, |
SomeRandomBloke | 4:7513dd37efed | 279 | unsigned char x2, unsigned char y2, unsigned char c); |
SomeRandomBloke | 9:8a3c981babd9 | 280 | |
SomeRandomBloke | 9:8a3c981babd9 | 281 | /** Draw a rectangle given to top left and bottom right points |
SomeRandomBloke | 9:8a3c981babd9 | 282 | * @param top left column |
SomeRandomBloke | 9:8a3c981babd9 | 283 | * @param top left row |
SomeRandomBloke | 9:8a3c981babd9 | 284 | * @param bottom right column |
SomeRandomBloke | 9:8a3c981babd9 | 285 | * @param bottom right row |
SomeRandomBloke | 9:8a3c981babd9 | 286 | * @param point on or off, off to erase, on to draw |
SomeRandomBloke | 9:8a3c981babd9 | 287 | */ |
SomeRandomBloke | 4:7513dd37efed | 288 | void drawRectangle(unsigned char x1, unsigned char y1, |
SomeRandomBloke | 4:7513dd37efed | 289 | unsigned char x2, unsigned char y2, unsigned char c); |
SomeRandomBloke | 9:8a3c981babd9 | 290 | /** Draw a filled rectangle given to top left and bottom right points |
SomeRandomBloke | 9:8a3c981babd9 | 291 | * @param top left column |
SomeRandomBloke | 9:8a3c981babd9 | 292 | * @param top left row |
SomeRandomBloke | 9:8a3c981babd9 | 293 | * @param bottom right column |
SomeRandomBloke | 9:8a3c981babd9 | 294 | * @param bottom right row |
SomeRandomBloke | 9:8a3c981babd9 | 295 | * @param point on or off, off to erase, on to draw |
SomeRandomBloke | 9:8a3c981babd9 | 296 | */ |
SomeRandomBloke | 4:7513dd37efed | 297 | void drawFilledRectangle(unsigned char x1, unsigned char y1, |
SomeRandomBloke | 4:7513dd37efed | 298 | unsigned char x2, unsigned char y2, unsigned char c); |
SomeRandomBloke | 9:8a3c981babd9 | 299 | /** Draw a circle using Bresenham's algorithm. |
SomeRandomBloke | 9:8a3c981babd9 | 300 | * Some small circles will look like squares!! |
SomeRandomBloke | 9:8a3c981babd9 | 301 | * @param centre column |
SomeRandomBloke | 9:8a3c981babd9 | 302 | * @param centre row |
SomeRandomBloke | 9:8a3c981babd9 | 303 | * @param radius |
SomeRandomBloke | 9:8a3c981babd9 | 304 | * @param point on or off, off to erase, on to draw |
SomeRandomBloke | 9:8a3c981babd9 | 305 | */ |
SomeRandomBloke | 4:7513dd37efed | 306 | void drawCircle(unsigned char xc, unsigned char yc, |
SomeRandomBloke | 4:7513dd37efed | 307 | unsigned char r, unsigned char c); |
SomeRandomBloke | 4:7513dd37efed | 308 | #endif |
SomeRandomBloke | 4:7513dd37efed | 309 | |
SomeRandomBloke | 4:7513dd37efed | 310 | }; |
SomeRandomBloke | 4:7513dd37efed | 311 | |
SomeRandomBloke | 4:7513dd37efed | 312 | #endif //_HT1632_LEDMATRIX_H |