Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PT6301.cpp
00001 /* mbed PT6301 Library, for Princeton LC7571X VFD controller 00002 * The controller is used by Futaba 'Chip In Glass' (CIG) VFD tubes. 00003 * 00004 * Copyright (c) 2021, v01: WH, Initial version 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a copy 00007 * of this software and associated documentation files (the "Software"), to deal 00008 * in the Software without restriction, including without limitation the rights 00009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 * copies of the Software, and to permit persons to whom the Software is 00011 * furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included in 00014 * all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00022 * THE SOFTWARE. 00023 */ 00024 00025 #include "mbed.h" 00026 #include "PT6301.h" 00027 #include "PT6301_UDC.inc" 00028 00029 00030 /** Constructor for class for driving Princeton PT6301 VFD controller 00031 * 00032 * @brief Supports upto 20 Grids of 5x7 matrix segments for 2 rows of characters (row A and B). 00033 * also supports 2 additional segments for 2 rows of characters (row A and B). 00034 * SPI bus interface device. 00035 * @param PinName mosi, sclk, cs SPI bus pins 00036 * @param Mode selects number of Grids and Rows (default 20 Grids, 2 rows) 00037 * @param bool inverted_rows selects mapping of Data onto Display layout (default false) 00038 * @param Columns selects number of characters per row (default 20, same as Mode Grids) 00039 * @param Rows selects number of rows (default 2, same as Mode Rows) 00040 */ 00041 PT6301::PT6301(PinName mosi, PinName sclk, PinName cs, PinName rst, Mode mode, bool inverted_rows, int columns, int rows) : _spi(mosi,NC,sclk), _cs(cs), _rst(rst), _mode(mode), _inverted_rows(inverted_rows), _columns(columns), _rows(rows) { 00042 00043 _init(); 00044 } 00045 00046 00047 /** Init the PT6301 interface and the controller 00048 * 00049 * @param none 00050 * @return none 00051 */ 00052 void PT6301::_init(){ 00053 00054 //init SPI 00055 _cs=1; 00056 _spi.format(8,3); //PT6301 uses mode 3 (Clock High on Idle, Data latched on second (=rising) edge) 00057 _spi.frequency(100000); 00058 // _spi.frequency(250000); 00059 00060 //init controller 00061 #if(0) 00062 // Reset (3V3 level too low? Add pull-up to 5V) 00063 _rst=1; 00064 wait_ms(PT6301_RST_DLY); 00065 _rst=0; 00066 wait_ms(PT6301_RST_DLY); 00067 _rst=1; 00068 wait_ms(PT6301_RST_DLY); 00069 #endif 00070 00071 // Set number of Grids 00072 _writeCmd((PT6301_GRID_REG | (_mode & PT6301_GRID_MSK))); // Command register & value 00073 00074 setBrightness(PT6301_BRT_DEF); // Default Brightness 00075 00076 // Clear the DCRAM and ADRAM (undefined at Reset) and reset (_row, _column) 00077 cls(true); 00078 00079 // Clear the UDC RAM (undefined at Reset) 00080 const char udc_none[] = {0x00,0x00,0x00,0x00,0x00}; 00081 for (int idx=0; idx < PT6301_NR_UDC; idx++) { 00082 setUDC(idx, (char *)udc_none); 00083 } 00084 00085 // Update the display 00086 refresh(); 00087 00088 setDisplay(true); // Display On 00089 } 00090 00091 00092 /** Clear the screen and locate to (0,0) 00093 * 00094 * @param bool clrAll Clear Icons also (default = false) 00095 * @return none 00096 */ 00097 void PT6301::cls(bool clrAll) { 00098 00099 for (_row = 0; _row < _rows; _row++) { 00100 for (_column = 0; _column < _columns; _column++) { 00101 _displaybuffer[_row][_column] = ' '; // data 00102 00103 if (clrAll) { 00104 _addbuffer[_row][_column] = 0; // icons 00105 } 00106 } 00107 } 00108 00109 _row = 0; 00110 _column = 0; 00111 } 00112 00113 00114 /** Locate cursor to a screen row, column 00115 * 00116 * @param row The vertical position from the top, indexed from 0 00117 * @param column The horizontal position from the left, indexed from 0 00118 * @return none 00119 */ 00120 void PT6301::locate(int row, int column) { 00121 //sanity check 00122 if (row < 0) {row = 0;} 00123 if (row > (_rows - 1)) {row = _rows - 1;} 00124 00125 if (column < 0) {column = 0;} 00126 if (column > (_columns - 1)) {column = _columns - 1;} 00127 00128 _row = row; 00129 _column = column; 00130 } 00131 00132 /** Number of screen columns 00133 * 00134 * @param none 00135 * @return columns 00136 */ 00137 int PT6301::columns(){ 00138 return _columns; 00139 } 00140 00141 00142 /** Number of screen rows 00143 * 00144 * @param none 00145 * @return rows 00146 */ 00147 int PT6301::rows() { 00148 return _rows; 00149 } 00150 00151 00152 /** Refresh screen and show data in local mirrors on the display 00153 * 00154 * @param bool copyAll Copy Icons in Adat local mirror also (default = true) 00155 * @return none 00156 */ 00157 void PT6301::refresh(bool copyAll) { 00158 int row_cnt, col_cnt; 00159 00160 //Copy character data mirror to display 00161 _cs=0; // Send Command for DATA_A_REG 00162 wait_us(1); 00163 _spi.write(_flip(PT6301_DATA_A_REG)); // Command register for DATA_A 00164 wait_us(PT6301_CMD_DLY); // Command Delay 00165 00166 row_cnt = _row_flip(0); // Reorder rows depending on VFD layout 00167 for (col_cnt = 0; col_cnt < _columns; col_cnt++) { 00168 _spi.write(_flip(_displaybuffer[row_cnt][col_cnt])); // DATA_A Row 00169 } 00170 00171 wait_us(PT6301_CS_DLY); // CS Hold Delay 00172 _cs=1; // Latch Command & Params 00173 00174 wait_us(PT6301_CMD_DLY); // Command Delay 00175 00176 _cs=0; // Send Command for DATA_B_REG 00177 wait_us(1); 00178 _spi.write(_flip(PT6301_DATA_B_REG)); // Command register for DATA_B 00179 wait_us(PT6301_CMD_DLY); // Command Delay 00180 00181 row_cnt = _row_flip(1); // Reorder rows depending on VFD layout 00182 for (col_cnt = 0; col_cnt < _columns; col_cnt++) { 00183 _spi.write(_flip(_displaybuffer[row_cnt][col_cnt])); // DATA_B Row 00184 } 00185 00186 wait_us(PT6301_CS_DLY); // CS Hold Delay 00187 _cs=1; // Latch Command & Params 00188 00189 //Copy icon data mirror to display 00190 if (copyAll) { 00191 _cs=0; // Send Command for ADAT_A_REG 00192 wait_us(1); 00193 _spi.write(_flip(PT6301_ADAT_A_REG)); // Command register for ADAT_A 00194 wait_us(PT6301_CMD_DLY); // Command Delay 00195 00196 row_cnt = _row_flip(0); // Reorder rows depending on VFD layout 00197 for (col_cnt = 0; col_cnt < _columns; col_cnt++) { 00198 _spi.write(_flip(_addbuffer[row_cnt][col_cnt])); // ADAT_A Row 00199 } 00200 00201 wait_us(PT6301_CS_DLY); // CS Hold Delay 00202 _cs=1; // Latch Command & Params 00203 00204 wait_us(PT6301_CMD_DLY); // Command Delay 00205 00206 _cs=0; // Send Command for ADAT_B_REG 00207 wait_us(1); 00208 _spi.write(_flip(PT6301_ADAT_B_REG)); // Command register for ADAT_B 00209 wait_us(PT6301_CMD_DLY); // Command Delay 00210 00211 row_cnt = _row_flip(1); // Reorder rows depending on VFD layout 00212 for (col_cnt = 0; col_cnt < _columns; col_cnt++) { 00213 _spi.write(_flip(_addbuffer[row_cnt][col_cnt])); // ADAT_B Row 00214 } 00215 00216 wait_us(PT6301_CS_DLY); // CS Hold Delay 00217 _cs=1; // Latch Command & Params 00218 } 00219 } 00220 00221 00222 /** Set Brightness 00223 * 00224 * @param char brightness (valid range 0..255) 00225 * @return none 00226 */ 00227 void PT6301::setBrightness(char brightness){ 00228 00229 //Sanity check 00230 // 00231 00232 _writeCmd(PT6301_BRT_REG, brightness); // Command register & value 00233 } 00234 00235 00236 /** Set the Display mode On/off 00237 * 00238 * @param bool display mode 00239 * @return none 00240 */ 00241 void PT6301::setDisplay(bool on) { 00242 char display; 00243 00244 if (on) { 00245 display = PT6301_DSPL_NRM; // normal mode, show Display RAM content 00246 } 00247 else { 00248 display = PT6301_DSPL_OFF; // all segments off 00249 } 00250 00251 _writeCmd((PT6301_DSPL_REG | display)); // Command register & value 00252 } 00253 00254 00255 /** Set the Display test mode On/off 00256 * 00257 * @param bool display test mode 00258 * @return none 00259 */ 00260 void PT6301::setDisplayTest(bool on) { 00261 char display; 00262 00263 if (on) { 00264 display = PT6301_DSPL_ON; // test mode, all segments on 00265 } 00266 else { 00267 display = PT6301_DSPL_NRM; // normal mode, show Display RAM content 00268 } 00269 00270 _writeCmd((PT6301_DSPL_REG | display)); // Command register & value 00271 } 00272 00273 00274 /** Set User Defined Characters (UDC) for A and B 00275 * 00276 * @param unsigned char udc_idx The Index of the UDC (0..15) 00277 * @param UDCData_t udc_data The bitpattern for the UDC (5 bytes) 00278 * @return none 00279 */ 00280 void PT6301::setUDC(unsigned char udc_idx, UDCData_t udc_data) { 00281 00282 //Sanity check 00283 udc_idx = udc_idx & PT6301_UADR_MSK; // mask invalid bits 00284 00285 _cs=0; // Send Command & Params for UDC_A 00286 wait_us(1); 00287 _spi.write(_flip(PT6301_UDC_A_REG | udc_idx)); // Command register & address for UDC_A 00288 wait_us(PT6301_CMD_DLY); // Command Delay 00289 00290 _spi.write(_flip(udc_data[0] & PT6301_UDC_MSK)); // CD30 CD25 ...... CD0 00291 _spi.write(_flip(udc_data[1] & PT6301_UDC_MSK)); // CD31 CD26 ...... CD1 00292 _spi.write(_flip(udc_data[2] & PT6301_UDC_MSK)); // CD32 CD27 ...... CD2 00293 _spi.write(_flip(udc_data[3] & PT6301_UDC_MSK)); // CD33 CD28 ...... CD3 00294 _spi.write(_flip(udc_data[4] & PT6301_UDC_MSK)); // CD34 CD29 ...... CD4 00295 00296 wait_us(PT6301_CS_DLY); // CS Hold Delay 00297 _cs=1; // Latch Command & Params 00298 00299 wait_us(PT6301_CMD_DLY); // Command Delay 00300 00301 00302 _cs=0; // Send Command & Params for UDC B 00303 wait_us(1); 00304 _spi.write(_flip(PT6301_UDC_B_REG | udc_idx)); // Command register & address for UDC_B 00305 wait_us(PT6301_CMD_DLY); // Command Delay 00306 00307 _spi.write(_flip(udc_data[0] & PT6301_UDC_MSK)); // CD30 CD25 ...... CD0 00308 _spi.write(_flip(udc_data[1] & PT6301_UDC_MSK)); // CD31 CD26 ...... CD1 00309 _spi.write(_flip(udc_data[2] & PT6301_UDC_MSK)); // CD32 CD27 ...... CD2 00310 _spi.write(_flip(udc_data[3] & PT6301_UDC_MSK)); // CD33 CD28 ...... CD3 00311 _spi.write(_flip(udc_data[4] & PT6301_UDC_MSK)); // CD34 CD29 ...... CD4 00312 00313 wait_us(PT6301_CS_DLY); // CS Hold Delay 00314 _cs=1; // Latch Command & Params 00315 00316 wait_us(PT6301_CMD_DLY); // Command Delay 00317 00318 } 00319 00320 /** Set Icon 00321 * 00322 * @param int row The row of the icon (0..(rows-1)) 00323 * @param int column The column of the icon (0..(cols-1)) 00324 * @return none 00325 */ 00326 void PT6301::setIcon(int row, int column){ 00327 //sanity check 00328 if (row < 0) {row = 0;} 00329 if (row > (_rows - 1)) {row = _rows - 1;} 00330 00331 if (column < 0) {column = 0;} 00332 if (column > (_columns - 1)) {column = _columns - 1;} 00333 00334 _addbuffer[row][column] = PT6301_ADAT_MSK; 00335 } 00336 00337 /** Clr Icon 00338 * 00339 * @param int row The row of the icon (0..(rows-1)) 00340 * @param int column The column of the icon (0..(cols-1)) 00341 * @return none 00342 */ 00343 void PT6301::clrIcon(int row, int column){ 00344 //sanity check 00345 if (row < 0) {row = 0;} 00346 if (row > (_rows - 1)) {row = _rows - 1;} 00347 00348 if (column < 0) {column = 0;} 00349 if (column > (_columns - 1)) {column = _columns - 1;} 00350 00351 _addbuffer[row][column] = 0x00; 00352 } 00353 00354 00355 /** Write command to PT6301 00356 * 00357 * @param char cmd Command byte 00358 * @return none 00359 */ 00360 void PT6301::_writeCmd(char cmd){ 00361 00362 _cs=0; // Prepare to send Command 00363 wait_us(1); 00364 00365 _spi.write(_flip(cmd)); // Command register & value 00366 00367 wait_us(PT6301_CS_DLY); // CS Hold Delay 00368 _cs=1; // Latch Command 00369 00370 wait_us(PT6301_CMD_DLY); // Command Delay 00371 } 00372 00373 00374 /** Write command and data to PT6301 00375 * 00376 * @param char cmd Command byte 00377 * @param char data Parameter for command 00378 * @return none 00379 */ 00380 void PT6301::_writeCmd(char cmd, char data){ 00381 00382 _cs=0; // Prepare to send Command and data 00383 wait_us(1); 00384 00385 _spi.write(_flip(cmd)); // Command register & value 00386 00387 wait_us(PT6301_CMD_DLY); // Command Delay 00388 00389 _spi.write(_flip(data)); // data 00390 00391 wait_us(PT6301_CS_DLY); // CS Hold Delay 00392 _cs=1; // Latch Command and data 00393 00394 wait_us(PT6301_CMD_DLY); // Command Delay 00395 } 00396 00397 /** Write Data to local mirror 00398 * 00399 * @param char data The databyte 00400 * @param row The vertical position from the top, indexed from 0 00401 * @param column The horizontal position from the left, indexed from 0 00402 * @return none 00403 */ 00404 void PT6301::setData(char data, int row, int column){ 00405 00406 //Sanity check, allow access to all of local mirror 00407 if (row < 0) {row = 0;} 00408 if (row > (PT6301_MAX_NR_ROWS - 1)) {row = PT6301_MAX_NR_ROWS - 1;} 00409 00410 if (column < 0) {column = 0;} 00411 if (column > (PT6301_MAX_NR_GRIDS - 1)) {column = PT6301_MAX_NR_GRIDS - 1;} 00412 00413 _displaybuffer[row][column] = data; 00414 } 00415 00416 /** Read Data from local mirror 00417 * 00418 * @param row The vertical position from the top, indexed from 0 00419 * @param column The horizontal position from the left, indexed from 0 00420 * @return char The databyte 00421 */ 00422 char PT6301::getData(int row, int column){ 00423 00424 //Sanity check, allow access to all of local mirror 00425 if (row < 0) {row = 0;} 00426 if (row > (PT6301_MAX_NR_ROWS - 1)) {row = PT6301_MAX_NR_ROWS - 1;} 00427 00428 if (column < 0) {column = 0;} 00429 if (column > (PT6301_MAX_NR_GRIDS - 1)) {column = PT6301_MAX_NR_GRIDS - 1;} 00430 00431 return _displaybuffer[row][column]; 00432 } 00433 00434 /** Write AData to local mirror 00435 * 00436 * @param char data The symbol databyte 00437 * @param row The vertical position from the top, indexed from 0 00438 * @param column The horizontal position from the left, indexed from 0 00439 * @return none 00440 */ 00441 void PT6301::setAData(char data, int row, int column){ 00442 00443 //Sanity check, allow access to all of local mirror 00444 if (row < 0) {row = 0;} 00445 if (row > (PT6301_MAX_NR_ROWS - 1)) {row = PT6301_MAX_NR_ROWS - 1;} 00446 00447 if (column < 0) {column = 0;} 00448 if (column > (PT6301_MAX_NR_GRIDS - 1)) {column = PT6301_MAX_NR_GRIDS - 1;} 00449 00450 _addbuffer[row][column] = data & PT6301_ADAT_MSK; 00451 } 00452 00453 /** Read AData from local mirror 00454 * 00455 * @param row The vertical position from the top, indexed from 0 00456 * @param column The horizontal position from the left, indexed from 0 00457 * @return char The symbol databyte 00458 */ 00459 char PT6301::getAData(int row, int column){ 00460 00461 //Sanity check, allow access to all of local mirror 00462 if (row < 0) {row = 0;} 00463 if (row > (PT6301_MAX_NR_ROWS - 1)) {row = PT6301_MAX_NR_ROWS - 1;} 00464 00465 if (column < 0) {column = 0;} 00466 if (column > (PT6301_MAX_NR_GRIDS - 1)) {column = PT6301_MAX_NR_GRIDS - 1;} 00467 00468 return _addbuffer[row][column]; 00469 } 00470 00471 00472 00473 00474 /** Helper to reverse all command or databits. The PT6301 expects LSB first, whereas SPI is MSB first 00475 * 00476 * @param char data 00477 * @return bitreversed data 00478 */ 00479 char PT6301::_flip(char data) { 00480 char value=0; 00481 00482 if (data & 0x01) {value |= 0x80;} ; 00483 if (data & 0x02) {value |= 0x40;} ; 00484 if (data & 0x04) {value |= 0x20;} ; 00485 if (data & 0x08) {value |= 0x10;} ; 00486 if (data & 0x10) {value |= 0x08;} ; 00487 if (data & 0x20) {value |= 0x04;} ; 00488 if (data & 0x40) {value |= 0x02;} ; 00489 if (data & 0x80) {value |= 0x01;} ; 00490 return value; 00491 } 00492 00493 00494 /** Helper to reverse row idx depending on VFD layout 00495 * 00496 * @param int row_idx 00497 * @return adjusted row_idx 00498 */ 00499 int PT6301::_row_flip(int row_idx) { 00500 if (_inverted_rows) { 00501 return (1 - row_idx); // Reorder row mapping to match VFD layout 00502 // Top line is DATA_B_REG, ADAT_B_REG 00503 // Bottom line is DATA_A_REG, ADAT_A_REG 00504 } 00505 else { 00506 return row_idx; // Maintain row mapping to match VFD layout 00507 // Top line is DATA_A_REG, ADAT_A_REG 00508 // Bottom line is DATA_B_REG, ADAT_B_REG 00509 } 00510 } 00511 00512 00513 /** Write a single character (Stream implementation) 00514 * 00515 * @param value char to print 00516 * @return value; 00517 */ 00518 int PT6301::_putc(int value) { 00519 00520 if (value == '\r') { 00521 //No character to write 00522 00523 //Update Cursor 00524 _column = 0; 00525 } 00526 else if (value == '\n') { 00527 //No character to write 00528 00529 //Update Cursor 00530 _row++; 00531 if (_row > (_rows - 1)) { 00532 _row = 0; 00533 } 00534 } 00535 else if ((value >= 0) && (value < 256)) { 00536 //Valid character to write 00537 00538 //Write displaybuffer entry 00539 _displaybuffer[_row][_column] = value; 00540 00541 //Update Cursor 00542 _column++; 00543 if (_column > (_columns - 1)) { 00544 _column = 0; 00545 _row++; 00546 } 00547 if (_row > (_rows - 1)) { 00548 _row = 0; 00549 } 00550 } // if validChar 00551 00552 return value; 00553 } 00554 00555 /** Get a single character (Stream implementation) 00556 * 00557 * @param none 00558 * @return -1 00559 */ 00560 int PT6301::_getc() { 00561 return -1; 00562 } 00563 00564 00565 00566 #if (SMTG7400_TEST == 1) 00567 00568 /** Constructor for class for Princeton PT6301 VFD controller as used in SMTG7400 00569 * 00570 * @brief Supports 16 Grids of 5x7 Segments with 4 additional Segments in use. 00571 * 00572 * @param PinName mosi, miso, sclk, cs SPI bus pins 00573 * @param PinName rst Reset pin 00574 */ 00575 PT6301_SMTG7400::PT6301_SMTG7400(PinName mosi, PinName sclk, PinName cs, PinName rst) : PT6301(mosi, sclk, cs, rst, Grid16, true, SMTG7400_NR_COLS, SMTG7400_NR_ROWS) { 00576 00577 } 00578 00579 /** Set Icon 00580 * 00581 * @param int icon The icon ID 00582 * @return none 00583 */ 00584 void PT6301_SMTG7400::setIcon(int icon) { 00585 PT6301::setIcon((icon >> SMTG7400_ICON_ROW_SHFT), (icon & SMTG7400_ICON_COL_MSK)); 00586 } 00587 00588 /** Clr Icon 00589 * 00590 * @param int icon The icon ID 00591 * @return none 00592 */ 00593 void PT6301_SMTG7400::clrIcon(int icon) { 00594 PT6301::clrIcon((icon >> SMTG7400_ICON_ROW_SHFT), (icon & SMTG7400_ICON_COL_MSK)); 00595 } 00596 00597 #endif 00598 00599 00600 #if (SMTC7140_TEST == 1) 00601 00602 /** Constructor for class for Princeton PT6301 VFD controller as used in SMTC7140 00603 * 00604 * @brief Supports 12 Grids of 5x7 Segments without additional Icon Segments, for 2 Rows. 00605 * Grid13 is used for icons displayed by a UDC symbol. 00606 * 00607 * @param PinName mosi, miso, sclk, cs SPI bus pins 00608 * @param PinName rst Reset pin 00609 */ 00610 PT6301_SMTC7140::PT6301_SMTC7140(PinName mosi, PinName sclk, PinName cs, PinName rst) : PT6301(mosi, sclk, cs, rst, Grid13, true, SMTC7140_NR_COLS, SMTC7140_NR_ROWS) { 00611 00612 //Enable VGen for VFD Power Supply 00613 //Note this is wrong because we should send the init commands to the PT6301 before the 5V powersupply is enabled ! 00614 // setVGen(true); 00615 00616 } 00617 00618 /** Set VFD VGen 00619 * 00620 * @param bool on 00621 * @return none 00622 */ 00623 void PT6301_SMTC7140::setVGen (bool on) { 00624 00625 } 00626 00627 00628 /** Set IconGrid13 00629 * Icons are shown on Grid13 using the UDC at index=0. The UDC char=0 is stored in _displaybuffer[0][12] at reset. 00630 * This method will set the correct segment in the UDC for each icon. 00631 * 00632 * @param int icon The icon ID 00633 * @return none 00634 */ 00635 void PT6301_SMTC7140::setIconGrid13(int icon) { 00636 00637 #if(0) 00638 //Test version to check all bits 00639 // clear icon 00640 for (int udc_col=0; udc_col<5; udc_col++) { 00641 _icon_data[udc_col] = 0x00; 00642 }; 00643 00644 _icon_data[icon >> 8] = (icon & 0x7F); 00645 setUDC(0, (char *) _icon_data); // Store mirror for UDC_idx=0 00646 00647 #else 00648 //Normal version 00649 for (int udc_col=0; udc_col<5; udc_col++) { 00650 _icon_data[udc_col] = _icon_data[udc_col] | SMTC7140_ICONS[icon][udc_col]; // OR icon bitpattern with UDC mirror for UDC_idx=0 00651 } 00652 00653 setUDC(0, (char *) _icon_data); // Store mirror for UDC_idx=0 00654 #endif 00655 00656 } 00657 00658 /** Clr IconGrid13 00659 * Icons are shown on Grid13 using the UDC at index=0. The UDC char=0 is stored in _displaybuffer[0][12] at reset. 00660 * This method will clr the correct segment in the UDC for each icon. 00661 * 00662 * @param int icon The icon ID 00663 * @return none 00664 */ 00665 void PT6301_SMTC7140::clrIconGrid13(int icon) { 00666 00667 for (int udc_col=0; udc_col<5; udc_col++) { 00668 _icon_data[udc_col] = _icon_data[udc_col] & ~(SMTC7140_ICONS[icon][udc_col]); // AND inverted icon bitpattern with UDC mirror for UDC_idx=0 00669 } 00670 00671 setUDC(0, (char *) _icon_data); // Store mirror for UDC_idx=0 00672 } 00673 00674 #endif
Generated on Thu Jul 14 2022 03:31:40 by
1.7.2