Library for the Princeton PT6312 Vacuum Fluorescent Display (VFD) driver.

Dependents:   mbed_PT6312

This library is documented here.

Committer:
wim
Date:
Thu Aug 27 21:22:30 2015 +0000
Revision:
2:f010b7022803
Parent:
1:c5e247159aa6
Child:
3:156c23d9652a
Test2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 0:e59142cded2b 1 /* mbed PT6312 Library, for Princeton PT6312 VFD controller
wim 0:e59142cded2b 2 * Copyright (c) 2015, v01: WH, Initial version
wim 0:e59142cded2b 3 *
wim 0:e59142cded2b 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
wim 0:e59142cded2b 5 * of this software and associated documentation files (the "Software"), to deal
wim 0:e59142cded2b 6 * in the Software without restriction, including without limitation the rights
wim 0:e59142cded2b 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
wim 0:e59142cded2b 8 * copies of the Software, and to permit persons to whom the Software is
wim 0:e59142cded2b 9 * furnished to do so, subject to the following conditions:
wim 0:e59142cded2b 10 *
wim 0:e59142cded2b 11 * The above copyright notice and this permission notice shall be included in
wim 0:e59142cded2b 12 * all copies or substantial portions of the Software.
wim 0:e59142cded2b 13 *
wim 0:e59142cded2b 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
wim 0:e59142cded2b 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
wim 0:e59142cded2b 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
wim 0:e59142cded2b 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
wim 0:e59142cded2b 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
wim 0:e59142cded2b 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
wim 0:e59142cded2b 20 * THE SOFTWARE.
wim 0:e59142cded2b 21 */
wim 0:e59142cded2b 22 #include "mbed.h"
wim 0:e59142cded2b 23 #include "PT6312.h"
wim 1:c5e247159aa6 24 #include "Font_16Seg.h"
wim 0:e59142cded2b 25
wim 0:e59142cded2b 26 /** Constructor for class for driving Princeton PT6312 VFD controller
wim 0:e59142cded2b 27 *
wim 0:e59142cded2b 28 * @brief Supports 4 Digits of 16 Segments upto 10 Digits of 12 Segments. Also supports a scanned keyboard of upto 24 keys, 4 switches and 4 LEDs.
wim 0:e59142cded2b 29 * SPI bus interface device.
wim 0:e59142cded2b 30 *
wim 0:e59142cded2b 31 * @param PinName mosi, miso, sclk, cs SPI bus pins
wim 0:e59142cded2b 32 * @param Mode selects either number of Digits and Segments
wim 0:e59142cded2b 33 */
wim 0:e59142cded2b 34 PT6312::PT6312(PinName mosi, PinName miso, PinName sclk, PinName cs, Mode mode) : _spi(mosi,miso,sclk), _cs(cs), _mode(mode) {
wim 0:e59142cded2b 35
wim 0:e59142cded2b 36 _init();
wim 0:e59142cded2b 37 }
wim 0:e59142cded2b 38
wim 0:e59142cded2b 39 /** Init the SPI interface and the controller
wim 0:e59142cded2b 40 * @param none
wim 0:e59142cded2b 41 * @return none
wim 0:e59142cded2b 42 */
wim 0:e59142cded2b 43 void PT6312::_init(){
wim 0:e59142cded2b 44
wim 0:e59142cded2b 45 //init SPI
wim 0:e59142cded2b 46 _cs=1;
wim 0:e59142cded2b 47 _spi.format(8,3); //PT6312 uses mode 3 (Clock High on Idle, Data latched on second (=rising) edge)
wim 1:c5e247159aa6 48 // _spi.frequency(100000);
wim 1:c5e247159aa6 49 _spi.frequency(500000);
wim 0:e59142cded2b 50
wim 0:e59142cded2b 51 //init controller
wim 0:e59142cded2b 52 _writeCmd(PT6312_MODE_SET_CMD, _mode); // Mode set command
wim 0:e59142cded2b 53
wim 0:e59142cded2b 54 _display = PT6312_DSP_ON;
wim 0:e59142cded2b 55 _bright = PT6312_BRT_DEF;
wim 0:e59142cded2b 56 _writeCmd(PT6312_DSP_CTRL_CMD, _display | _bright ); // Display control cmd, display on/off, brightness
wim 0:e59142cded2b 57
wim 0:e59142cded2b 58 _writeCmd(PT6312_DATA_SET_CMD, PT6312_DATA_WR | PT6312_ADDR_INC | PT6312_MODE_NORM); // Data set cmd, normal mode, auto incr, write data
wim 0:e59142cded2b 59 }
wim 0:e59142cded2b 60
wim 0:e59142cded2b 61
wim 0:e59142cded2b 62 /** Clear the screen and locate to 0
wim 0:e59142cded2b 63 */
wim 0:e59142cded2b 64 void PT6312::cls() {
wim 0:e59142cded2b 65
wim 0:e59142cded2b 66 _cs=0;
wim 0:e59142cded2b 67 wait_us(1);
wim 0:e59142cded2b 68 _spi.write(_flip(PT6312_ADDR_SET_CMD | 0x00)); // Address set cmd, 0
wim 0:e59142cded2b 69
wim 0:e59142cded2b 70 for (int cnt=0; cnt<PT6312_DISPLAY_MEM; cnt++) {
wim 0:e59142cded2b 71 _spi.write(0x00); // data
wim 0:e59142cded2b 72 }
wim 0:e59142cded2b 73
wim 0:e59142cded2b 74 wait_us(1);
wim 0:e59142cded2b 75 _cs=1;
wim 0:e59142cded2b 76
wim 0:e59142cded2b 77 }
wim 0:e59142cded2b 78
wim 0:e59142cded2b 79 /** Set Brightness
wim 0:e59142cded2b 80 *
wim 0:e59142cded2b 81 * @param char brightness (3 significant bits, valid range 0..7 (1/16 .. 14/14 dutycycle)
wim 0:e59142cded2b 82 * @return none
wim 0:e59142cded2b 83 */
wim 0:e59142cded2b 84 void PT6312::setBrightness(char brightness){
wim 0:e59142cded2b 85
wim 0:e59142cded2b 86 _bright = brightness & PT6312_BRT_MSK; // mask invalid bits
wim 0:e59142cded2b 87
wim 0:e59142cded2b 88 _writeCmd(PT6312_DSP_CTRL_CMD, _display | _bright ); // Display control cmd, display on/off, brightness
wim 0:e59142cded2b 89
wim 0:e59142cded2b 90 }
wim 0:e59142cded2b 91
wim 0:e59142cded2b 92 /** Set the Display mode On/off
wim 0:e59142cded2b 93 *
wim 0:e59142cded2b 94 * @param bool display mode
wim 0:e59142cded2b 95 */
wim 0:e59142cded2b 96 void PT6312::setDisplay(bool on) {
wim 0:e59142cded2b 97
wim 0:e59142cded2b 98 if (on) {
wim 0:e59142cded2b 99 _display = PT6312_DSP_ON;
wim 0:e59142cded2b 100 }
wim 0:e59142cded2b 101 else {
wim 0:e59142cded2b 102 _display = PT6312_DSP_OFF;
wim 0:e59142cded2b 103 }
wim 0:e59142cded2b 104
wim 0:e59142cded2b 105 _writeCmd(PT6312_DSP_CTRL_CMD, _display | _bright ); // Display control cmd, display on/off, brightness
wim 0:e59142cded2b 106 }
wim 0:e59142cded2b 107
wim 0:e59142cded2b 108 /** Write databyte to PT6312
wim 0:e59142cded2b 109 * @param int address display memory location to write byte
wim 0:e59142cded2b 110 * @param char data byte written at given address
wim 0:e59142cded2b 111 * @return none
wim 0:e59142cded2b 112 */
wim 0:e59142cded2b 113 void PT6312::writeData(int address, char data) {
wim 0:e59142cded2b 114 _cs=0;
wim 0:e59142cded2b 115 wait_us(1);
wim 0:e59142cded2b 116 _spi.write(_flip(PT6312_ADDR_SET_CMD | (address & PT6312_ADDR_MSK))); // Set Address cmd
wim 0:e59142cded2b 117
wim 0:e59142cded2b 118 _spi.write(_flip(data)); // data
wim 0:e59142cded2b 119
wim 0:e59142cded2b 120 wait_us(1);
wim 0:e59142cded2b 121 _cs=1;
wim 0:e59142cded2b 122
wim 0:e59142cded2b 123 }
wim 0:e59142cded2b 124
wim 0:e59142cded2b 125 /** Write Display datablock to PT6312
wim 0:e59142cded2b 126 * @param DisplayData_t data Array of PT6312_DISPLAY_MEM (=16) bytes for displaydata (starting at address 0)
wim 2:f010b7022803 127 * @param length number bytes to write (valide range 0..PT6312_DISPLAY_MEM (=16), starting at address 0)
wim 0:e59142cded2b 128 * @return none
wim 0:e59142cded2b 129 */
wim 2:f010b7022803 130 void PT6312::writeData(DisplayData_t data, int length) {
wim 0:e59142cded2b 131 _cs=0;
wim 0:e59142cded2b 132 wait_us(1);
wim 0:e59142cded2b 133 _spi.write(_flip(PT6312_ADDR_SET_CMD | 0x00)); // Set Address at 0
wim 0:e59142cded2b 134
wim 2:f010b7022803 135 // sanity check
wim 2:f010b7022803 136 if (length < 0) {length = 0;}
wim 2:f010b7022803 137 if (length > PT6312_DISPLAY_MEM) {length = PT6312_DISPLAY_MEM;}
wim 2:f010b7022803 138
wim 2:f010b7022803 139 // for (int idx=0; idx<PT6312_DISPLAY_MEM; idx++) {
wim 2:f010b7022803 140 for (int idx=0; idx<length; idx++) {
wim 0:e59142cded2b 141 _spi.write(_flip(data[idx])); // data
wim 0:e59142cded2b 142 }
wim 0:e59142cded2b 143
wim 0:e59142cded2b 144 wait_us(1);
wim 0:e59142cded2b 145 _cs=1;
wim 0:e59142cded2b 146
wim 0:e59142cded2b 147 }
wim 0:e59142cded2b 148
wim 0:e59142cded2b 149 /** Read keydata block from PT6312
wim 0:e59142cded2b 150 * @param *keydata Ptr to Array of PT6312_KEY_MEM (=3) bytes for keydata
wim 0:e59142cded2b 151 * @return bool keypress True when at least one key was pressed
wim 0:e59142cded2b 152 *
wim 0:e59142cded2b 153 * Note: Due to the hardware configuration the PT6312 key matrix scanner will detect multiple keys pressed at same time,
wim 0:e59142cded2b 154 * but this may also result in some spurious keys being set in keypress data array.
wim 0:e59142cded2b 155 * It may be best to ignore all keys in those situations. That option is implemented in this method depending on #define setting.
wim 0:e59142cded2b 156 */
wim 1:c5e247159aa6 157 bool PT6312::getKeys(KeyData_t *keydata) {
wim 0:e59142cded2b 158 int keypress = 0;
wim 0:e59142cded2b 159 char data;
wim 0:e59142cded2b 160
wim 0:e59142cded2b 161 // Read keys
wim 0:e59142cded2b 162 _cs=0;
wim 0:e59142cded2b 163 wait_us(1);
wim 0:e59142cded2b 164
wim 0:e59142cded2b 165 // Enable Key Read mode
wim 0:e59142cded2b 166 _spi.write(_flip(PT6312_DATA_SET_CMD | PT6312_KEY_RD | PT6312_ADDR_INC | PT6312_MODE_NORM)); // Data set cmd, normal mode, auto incr, read data
wim 0:e59142cded2b 167
wim 0:e59142cded2b 168 for (int idx=0; idx < PT6312_KEY_MEM; idx++) {
wim 0:e59142cded2b 169 data = _flip(_spi.write(0xFF)); // read keys and correct bitorder
wim 0:e59142cded2b 170
wim 0:e59142cded2b 171 if (data != 0) { // Check for any pressed key
wim 0:e59142cded2b 172 for (int bit=0; bit < PT6312_KEY_BITS; bit++) {
wim 0:e59142cded2b 173 if (data & (1 << bit)) {keypress++;} // Test all significant bits
wim 0:e59142cded2b 174 }
wim 0:e59142cded2b 175 }
wim 0:e59142cded2b 176
wim 0:e59142cded2b 177 (*keydata)[idx] = data; // Store keydata after correcting bitorder
wim 0:e59142cded2b 178 }
wim 0:e59142cded2b 179
wim 0:e59142cded2b 180 wait_us(1);
wim 0:e59142cded2b 181 _cs=1;
wim 0:e59142cded2b 182
wim 0:e59142cded2b 183 // Restore Data Write mode
wim 0:e59142cded2b 184 _writeCmd(PT6312_DATA_SET_CMD, PT6312_DATA_WR | PT6312_ADDR_INC | PT6312_MODE_NORM); // Data set cmd, normal mode, auto incr, write data
wim 0:e59142cded2b 185
wim 0:e59142cded2b 186 #if(1)
wim 0:e59142cded2b 187 // Dismiss multiple keypresses at same time
wim 0:e59142cded2b 188 return (keypress == 1);
wim 0:e59142cded2b 189 #else
wim 0:e59142cded2b 190 // Allow multiple keypress and accept possible spurious keys
wim 0:e59142cded2b 191 return (keypress > 0);
wim 0:e59142cded2b 192 #endif
wim 0:e59142cded2b 193 }
wim 0:e59142cded2b 194
wim 0:e59142cded2b 195
wim 0:e59142cded2b 196 /** Read switches from PT6312
wim 0:e59142cded2b 197 *
wim 0:e59142cded2b 198 * @param none
wim 0:e59142cded2b 199 * @return char for switch data (4 least significant bits)
wim 0:e59142cded2b 200 *
wim 0:e59142cded2b 201 */
wim 1:c5e247159aa6 202 char PT6312::getSwitches() {
wim 0:e59142cded2b 203 char data;
wim 0:e59142cded2b 204
wim 0:e59142cded2b 205 // Read switches
wim 0:e59142cded2b 206 _cs=0;
wim 0:e59142cded2b 207 wait_us(1);
wim 0:e59142cded2b 208
wim 0:e59142cded2b 209 // Enable Switch Read mode
wim 0:e59142cded2b 210 _spi.write(_flip(PT6312_DATA_SET_CMD | PT6312_SW_RD | PT6312_ADDR_INC | PT6312_MODE_NORM)); // Data set cmd, normal mode, auto incr, read data
wim 0:e59142cded2b 211
wim 0:e59142cded2b 212 data = _flip(_spi.write(0xFF)) & PT6312_SW_MSK; // read switches and correct bitorder
wim 0:e59142cded2b 213
wim 0:e59142cded2b 214 wait_us(1);
wim 0:e59142cded2b 215 _cs=1;
wim 0:e59142cded2b 216
wim 0:e59142cded2b 217 // Restore Data Write mode
wim 0:e59142cded2b 218 _writeCmd(PT6312_DATA_SET_CMD, PT6312_DATA_WR | PT6312_ADDR_INC | PT6312_MODE_NORM); // Data set cmd, normal mode, auto incr, write data
wim 0:e59142cded2b 219
wim 0:e59142cded2b 220 return data;
wim 0:e59142cded2b 221 }
wim 0:e59142cded2b 222
wim 0:e59142cded2b 223
wim 0:e59142cded2b 224 /** Set LEDs
wim 0:e59142cded2b 225 *
wim 0:e59142cded2b 226 * @param char leds (4 least significant bits)
wim 0:e59142cded2b 227 * @return none
wim 0:e59142cded2b 228 */
wim 0:e59142cded2b 229 void PT6312::setLED (char leds) {
wim 0:e59142cded2b 230
wim 0:e59142cded2b 231 // Set LEDs
wim 0:e59142cded2b 232 _cs=0;
wim 0:e59142cded2b 233 wait_us(1);
wim 0:e59142cded2b 234
wim 0:e59142cded2b 235 // Enable LED Write mode
wim 0:e59142cded2b 236 _spi.write(_flip(PT6312_DATA_SET_CMD | PT6312_LED_WR | PT6312_ADDR_INC | PT6312_MODE_NORM)); // Data set cmd, normal mode, auto incr, write data
wim 0:e59142cded2b 237
wim 0:e59142cded2b 238 _spi.write(_flip(leds & PT6312_LED_MSK)); // write LEDs in correct bitorder
wim 0:e59142cded2b 239
wim 0:e59142cded2b 240 wait_us(1);
wim 0:e59142cded2b 241 _cs=1;
wim 0:e59142cded2b 242
wim 0:e59142cded2b 243 // Restore Data Write mode
wim 0:e59142cded2b 244 _writeCmd(PT6312_DATA_SET_CMD, PT6312_DATA_WR | PT6312_ADDR_INC | PT6312_MODE_NORM); // Data set cmd, normal mode, auto incr, write data
wim 0:e59142cded2b 245 }
wim 0:e59142cded2b 246
wim 0:e59142cded2b 247
wim 0:e59142cded2b 248
wim 0:e59142cded2b 249 /** Helper to reverse all command or databits. The PT6312 expects LSB first, whereas SPI is MSB first
wim 0:e59142cded2b 250 * @param char data
wim 0:e59142cded2b 251 * @return bitreversed data
wim 0:e59142cded2b 252 */
wim 0:e59142cded2b 253 char PT6312::_flip(char data) {
wim 0:e59142cded2b 254 char value=0;
wim 0:e59142cded2b 255
wim 0:e59142cded2b 256 if (data & 0x01) {value |= 0x80;} ;
wim 0:e59142cded2b 257 if (data & 0x02) {value |= 0x40;} ;
wim 0:e59142cded2b 258 if (data & 0x04) {value |= 0x20;} ;
wim 0:e59142cded2b 259 if (data & 0x08) {value |= 0x10;} ;
wim 0:e59142cded2b 260 if (data & 0x10) {value |= 0x08;} ;
wim 0:e59142cded2b 261 if (data & 0x20) {value |= 0x04;} ;
wim 0:e59142cded2b 262 if (data & 0x40) {value |= 0x02;} ;
wim 0:e59142cded2b 263 if (data & 0x80) {value |= 0x01;} ;
wim 0:e59142cded2b 264 return value;
wim 0:e59142cded2b 265 }
wim 0:e59142cded2b 266
wim 0:e59142cded2b 267
wim 0:e59142cded2b 268 /** Write command and parameter to PT6312
wim 0:e59142cded2b 269 * @param int cmd Command byte
wim 0:e59142cded2b 270 * &Param int data Parameters for command
wim 0:e59142cded2b 271 * @return none
wim 0:e59142cded2b 272 */
wim 0:e59142cded2b 273 void PT6312::_writeCmd(int cmd, int data){
wim 0:e59142cded2b 274
wim 0:e59142cded2b 275 _cs=0;
wim 0:e59142cded2b 276 wait_us(1);
wim 0:e59142cded2b 277 // _spi.write(_flip( (cmd & 0xF0) | (data & 0x0F)));
wim 0:e59142cded2b 278 _spi.write(_flip( (cmd & PT6312_CMD_MSK) | (data & ~PT6312_CMD_MSK)));
wim 0:e59142cded2b 279
wim 0:e59142cded2b 280 wait_us(1);
wim 0:e59142cded2b 281 _cs=1;
wim 0:e59142cded2b 282
wim 0:e59142cded2b 283 };
wim 0:e59142cded2b 284
wim 0:e59142cded2b 285
wim 1:c5e247159aa6 286
wim 2:f010b7022803 287 /** Constructor for class for driving Princeton PT6312 VFD controller as used in Philips DVP630
wim 1:c5e247159aa6 288 *
wim 1:c5e247159aa6 289 * @brief Supports 4 Digits of 16 Segments upto 11 Digits of 11 Segments. Also supports a scanned keyboard of upto 24 keys, 4 switches and 4 LEDs.
wim 1:c5e247159aa6 290 * SPI bus interface device.
wim 1:c5e247159aa6 291 * @param PinName mosi, miso, sclk, cs SPI bus pins
wim 1:c5e247159aa6 292 */
wim 2:f010b7022803 293 PT6312_DVP630::PT6312_DVP630(PinName mosi, PinName miso, PinName sclk, PinName cs) : PT6312(mosi, miso, sclk, cs, Dig7_Seg15) {
wim 2:f010b7022803 294 _column = 0;
wim 2:f010b7022803 295 _columns = DVP630_NR_DIGITS;
wim 1:c5e247159aa6 296 }
wim 1:c5e247159aa6 297
wim 1:c5e247159aa6 298 #if(0)
wim 1:c5e247159aa6 299 #if DOXYGEN_ONLY
wim 1:c5e247159aa6 300 /** Write a character to the LCD
wim 1:c5e247159aa6 301 *
wim 1:c5e247159aa6 302 * @param c The character to write to the display
wim 1:c5e247159aa6 303 */
wim 1:c5e247159aa6 304 int putc(int c);
wim 1:c5e247159aa6 305
wim 1:c5e247159aa6 306 /** Write a formatted string to the LCD
wim 1:c5e247159aa6 307 *
wim 1:c5e247159aa6 308 * @param format A printf-style format string, followed by the
wim 1:c5e247159aa6 309 * variables to use in formatting the string.
wim 1:c5e247159aa6 310 */
wim 1:c5e247159aa6 311 int printf(const char* format, ...);
wim 1:c5e247159aa6 312 #endif
wim 1:c5e247159aa6 313 #endif
wim 1:c5e247159aa6 314
wim 1:c5e247159aa6 315 /** Locate cursor to a screen column
wim 1:c5e247159aa6 316 *
wim 1:c5e247159aa6 317 * @param column The horizontal position from the left, indexed from 0
wim 1:c5e247159aa6 318 */
wim 2:f010b7022803 319 void PT6312_DVP630::locate(int column) {
wim 2:f010b7022803 320 //sanity check
wim 2:f010b7022803 321 if (column < 0) {column = 0;}
wim 2:f010b7022803 322 if (column > (_columns - 1)) {column = _columns - 1;}
wim 2:f010b7022803 323
wim 2:f010b7022803 324 _column = column;
wim 1:c5e247159aa6 325 }
wim 1:c5e247159aa6 326
wim 1:c5e247159aa6 327
wim 1:c5e247159aa6 328 /** Number of screen columns
wim 1:c5e247159aa6 329 *
wim 1:c5e247159aa6 330 * @param none
wim 1:c5e247159aa6 331 * @return columns
wim 1:c5e247159aa6 332 */
wim 2:f010b7022803 333 int PT6312_DVP630::columns() {
wim 1:c5e247159aa6 334 return _columns;
wim 1:c5e247159aa6 335 }
wim 1:c5e247159aa6 336
wim 1:c5e247159aa6 337
wim 1:c5e247159aa6 338 /** Clear the screen and locate to 0
wim 1:c5e247159aa6 339 */
wim 2:f010b7022803 340 void PT6312_DVP630::cls() {
wim 2:f010b7022803 341 PT6312::cls();
wim 2:f010b7022803 342
wim 2:f010b7022803 343 //clear local buffer
wim 2:f010b7022803 344 for (int idx=0; idx < (DVP630_NR_DIGITS*2); idx++) {
wim 2:f010b7022803 345 _displaybuffer[idx] = 0x00;
wim 2:f010b7022803 346 }
wim 2:f010b7022803 347
wim 2:f010b7022803 348 _column = 0;
wim 1:c5e247159aa6 349 }
wim 1:c5e247159aa6 350
wim 1:c5e247159aa6 351
wim 1:c5e247159aa6 352 /** Write a single character (Stream implementation)
wim 1:c5e247159aa6 353 */
wim 2:f010b7022803 354 int PT6312_DVP630::_putc(int value) {
wim 1:c5e247159aa6 355 int addr;
wim 1:c5e247159aa6 356
wim 1:c5e247159aa6 357 if (value == '\n') {
wim 1:c5e247159aa6 358 //No character to write
wim 1:c5e247159aa6 359
wim 1:c5e247159aa6 360 //Update Cursor
wim 1:c5e247159aa6 361 _column = 0;
wim 1:c5e247159aa6 362 }
wim 2:f010b7022803 363 // else if ((value >= 0) && (value <= 7)) {
wim 2:f010b7022803 364 // //write UDC
wim 2:f010b7022803 365 // //@todo
wim 2:f010b7022803 366 // }
wim 2:f010b7022803 367 else if ((value >= FONT_16S_START) && (value <= FONT_16S_END)) {
wim 1:c5e247159aa6 368 //Character to write
wim 2:f010b7022803 369 value = value - FONT_16S_START;
wim 2:f010b7022803 370 addr = ((DVP630_NR_DIGITS-1) - _column) * 2;
wim 2:f010b7022803 371
wim 2:f010b7022803 372 //save icons...
wim 2:f010b7022803 373 _displaybuffer[addr] = FONT_16S[value][0];
wim 2:f010b7022803 374 _displaybuffer[addr+1] = FONT_16S[value][1];
wim 2:f010b7022803 375 writeData(_displaybuffer, (DVP630_NR_DIGITS*2));
wim 2:f010b7022803 376
wim 1:c5e247159aa6 377 //Update Cursor
wim 1:c5e247159aa6 378 _column++;
wim 1:c5e247159aa6 379 if (_column >= columns()) {
wim 1:c5e247159aa6 380 _column = 0;
wim 1:c5e247159aa6 381 }
wim 1:c5e247159aa6 382 } //else
wim 1:c5e247159aa6 383
wim 1:c5e247159aa6 384 // //Set next memoryaddress, make sure cursor blinks at next location
wim 1:c5e247159aa6 385 // addr = getAddress(_column, _row);
wim 1:c5e247159aa6 386 // _writeCommand(0x80 | addr);
wim 1:c5e247159aa6 387
wim 1:c5e247159aa6 388 return value;
wim 1:c5e247159aa6 389 }
wim 1:c5e247159aa6 390
wim 1:c5e247159aa6 391
wim 1:c5e247159aa6 392 // get a single character (Stream implementation)
wim 2:f010b7022803 393 int PT6312_DVP630::_getc() {
wim 1:c5e247159aa6 394 return -1;
wim 1:c5e247159aa6 395 }