Princeton PT6964 LED controller supports 4 Digits @ 13 Segments, 5 Digits @ 12 Segments, 6 Digits @ 11 Segments or 7 Digits @ 10 Segments. Also supports a scanned keyboard of upto 20 keys. SPI bus interface.
Princeton PT6964 LED controller supports 4 Digits @ 13 Segments, 5 Digits @ 12 Segments, 6 Digits @ 11 Segments or 7 Digits @ 10 Segments. Also supports a scanned keyboard of upto 20 keys. SPI bus interface.
See Component page here.
PT6964.h@1:1adf993a3e34, 2016-01-09 (annotated)
- Committer:
- wim
- Date:
- Sat Jan 09 13:40:06 2016 +0000
- Revision:
- 1:1adf993a3e34
- Parent:
- 0:27f32a087e5a
- Child:
- 2:eaf2f5d1af34
Updated Icon handling, UDCs and _putc()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wim | 0:27f32a087e5a | 1 | /* mbed PT6964 Library, for PT6964 LED controller |
wim | 0:27f32a087e5a | 2 | * Copyright (c) 2015, v01: WH, Initial version |
wim | 1:1adf993a3e34 | 3 | * 2015, v02: WH, rename Digit/Grid |
wim | 1:1adf993a3e34 | 4 | * 2016, v03: WH, updated Icon handling, UDCs and _putc() |
wim | 0:27f32a087e5a | 5 | * |
wim | 0:27f32a087e5a | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
wim | 0:27f32a087e5a | 7 | * of this software and associated documentation files (the "Software"), to deal |
wim | 0:27f32a087e5a | 8 | * in the Software without restriction, including without limitation the rights |
wim | 0:27f32a087e5a | 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
wim | 0:27f32a087e5a | 10 | * copies of the Software, and to permit persons to whom the Software is |
wim | 0:27f32a087e5a | 11 | * furnished to do so, subject to the following conditions: |
wim | 0:27f32a087e5a | 12 | * |
wim | 0:27f32a087e5a | 13 | * The above copyright notice and this permission notice shall be included in |
wim | 0:27f32a087e5a | 14 | * all copies or substantial portions of the Software. |
wim | 0:27f32a087e5a | 15 | * |
wim | 0:27f32a087e5a | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
wim | 0:27f32a087e5a | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
wim | 0:27f32a087e5a | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
wim | 0:27f32a087e5a | 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
wim | 0:27f32a087e5a | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
wim | 0:27f32a087e5a | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
wim | 0:27f32a087e5a | 22 | * THE SOFTWARE. |
wim | 0:27f32a087e5a | 23 | */ |
wim | 0:27f32a087e5a | 24 | |
wim | 0:27f32a087e5a | 25 | #ifndef PT6964_H |
wim | 0:27f32a087e5a | 26 | #define PT6964_H |
wim | 0:27f32a087e5a | 27 | |
wim | 0:27f32a087e5a | 28 | #include "Font_7Seg.h" |
wim | 0:27f32a087e5a | 29 | |
wim | 0:27f32a087e5a | 30 | /** An interface for driving PT6964 LED controller |
wim | 0:27f32a087e5a | 31 | * |
wim | 0:27f32a087e5a | 32 | * @code |
wim | 0:27f32a087e5a | 33 | * #include "mbed.h" |
wim | 0:27f32a087e5a | 34 | * #include "PT6964.h" |
wim | 0:27f32a087e5a | 35 | * |
wim | 0:27f32a087e5a | 36 | * DisplayData_t size is 8 bytes (4 grids @ 13 segments) OR 10 bytes (5 grids @ 12 segments) OR |
wim | 0:27f32a087e5a | 37 | * 12 bytes (6 grids @ 11 segments) OR 14 bytes (7 grids @ 10 segments) |
wim | 0:27f32a087e5a | 38 | * PT6964::DisplayData_t mbed_str = {0xDA,0x00, 0x7C,0x00, 0x3C,0x01, 0xF6,0x00, 0x00,0x00, 0x00,0x00, 0x00,0x00}; |
wim | 0:27f32a087e5a | 39 | * PT6964::DisplayData_t all_str = {0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F, 0xFF,0x0F}; |
wim | 0:27f32a087e5a | 40 | * |
wim | 0:27f32a087e5a | 41 | * // KeyData_t size is 5 bytes |
wim | 0:27f32a087e5a | 42 | * PT6964::KeyData_t keydata; |
wim | 0:27f32a087e5a | 43 | * |
wim | 0:27f32a087e5a | 44 | * // PT6964 declaration, Default setting 7 Grids @ 10 Segments |
wim | 0:27f32a087e5a | 45 | * PT6964 PT6964(p5,p6,p7, p8); |
wim | 0:27f32a087e5a | 46 | * |
wim | 0:27f32a087e5a | 47 | * int main() { |
wim | 0:27f32a087e5a | 48 | * PT6964.cls(); |
wim | 0:27f32a087e5a | 49 | * PT6964.writeData(all_str); |
wim | 0:27f32a087e5a | 50 | * wait(4); |
wim | 0:27f32a087e5a | 51 | * PT6964.writeData(mbed_str); |
wim | 0:27f32a087e5a | 52 | * wait(1); |
wim | 0:27f32a087e5a | 53 | * PT6964.setBrightness(PT6964_BRT0); |
wim | 0:27f32a087e5a | 54 | * wait(1); |
wim | 0:27f32a087e5a | 55 | * PT6964.setBrightness(PT6964_BRT3); |
wim | 0:27f32a087e5a | 56 | * |
wim | 0:27f32a087e5a | 57 | * while (1) { |
wim | 0:27f32a087e5a | 58 | * // Check and read keydata |
wim | 0:27f32a087e5a | 59 | * if (PT6964.getKeys(&keydata)) { |
wim | 0:27f32a087e5a | 60 | * pc.printf("Keydata 0..4 = 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\r\n", keydata[0], keydata[1], keydata[2], keydata[3], keydata[4]); |
wim | 0:27f32a087e5a | 61 | * |
wim | 0:27f32a087e5a | 62 | * if (keydata[0] == 0x10) { //sw2 |
wim | 0:27f32a087e5a | 63 | * PT6964.cls(); |
wim | 0:27f32a087e5a | 64 | * PT6964.writeData(all_str); |
wim | 0:27f32a087e5a | 65 | * } |
wim | 0:27f32a087e5a | 66 | * } |
wim | 0:27f32a087e5a | 67 | * } |
wim | 0:27f32a087e5a | 68 | * } |
wim | 0:27f32a087e5a | 69 | * @endcode |
wim | 0:27f32a087e5a | 70 | */ |
wim | 0:27f32a087e5a | 71 | |
wim | 0:27f32a087e5a | 72 | //Memory size in bytes for Display and Keymatrix |
wim | 0:27f32a087e5a | 73 | #define PT6964_DISPLAY_MEM 14 |
wim | 0:27f32a087e5a | 74 | #define PT6964_KEY_MEM 5 |
wim | 0:27f32a087e5a | 75 | //Significant bits Keymatrix data |
wim | 0:27f32a087e5a | 76 | #define PT6964_KEY_BITS 5 |
wim | 0:27f32a087e5a | 77 | |
wim | 0:27f32a087e5a | 78 | //Reserved bits for commands |
wim | 0:27f32a087e5a | 79 | #define PT6964_CMD_MSK 0xC0 |
wim | 0:27f32a087e5a | 80 | |
wim | 0:27f32a087e5a | 81 | //Mode setting command |
wim | 0:27f32a087e5a | 82 | #define PT6964_MODE_SET_CMD 0x00 |
wim | 0:27f32a087e5a | 83 | #define PT6964_GR4_SEG13 0x00 |
wim | 0:27f32a087e5a | 84 | #define PT6964_GR5_SEG12 0x01 |
wim | 0:27f32a087e5a | 85 | #define PT6964_GR6_SEG11 0x02 |
wim | 0:27f32a087e5a | 86 | #define PT6964_GR7_SEG10 0x03 //default |
wim | 0:27f32a087e5a | 87 | |
wim | 0:27f32a087e5a | 88 | //Data setting commands |
wim | 0:27f32a087e5a | 89 | #define PT6964_DATA_SET_CMD 0x40 |
wim | 0:27f32a087e5a | 90 | #define PT6964_DATA_WR 0x00 |
wim | 0:27f32a087e5a | 91 | #define PT6964_KEY_RD 0x02 |
wim | 0:27f32a087e5a | 92 | #define PT6964_ADDR_INC 0x00 |
wim | 0:27f32a087e5a | 93 | #define PT6964_ADDR_FIXED 0x04 |
wim | 0:27f32a087e5a | 94 | #define PT6964_MODE_NORM 0x00 |
wim | 0:27f32a087e5a | 95 | #define PT6964_MODE_TEST 0x08 |
wim | 0:27f32a087e5a | 96 | |
wim | 0:27f32a087e5a | 97 | //Address setting commands |
wim | 0:27f32a087e5a | 98 | #define PT6964_ADDR_SET_CMD 0xC0 |
wim | 0:27f32a087e5a | 99 | #define PT6964_ADDR_MSK 0x0F |
wim | 0:27f32a087e5a | 100 | |
wim | 0:27f32a087e5a | 101 | //Display control commands |
wim | 0:27f32a087e5a | 102 | #define PT6964_DSP_CTRL_CMD 0x80 |
wim | 0:27f32a087e5a | 103 | #define PT6964_BRT_MSK 0x07 |
wim | 0:27f32a087e5a | 104 | #define PT6964_BRT0 0x00 //Pulsewidth 1/16 |
wim | 0:27f32a087e5a | 105 | #define PT6964_BRT1 0x01 |
wim | 0:27f32a087e5a | 106 | #define PT6964_BRT2 0x02 |
wim | 0:27f32a087e5a | 107 | #define PT6964_BRT3 0x03 |
wim | 0:27f32a087e5a | 108 | #define PT6964_BRT4 0x04 |
wim | 0:27f32a087e5a | 109 | #define PT6964_BRT5 0x05 |
wim | 0:27f32a087e5a | 110 | #define PT6964_BRT6 0x06 |
wim | 0:27f32a087e5a | 111 | #define PT6964_BRT7 0x07 //Pulsewidth 14/16 |
wim | 0:27f32a087e5a | 112 | |
wim | 0:27f32a087e5a | 113 | #define PT6964_BRT_DEF PT6964_BRT3 |
wim | 0:27f32a087e5a | 114 | |
wim | 0:27f32a087e5a | 115 | #define PT6964_DSP_OFF 0x00 |
wim | 0:27f32a087e5a | 116 | #define PT6964_DSP_ON 0x08 |
wim | 0:27f32a087e5a | 117 | |
wim | 0:27f32a087e5a | 118 | |
wim | 0:27f32a087e5a | 119 | /** A class for driving Princeton PT6964 LED controller |
wim | 0:27f32a087e5a | 120 | * Note: the PT6964 is also available from other chipvendors eg AIP1628, HT1628, CM1628, SM1628 |
wim | 0:27f32a087e5a | 121 | * |
wim | 0:27f32a087e5a | 122 | * @brief Supports 4 Grids @ 13 Segments or 5 Grids @ 12 Segments or 6 Grids @ 11 Segments or 7 Grids @ 10 Segments. |
wim | 0:27f32a087e5a | 123 | * Also supports a scanned keyboard of upto 20 keys. |
wim | 0:27f32a087e5a | 124 | * SPI bus interface device. |
wim | 0:27f32a087e5a | 125 | */ |
wim | 0:27f32a087e5a | 126 | class PT6964 { |
wim | 0:27f32a087e5a | 127 | public: |
wim | 0:27f32a087e5a | 128 | |
wim | 0:27f32a087e5a | 129 | /** Enums for display mode */ |
wim | 0:27f32a087e5a | 130 | enum Mode { |
wim | 0:27f32a087e5a | 131 | Grid4_Seg13 = PT6964_GR4_SEG13, |
wim | 0:27f32a087e5a | 132 | Grid5_Seg12 = PT6964_GR5_SEG12, |
wim | 0:27f32a087e5a | 133 | Grid6_Seg11 = PT6964_GR6_SEG11, |
wim | 0:27f32a087e5a | 134 | Grid7_Seg10 = PT6964_GR7_SEG10 |
wim | 0:27f32a087e5a | 135 | }; |
wim | 0:27f32a087e5a | 136 | |
wim | 0:27f32a087e5a | 137 | /** Datatypes for display and keymatrix data */ |
wim | 0:27f32a087e5a | 138 | typedef char DisplayData_t[PT6964_DISPLAY_MEM]; |
wim | 0:27f32a087e5a | 139 | typedef char KeyData_t[PT6964_KEY_MEM]; |
wim | 0:27f32a087e5a | 140 | |
wim | 0:27f32a087e5a | 141 | /** Constructor for class for driving Princeton PT6964 LED controller |
wim | 0:27f32a087e5a | 142 | * |
wim | 0:27f32a087e5a | 143 | * @brief Supports 4 Grids @ 13 segments or 5 Grids @ 12 segments or 6 Grids @ 11 Segments or 7 Grids @ 10 Segments. |
wim | 0:27f32a087e5a | 144 | * Also supports a scanned keyboard of upto 20 keys. |
wim | 0:27f32a087e5a | 145 | * SPI bus interface device. |
wim | 0:27f32a087e5a | 146 | * |
wim | 0:27f32a087e5a | 147 | * @param PinName mosi, miso, sclk, cs SPI bus pins |
wim | 0:27f32a087e5a | 148 | * @param Mode selects either Grids/Segments (default 7 Grids @ 10 Segments) |
wim | 0:27f32a087e5a | 149 | */ |
wim | 0:27f32a087e5a | 150 | PT6964(PinName mosi, PinName miso, PinName sclk, PinName cs, Mode mode=Grid7_Seg10); |
wim | 0:27f32a087e5a | 151 | |
wim | 0:27f32a087e5a | 152 | /** Clear the screen and locate to 0 |
wim | 0:27f32a087e5a | 153 | */ |
wim | 0:27f32a087e5a | 154 | void cls(); |
wim | 0:27f32a087e5a | 155 | |
wim | 0:27f32a087e5a | 156 | /** Write databyte to PT6964 |
wim | 0:27f32a087e5a | 157 | * @param int address display memory location to write byte |
wim | 0:27f32a087e5a | 158 | * @param char data byte written at given address |
wim | 0:27f32a087e5a | 159 | * @return none |
wim | 0:27f32a087e5a | 160 | */ |
wim | 0:27f32a087e5a | 161 | void writeData(int address, char data); |
wim | 0:27f32a087e5a | 162 | |
wim | 0:27f32a087e5a | 163 | /** Write Display datablock to PT6964 |
wim | 0:27f32a087e5a | 164 | * @param DisplayData_t data Array of PT6964_DISPLAY_MEM (=14) bytes for displaydata (starting at address 0) |
wim | 0:27f32a087e5a | 165 | * @param length number bytes to write (valid range 0..PT6964_DISPLAY_MEM (=14), starting at address 0) |
wim | 0:27f32a087e5a | 166 | * @return none |
wim | 0:27f32a087e5a | 167 | */ |
wim | 0:27f32a087e5a | 168 | void writeData(DisplayData_t data, int length = PT6964_DISPLAY_MEM); |
wim | 0:27f32a087e5a | 169 | |
wim | 0:27f32a087e5a | 170 | /** Read keydata block from PT6964 |
wim | 0:27f32a087e5a | 171 | * @param *keydata Ptr to Array of PT6964_KEY_MEM (=5) bytes for keydata |
wim | 0:27f32a087e5a | 172 | * @return bool keypress True when at least one key was pressed |
wim | 0:27f32a087e5a | 173 | * |
wim | 0:27f32a087e5a | 174 | * Note: Due to the hardware configuration the PT6964 key matrix scanner will detect multiple keys pressed at same time, |
wim | 0:27f32a087e5a | 175 | * but this may result in some spurious keys also being set in keypress data array. |
wim | 0:27f32a087e5a | 176 | * It may be best to ignore all keys in those situations. That option is implemented in this method depending on #define setting. |
wim | 0:27f32a087e5a | 177 | */ |
wim | 0:27f32a087e5a | 178 | bool getKeys(KeyData_t *keydata); |
wim | 0:27f32a087e5a | 179 | |
wim | 0:27f32a087e5a | 180 | /** Set Brightness |
wim | 0:27f32a087e5a | 181 | * |
wim | 0:27f32a087e5a | 182 | * @param char brightness (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle) |
wim | 0:27f32a087e5a | 183 | * @return none |
wim | 0:27f32a087e5a | 184 | */ |
wim | 0:27f32a087e5a | 185 | void setBrightness(char brightness = PT6964_BRT_DEF); |
wim | 0:27f32a087e5a | 186 | |
wim | 0:27f32a087e5a | 187 | /** Set the Display mode On/off |
wim | 0:27f32a087e5a | 188 | * |
wim | 0:27f32a087e5a | 189 | * @param bool display mode |
wim | 0:27f32a087e5a | 190 | */ |
wim | 0:27f32a087e5a | 191 | void setDisplay(bool on); |
wim | 0:27f32a087e5a | 192 | |
wim | 0:27f32a087e5a | 193 | private: |
wim | 0:27f32a087e5a | 194 | SPI _spi; |
wim | 0:27f32a087e5a | 195 | DigitalOut _cs; |
wim | 0:27f32a087e5a | 196 | Mode _mode; |
wim | 0:27f32a087e5a | 197 | char _display; |
wim | 0:27f32a087e5a | 198 | char _bright; |
wim | 0:27f32a087e5a | 199 | |
wim | 0:27f32a087e5a | 200 | /** Init the SPI interface and the controller |
wim | 0:27f32a087e5a | 201 | * @param none |
wim | 0:27f32a087e5a | 202 | * @return none |
wim | 0:27f32a087e5a | 203 | */ |
wim | 0:27f32a087e5a | 204 | void _init(); |
wim | 0:27f32a087e5a | 205 | |
wim | 0:27f32a087e5a | 206 | /** Helper to reverse all command or databits. The PT6964 expects LSB first, whereas SPI is MSB first |
wim | 0:27f32a087e5a | 207 | * @param char data |
wim | 0:27f32a087e5a | 208 | * @return bitreversed data |
wim | 0:27f32a087e5a | 209 | */ |
wim | 0:27f32a087e5a | 210 | char _flip(char data); |
wim | 0:27f32a087e5a | 211 | |
wim | 0:27f32a087e5a | 212 | /** Write command and parameter to PT6964 |
wim | 0:27f32a087e5a | 213 | * @param int cmd Command byte |
wim | 0:27f32a087e5a | 214 | * &Param int data Parameters for command |
wim | 0:27f32a087e5a | 215 | * @return none |
wim | 0:27f32a087e5a | 216 | */ |
wim | 0:27f32a087e5a | 217 | void _writeCmd(int cmd, int data); |
wim | 0:27f32a087e5a | 218 | }; |
wim | 0:27f32a087e5a | 219 | |
wim | 0:27f32a087e5a | 220 | |
wim | 0:27f32a087e5a | 221 | |
wim | 0:27f32a087e5a | 222 | // Derived class for PT6964 used in DVD-538A front display unit |
wim | 0:27f32a087e5a | 223 | // |
wim | 0:27f32a087e5a | 224 | |
wim | 0:27f32a087e5a | 225 | #define DVD538A_NR_GRIDS 5 |
wim | 0:27f32a087e5a | 226 | #define DVD538A_NR_DIGITS 4 |
wim | 1:1adf993a3e34 | 227 | //#define DVD538A_DIG1_IDX 1 |
wim | 0:27f32a087e5a | 228 | #define DVD538A_NR_UDC 8 |
wim | 0:27f32a087e5a | 229 | |
wim | 0:27f32a087e5a | 230 | /** Constructor for class for driving Princeton PT6964 controller as used in DVD538A |
wim | 0:27f32a087e5a | 231 | * |
wim | 0:27f32a087e5a | 232 | * @brief Supports 4 Digits of 7 Segments, 1 Grid of 9 Icons. Also supports a scanned keyboard of 4 keys. |
wim | 0:27f32a087e5a | 233 | * |
wim | 0:27f32a087e5a | 234 | * @param PinName mosi, miso, sclk, cs SPI bus pins |
wim | 0:27f32a087e5a | 235 | */ |
wim | 0:27f32a087e5a | 236 | class PT6964_DVD538A : public PT6964, public Stream { |
wim | 0:27f32a087e5a | 237 | public: |
wim | 0:27f32a087e5a | 238 | |
wim | 0:27f32a087e5a | 239 | /** Enums for Icons */ |
wim | 1:1adf993a3e34 | 240 | // Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs |
wim | 0:27f32a087e5a | 241 | enum Icon { |
wim | 1:1adf993a3e34 | 242 | LD1 = (1<<24) | S7_LD1, |
wim | 1:1adf993a3e34 | 243 | LD2 = (1<<24) | S7_LD2, |
wim | 1:1adf993a3e34 | 244 | CD = (1<<24) | S7_CD, |
wim | 1:1adf993a3e34 | 245 | DVD = (1<<24) | S7_DVD, |
wim | 1:1adf993a3e34 | 246 | PSE = (1<<24) | S7_PSE, |
wim | 1:1adf993a3e34 | 247 | PLY = (1<<24) | S7_PLY, |
wim | 1:1adf993a3e34 | 248 | COL2 = (1<<24) | S7_COL2, |
wim | 1:1adf993a3e34 | 249 | MP4 = (1<<24) | S7_MP4, |
wim | 1:1adf993a3e34 | 250 | MP3 = (1<<24) | S7_MP3 |
wim | 0:27f32a087e5a | 251 | }; |
wim | 0:27f32a087e5a | 252 | |
wim | 1:1adf993a3e34 | 253 | typedef short UDCData_t[DVD538A_NR_UDC]; |
wim | 0:27f32a087e5a | 254 | |
wim | 0:27f32a087e5a | 255 | /** Constructor for class for driving Princeton PT6964 VFD controller as used in DVD538A |
wim | 0:27f32a087e5a | 256 | * |
wim | 0:27f32a087e5a | 257 | * @brief Supports 4 Digits of 7 Segments, 1 Grid of 9 Icons. Also supports a scanned keyboard of 4 keys. |
wim | 0:27f32a087e5a | 258 | * |
wim | 0:27f32a087e5a | 259 | * @param PinName mosi, miso, sclk, cs SPI bus pins |
wim | 0:27f32a087e5a | 260 | */ |
wim | 0:27f32a087e5a | 261 | PT6964_DVD538A(PinName mosi, PinName miso, PinName sclk, PinName cs); |
wim | 0:27f32a087e5a | 262 | |
wim | 0:27f32a087e5a | 263 | #if DOXYGEN_ONLY |
wim | 0:27f32a087e5a | 264 | /** Write a character to the Display |
wim | 0:27f32a087e5a | 265 | * |
wim | 0:27f32a087e5a | 266 | * @param c The character to write to the display |
wim | 0:27f32a087e5a | 267 | */ |
wim | 0:27f32a087e5a | 268 | int putc(int c); |
wim | 0:27f32a087e5a | 269 | |
wim | 0:27f32a087e5a | 270 | /** Write a formatted string to the Display |
wim | 0:27f32a087e5a | 271 | * |
wim | 0:27f32a087e5a | 272 | * @param format A printf-style format string, followed by the |
wim | 0:27f32a087e5a | 273 | * variables to use in formatting the string. |
wim | 0:27f32a087e5a | 274 | */ |
wim | 0:27f32a087e5a | 275 | int printf(const char* format, ...); |
wim | 0:27f32a087e5a | 276 | #endif |
wim | 0:27f32a087e5a | 277 | |
wim | 0:27f32a087e5a | 278 | /** Locate cursor to a screen column |
wim | 0:27f32a087e5a | 279 | * |
wim | 0:27f32a087e5a | 280 | * @param column The horizontal position from the left, indexed from 0 |
wim | 0:27f32a087e5a | 281 | */ |
wim | 0:27f32a087e5a | 282 | void locate(int column); |
wim | 0:27f32a087e5a | 283 | |
wim | 0:27f32a087e5a | 284 | /** Clear the screen and locate to 0 |
wim | 1:1adf993a3e34 | 285 | * @param bool clrAll Clear Icons also (default = false) |
wim | 0:27f32a087e5a | 286 | */ |
wim | 1:1adf993a3e34 | 287 | void cls(bool clrAll = false); |
wim | 0:27f32a087e5a | 288 | |
wim | 0:27f32a087e5a | 289 | /** Set Icon |
wim | 0:27f32a087e5a | 290 | * |
wim | 1:1adf993a3e34 | 291 | * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs |
wim | 0:27f32a087e5a | 292 | * @return none |
wim | 0:27f32a087e5a | 293 | */ |
wim | 0:27f32a087e5a | 294 | void setIcon(Icon icon); |
wim | 0:27f32a087e5a | 295 | |
wim | 0:27f32a087e5a | 296 | /** Clr Icon |
wim | 0:27f32a087e5a | 297 | * |
wim | 1:1adf993a3e34 | 298 | * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs |
wim | 0:27f32a087e5a | 299 | * @return none |
wim | 0:27f32a087e5a | 300 | */ |
wim | 0:27f32a087e5a | 301 | void clrIcon(Icon icon); |
wim | 0:27f32a087e5a | 302 | |
wim | 0:27f32a087e5a | 303 | /** Set User Defined Characters (UDC) |
wim | 0:27f32a087e5a | 304 | * |
wim | 0:27f32a087e5a | 305 | * @param unsigned char udc_idx The Index of the UDC (0..7) |
wim | 0:27f32a087e5a | 306 | * @param int udc_data The bitpattern for the UDC (16 bits) |
wim | 0:27f32a087e5a | 307 | */ |
wim | 0:27f32a087e5a | 308 | void setUDC(unsigned char udc_idx, int udc_data); |
wim | 0:27f32a087e5a | 309 | |
wim | 0:27f32a087e5a | 310 | |
wim | 0:27f32a087e5a | 311 | /** Number of screen columns |
wim | 0:27f32a087e5a | 312 | * |
wim | 0:27f32a087e5a | 313 | * @param none |
wim | 0:27f32a087e5a | 314 | * @return columns |
wim | 0:27f32a087e5a | 315 | */ |
wim | 0:27f32a087e5a | 316 | int columns(); |
wim | 0:27f32a087e5a | 317 | |
wim | 0:27f32a087e5a | 318 | /** Write Display datablock to PT6964 |
wim | 0:27f32a087e5a | 319 | * @param DisplayData_t data Array of PT6964_DISPLAY_MEM (=14) bytes for displaydata (starting at address 0) |
wim | 0:27f32a087e5a | 320 | * @param length number bytes to write (valid range 0..(DVD538A_NR_GRIDS*2) (=14), starting at address 0) |
wim | 0:27f32a087e5a | 321 | * @return none |
wim | 0:27f32a087e5a | 322 | */ |
wim | 0:27f32a087e5a | 323 | void writeData(DisplayData_t data, int length = (DVD538A_NR_GRIDS*2)) { |
wim | 0:27f32a087e5a | 324 | PT6964::writeData(data, length); |
wim | 0:27f32a087e5a | 325 | } |
wim | 0:27f32a087e5a | 326 | |
wim | 0:27f32a087e5a | 327 | protected: |
wim | 0:27f32a087e5a | 328 | // Stream implementation functions |
wim | 0:27f32a087e5a | 329 | virtual int _putc(int value); |
wim | 0:27f32a087e5a | 330 | virtual int _getc(); |
wim | 0:27f32a087e5a | 331 | |
wim | 0:27f32a087e5a | 332 | private: |
wim | 0:27f32a087e5a | 333 | int _column; |
wim | 0:27f32a087e5a | 334 | int _columns; |
wim | 0:27f32a087e5a | 335 | |
wim | 0:27f32a087e5a | 336 | DisplayData_t _displaybuffer; |
wim | 1:1adf993a3e34 | 337 | UDCData_t _UDC_7S; |
wim | 0:27f32a087e5a | 338 | }; |
wim | 0:27f32a087e5a | 339 | |
wim | 0:27f32a087e5a | 340 | |
wim | 0:27f32a087e5a | 341 | #endif |