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.
Fork of TM1637 by
TM1637.h
00001 /* mbed TM1637 Library, for TM1637 LED controller 00002 * Copyright (c) 2016, v01: WH, Initial version 00003 * 2017, v02: WH, Added RobotDyn 6 Digit module, 00004 * Added Eyewink 6 Digit + 6 Keys module, 00005 * Constructor adapted to 2 pins: dio, clk 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a copy 00008 * of this software and associated documentation files (the "Software"), to deal 00009 * in the Software without restriction, inclumosig without limitation the rights 00010 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00011 * copies of the Software, and to permit persons to whom the Software is 00012 * furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included in 00015 * all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 * IMPLIED, INCLUmosiG BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00020 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00022 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00023 * THE SOFTWARE. 00024 */ 00025 00026 #ifndef TM1637_H 00027 #define TM1637_H 00028 00029 // Select one of the testboards for TM1637 LED controller 00030 #include "TM1637_Config.h" 00031 00032 /** An interface for driving TM1637 LED controller 00033 * 00034 * @code 00035 * #include "mbed.h" 00036 * #include "TM1637.h" 00037 * 00038 * Serial pc(USBTX, USBRX); 00039 * 00040 * //DisplayData_t size is 6 bytes (6 grids @ 8 segments) 00041 * TM1637::DisplayData_t all_str = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 00042 * 00043 * // KeyData_t size is 1 bytes 00044 * TM1637::KeyData_t keydata; 00045 * 00046 * // TM1637 declaration, Select the desired type in TM1637_Config.h 00047 * //TM1637_CATALEX CATALEX(p5,p6,p7); //LPC1768 DEPRECATED version 00048 * TM1637_CATALEX CATALEX(p6, p7); //LPC1768 00049 * //TM1637_CATALEX CATALEX(D9, D10); //F401 00050 * 00051 * int main() { 00052 * CATALEX.cls(); 00053 * CATALEX.writeData(all_str); 00054 * wait(1); 00055 * CATALEX.setBrightness(TM1637_BRT0); 00056 * wait(1); 00057 * CATALEX.setBrightness(TM1637_BRT3); 00058 * 00059 * while (1) { 00060 * CATALEX.cls(); 00061 * wait(0.5); 00062 * CATALEX.writeData(all_str); 00063 * wait(1.0); 00064 * CATALEX.cls(); 00065 * CATALEX.printf(" HI "); 00066 * wait(1.0); 00067 * 00068 * // Check and read keydata 00069 * if (CATALEX.getKeys(&keydata)) { 00070 * pc.printf("Keydata = 0x%02x\r\n", keydata); 00071 * 00072 * if (keydata == TM1637_SW9_BIT) { //sw9 00073 * CATALEX.cls(); 00074 * CATALEX.printf("--09"); 00075 * } 00076 * } // Check keydata 00077 * } // while 00078 * } 00079 * @endcode 00080 */ 00081 00082 00083 //TM1637 Display data 00084 #define TM1637_MAX_NR_GRIDS 4 00085 #define TM1637_BYTES_PER_GRID 1 00086 00087 //Significant bits Keymatrix data 00088 //#define TM1638_KEY_MSK 0xFF 00089 00090 //Memory size in bytes for Display and Keymatrix 00091 #define TM1637_DISPLAY_MEM (TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID) 00092 #define TM1637_KEY_MEM 2 00093 00094 //Reserved bits for commands 00095 #define TM1637_CMD_MSK 0xC0 00096 00097 //Data setting commands 00098 #define TM1637_DATA_SET_CMD 0x40 00099 #define TM1637_DATA_WR 0x00 00100 #define TM1637_KEY_RD 0x02 00101 #define TM1637_ADDR_INC 0x00 00102 #define TM1637_ADDR_FIXED 0x04 00103 #define TM1637_MODE_NORM 0x00 00104 #define TM1637_MODE_TEST 0x08 00105 00106 //Address setting commands 00107 #define TM1637_ADDR_SET_CMD 0xC0 00108 #define TM1637_ADDR_MSK 0x07 //0..5 00109 00110 //Display control commands 00111 #define TM1637_DSP_CTRL_CMD 0x80 00112 #define TM1637_BRT_MSK 0x07 00113 #define TM1637_BRT0 0x00 //Pulsewidth 1/16 00114 #define TM1637_BRT1 0x01 00115 #define TM1637_BRT2 0x02 00116 #define TM1637_BRT3 0x03 00117 #define TM1637_BRT4 0x04 00118 #define TM1637_BRT5 0x05 00119 #define TM1637_BRT6 0x06 00120 #define TM1637_BRT7 0x07 //Pulsewidth 14/16 00121 00122 #define TM1637_BRT_DEF TM1637_BRT3 00123 00124 #define TM1637_DSP_OFF 0x00 00125 #define TM1637_DSP_ON 0x08 00126 00127 00128 //Access to 16 Switches 00129 //S0 S1 S2 K1 K2 1 1 1 00130 //K1,K2 = 0 1 00131 #define TM1637_SW1_BIT 0xEF 00132 #define TM1637_SW2_BIT 0x6F 00133 #define TM1637_SW3_BIT 0xAF 00134 #define TM1637_SW4_BIT 0x2F 00135 #define TM1637_SW5_BIT 0xCF 00136 #define TM1637_SW6_BIT 0x4F 00137 #define TM1637_SW7_BIT 0x8F 00138 #define TM1637_SW8_BIT 0x0F 00139 00140 //K1,K2 = 1 0 00141 #define TM1637_SW9_BIT 0xF7 00142 #define TM1637_SW10_BIT 0x77 00143 #define TM1637_SW11_BIT 0xB7 00144 #define TM1637_SW12_BIT 0x37 00145 #define TM1637_SW13_BIT 0xD7 00146 #define TM1637_SW14_BIT 0x57 00147 #define TM1637_SW15_BIT 0x97 00148 #define TM1637_SW16_BIT 0x17 00149 00150 #define TM1637_SW_NONE 0xFF 00151 00152 /** A class for driving TM1637 LED controller 00153 * 00154 * @brief Supports 6 Grids @ 8 Segments and 16 Keys. 00155 * Serial bus interface device. 00156 */ 00157 class TM1637 { 00158 public: 00159 00160 /** Datatype for displaydata */ 00161 typedef char DisplayData_t[TM1637_DISPLAY_MEM]; 00162 00163 /** Datatypes for keymatrix data */ 00164 typedef char KeyData_t; 00165 00166 #if(SPI==1) 00167 /** Constructor for class for driving TM1637 LED controller 00168 * 00169 * @brief Supports 6 Grids @ 8 segments and 16 Keys. 00170 * Serial bus interface device. 00171 * DEPRECATED version 00172 * 00173 * @param PinName mosi_nc Serial bus NC pin 00174 * @param PinName miso_dio Serial bus DIO pin 00175 * @param PinName sclk_clk Serial bus CLK pin 00176 */ 00177 TM1637(PinName mosi_nc, PinName miso_dio, PinName sclk_clk); 00178 #endif 00179 00180 /** Constructor for class for driving TM1637 LED controller 00181 * 00182 * @brief Supports 6 Grids @ 8 segments and 16 Keys. 00183 * Serial bus interface device. 00184 * 00185 * @param PinName dio Serial bus DIO pin 00186 * @param PinName sck Serial bus CLK pin 00187 */ 00188 TM1637(PinName dio, PinName clk); 00189 00190 00191 /** Clear the screen and locate to 0 00192 */ 00193 void cls(); 00194 00195 /** Write databyte to TM1637 00196 * @param char data byte written at given address 00197 * @param int address display memory location to write byte 00198 * @return none 00199 */ 00200 void writeData(char data, int address); 00201 00202 /** Write Display datablock to TM1637 00203 * @param DisplayData_t data Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata 00204 * @param length number bytes to write (valid range 0..(TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0) 00205 * @param int address display memory location to write bytes (default = 0) 00206 * @return none 00207 */ 00208 void writeData(DisplayData_t data, int length = (TM1637_MAX_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0); 00209 00210 /** Read keydata block from TM1637 00211 * @param *keydata Ptr to bytes for keydata 00212 * @return bool keypress True when at least one key was pressed 00213 * 00214 */ 00215 bool getKeys(KeyData_t *keydata); 00216 00217 /** Set Brightness 00218 * 00219 * @param char brightness (3 significant bits, valid range 0..7 (1/16 .. 14/16 dutycycle) 00220 * @return none 00221 */ 00222 void setBrightness(char brightness = TM1637_BRT_DEF); 00223 00224 /** Set the Display mode On/off 00225 * 00226 * @param bool display mode 00227 */ 00228 void setDisplay(bool on); 00229 00230 private: 00231 #if(SPI==1) 00232 DigitalIn _mosi_nc; //Dummy to avoid breaking deprecated constructor 00233 #endif 00234 DigitalInOut _dio; 00235 DigitalOut _clk; 00236 00237 char _display; 00238 char _bright; 00239 00240 /** Init the Serial interface and the controller 00241 * @param none 00242 * @return none 00243 */ 00244 void _init(); 00245 00246 00247 /** Generate Start condition for TM1637 00248 * @param none 00249 * @return none 00250 */ 00251 void _start(); 00252 00253 /** Generate Stop condition for TM1637 00254 * @param none 00255 * @return none 00256 */ 00257 void _stop(); 00258 00259 /** Send byte to TM1637 00260 * @param int data 00261 * @return none 00262 */ 00263 void _write(int data); 00264 00265 /** Read byte from TM1637 00266 * @return read byte 00267 */ 00268 char _read(); 00269 00270 /** Write command and parameter to TM1637 00271 * @param int cmd Command byte 00272 * &Param int data Parameters for command 00273 * @return none 00274 */ 00275 void _writeCmd(int cmd, int data); 00276 }; 00277 00278 #if (CATALEX_TEST == 1) 00279 // Derived class for TM1637 used in CATALEX display unit with 4 Digits 00280 // 00281 00282 #include "Font_7Seg.h" 00283 00284 #define CATALEX_NR_GRIDS 4 00285 #define CATALEX_NR_DIGITS 4 00286 #define CATALEX_NR_UDC 8 00287 00288 00289 /** Constructor for class for driving TM1637 controller as used in CATALEX 00290 * 00291 * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models). 00292 * Also Supports up to 16 Keys. Serial bus interface device. 00293 * 00294 * @param PinName mosi Serial bus MOSI pin 00295 * @param PinName miso Serial bus MISO pin 00296 * @param PinName sclk Serial bus SCLK pin 00297 */ 00298 class TM1637_CATALEX : public TM1637, public Stream { 00299 public: 00300 00301 /** Enums for Icons */ 00302 // Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00303 enum Icon { 00304 DP1 = ( 1<<24) | S7_DP1, /**< Digit 1 */ 00305 DP2 = ( 2<<24) | S7_DP2, /**< Digit 2 */ 00306 DP3 = ( 3<<24) | S7_DP3, /**< Digit 3 */ 00307 DP4 = ( 4<<24) | S7_DP4, /**< Digit 4 */ 00308 00309 COL2 = ( 2<<24) | S7_DP2, /**< Column 2 */ 00310 }; 00311 00312 typedef char UDCData_t[CATALEX_NR_UDC]; 00313 00314 #if (SPI==1) 00315 /** Constructor for class for driving TM1637 LED controller as used in CATALEX 00316 * 00317 * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models). 00318 * Also Supports up to 16 Keys. Serial bus interface device. 00319 * DEPRECATED version 00320 * 00321 * @param PinName mosi_nc Serial bus NC pin 00322 * @param PinName miso_dio Serial bus DIO pin 00323 * @param PinName sclk_clk Serial bus CLK pin 00324 */ 00325 TM1637_CATALEX(PinName mosi_nc, PinName miso_dio, PinName sclk_clk); 00326 #endif 00327 00328 /** Constructor for class for driving TM1637 LED controller 00329 * 00330 * @brief Supports 4 Digits of 7 Segments + DP (or Colon for Digit2 on some models). 00331 * Also Supports up to 16 Keys. Serial bus interface device. 00332 * 00333 * @param PinName dio Serial bus DIO pin 00334 * @param PinName sck Serial bus CLK pin 00335 */ 00336 TM1637_CATALEX(PinName dio, PinName clk); 00337 00338 00339 #if DOXYGEN_ONLY 00340 /** Write a character to the Display 00341 * 00342 * @param c The character to write to the display 00343 */ 00344 int putc(int c); 00345 00346 /** Write a formatted string to the Display 00347 * 00348 * @param format A printf-style format string, followed by the 00349 * variables to use in formatting the string. 00350 */ 00351 int printf(const char* format, ...); 00352 #endif 00353 00354 /** Locate cursor to a screen column 00355 * 00356 * @param column The horizontal position from the left, indexed from 0 00357 */ 00358 void locate(int column); 00359 00360 /** Clear the screen and locate to 0 00361 * @param bool clrAll Clear Icons also (default = false) 00362 */ 00363 void cls(bool clrAll = false); 00364 00365 /** Set Icon 00366 * 00367 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00368 * @return none 00369 */ 00370 void setIcon(Icon icon); 00371 00372 /** Clr Icon 00373 * 00374 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00375 * @return none 00376 */ 00377 void clrIcon(Icon icon); 00378 00379 /** Set User Defined Characters (UDC) 00380 * 00381 * @param unsigned char udc_idx The Index of the UDC (0..7) 00382 * @param int udc_data The bitpattern for the UDC (16 bits) 00383 */ 00384 void setUDC(unsigned char udc_idx, int udc_data); 00385 00386 00387 /** Number of screen columns 00388 * 00389 * @param none 00390 * @return columns 00391 */ 00392 int columns(); 00393 00394 /** Write databyte to TM1637 00395 * @param char data byte written at given address 00396 * @param int address display memory location to write byte 00397 * @return none 00398 */ 00399 void writeData(char data, int address){ 00400 TM1637::writeData(data, address); 00401 } 00402 00403 /** Write Display datablock to TM1637 00404 * @param DisplayData_t data Array of TM1637_DISPLAY_MEM (=4) bytes for displaydata 00405 * @param length number bytes to write (valid range 0..(CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID) (=4), when starting at address 0) 00406 * @param int address display memory location to write bytes (default = 0) 00407 * @return none 00408 */ 00409 void writeData(DisplayData_t data, int length = (CATALEX_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) { 00410 TM1637::writeData(data, length, address); 00411 } 00412 00413 protected: 00414 // Stream implementation functions 00415 virtual int _putc(int value); 00416 virtual int _getc(); 00417 00418 private: 00419 int _column; 00420 int _columns; 00421 00422 DisplayData_t _displaybuffer; 00423 UDCData_t _UDC_7S; 00424 }; 00425 #endif 00426 00427 #if (ROBOTDYN_TEST == 1) 00428 // Derived class for TM1637 used in ROBOTDYN 6 Digit display unit 00429 // 00430 00431 #include "Font_7Seg.h" 00432 00433 #define ROBOTDYN_NR_GRIDS 6 00434 #define ROBOTDYN_NR_DIGITS 6 00435 #define ROBOTDYN_NR_UDC 8 00436 00437 00438 /** Constructor for class for driving TM1637 controller as used in ROBOTDYN 00439 * 00440 * @brief Supports 6 Digits of 7 Segments + DP. 00441 * 00442 * @param PinName dio Serial bus DIO pin 00443 * @param PinName clk Serial bus CLK pin 00444 */ 00445 class TM1637_ROBOTDYN : public TM1637, public Stream { 00446 public: 00447 00448 /** Enums for Icons */ 00449 // Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00450 // Note that Digits 1,3 and 4,6 are swapped! 00451 enum Icon { 00452 DP1 = ( 3<<24) | S7_DP1, /**< Digit 1 */ 00453 DP2 = ( 2<<24) | S7_DP2, /**< Digit 2 */ 00454 DP3 = ( 1<<24) | S7_DP3, /**< Digit 3 */ 00455 DP4 = ( 6<<24) | S7_DP4, /**< Digit 4 */ 00456 DP5 = ( 5<<24) | S7_DP5, /**< Digit 5 */ 00457 DP6 = ( 4<<24) | S7_DP6, /**< Digit 6 */ 00458 }; 00459 00460 typedef char UDCData_t[ROBOTDYN_NR_UDC]; 00461 00462 /** Constructor for class for driving TM1637 LED controller as used in ROBOTDYN 00463 * 00464 * @brief Supports 6 Digits of 7 Segments + DP. Also supports up to 16 Keys. 00465 * 00466 * @param PinName dio Serial bus DIO pin 00467 * @param PinName clk Serial bus CLK pin 00468 */ 00469 TM1637_ROBOTDYN(PinName dio, PinName clk); 00470 00471 00472 #if DOXYGEN_ONLY 00473 /** Write a character to the Display 00474 * 00475 * @param c The character to write to the display 00476 */ 00477 int putc(int c); 00478 00479 /** Write a formatted string to the Display 00480 * 00481 * @param format A printf-style format string, followed by the 00482 * variables to use in formatting the string. 00483 */ 00484 int printf(const char* format, ...); 00485 #endif 00486 00487 /** Locate cursor to a screen column 00488 * 00489 * @param column The horizontal position from the left, indexed from 0 00490 */ 00491 void locate(int column); 00492 00493 /** Clear the screen and locate to 0 00494 * @param bool clrAll Clear Icons also (default = false) 00495 */ 00496 void cls(bool clrAll = false); 00497 00498 /** Set Icon 00499 * 00500 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00501 * @return none 00502 */ 00503 void setIcon(Icon icon); 00504 00505 /** Clr Icon 00506 * 00507 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00508 * @return none 00509 */ 00510 void clrIcon(Icon icon); 00511 00512 /** Set User Defined Characters (UDC) 00513 * 00514 * @param unsigned char udc_idx The Index of the UDC (0..7) 00515 * @param int udc_data The bitpattern for the UDC (16 bits) 00516 */ 00517 void setUDC(unsigned char udc_idx, int udc_data); 00518 00519 00520 /** Number of screen columns 00521 * 00522 * @param none 00523 * @return columns 00524 */ 00525 int columns(); 00526 00527 /** Write databyte to TM1637 00528 * @param char data byte written at given address 00529 * @param int address display memory location to write byte 00530 * @return none 00531 */ 00532 void writeData(char data, int address){ 00533 TM1637::writeData(data, address); 00534 } 00535 00536 /** Write Display datablock to TM1637 00537 * @param DisplayData_t data Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata 00538 * @param length number bytes to write (valid range 0..(ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0) 00539 * @param int address display memory location to write bytes (default = 0) 00540 * @return none 00541 */ 00542 void writeData(DisplayData_t data, int length = (ROBOTDYN_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) { 00543 TM1637::writeData(data, length, address); 00544 } 00545 00546 protected: 00547 // Stream implementation functions 00548 virtual int _putc(int value); 00549 virtual int _getc(); 00550 00551 private: 00552 int _column; 00553 int _columns; 00554 00555 DisplayData_t _displaybuffer; 00556 UDCData_t _UDC_7S; 00557 }; 00558 #endif 00559 00560 00561 #if (EYEWINK_TEST == 1) 00562 // Derived class for TM1637 used in EYEWINK 6 Digit + 6 Keys display unit 00563 // 00564 00565 #include "Font_7Seg.h" 00566 00567 #define EYEWINK_NR_GRIDS 6 00568 #define EYEWINK_NR_DIGITS 6 00569 #define EYEWINK_NR_UDC 8 00570 00571 00572 /** Constructor for class for driving TM1637 controller as used in EYEWINK 00573 * 00574 * @brief Supports 6 Digits of 7 Segments + DP and 6 Keys. 00575 * 00576 * @param PinName dio Serial bus DIO pin 00577 * @param PinName clk Serial bus CLK pin 00578 */ 00579 class TM1637_EYEWINK : public TM1637, public Stream { 00580 public: 00581 00582 /** Enums for Icons */ 00583 // Grid encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00584 enum Icon { 00585 DP1 = ( 1<<24) | S7_DP1, /**< Digit 1 */ 00586 DP2 = ( 2<<24) | S7_DP2, /**< Digit 2 */ 00587 DP3 = ( 3<<24) | S7_DP3, /**< Digit 3 */ 00588 DP4 = ( 4<<24) | S7_DP4, /**< Digit 4 */ 00589 DP5 = ( 5<<24) | S7_DP5, /**< Digit 5 */ 00590 DP6 = ( 6<<24) | S7_DP6, /**< Digit 6 */ 00591 }; 00592 00593 typedef char UDCData_t[EYEWINK_NR_UDC]; 00594 00595 /** Constructor for class for driving TM1637 LED controller as used in EYEWINK 00596 * 00597 * @brief Supports 6 Digits of 7 Segments + DP. 00598 * 00599 * @param PinName dio Serial bus DIO pin 00600 * @param PinName clk Serial bus CLK pin 00601 */ 00602 TM1637_EYEWINK(PinName dio, PinName clk); 00603 00604 00605 #if DOXYGEN_ONLY 00606 /** Write a character to the Display 00607 * 00608 * @param c The character to write to the display 00609 */ 00610 int putc(int c); 00611 00612 /** Write a formatted string to the Display 00613 * 00614 * @param format A printf-style format string, followed by the 00615 * variables to use in formatting the string. 00616 */ 00617 int printf(const char* format, ...); 00618 #endif 00619 00620 /** Locate cursor to a screen column 00621 * 00622 * @param column The horizontal position from the left, indexed from 0 00623 */ 00624 void locate(int column); 00625 00626 /** Clear the screen and locate to 0 00627 * @param bool clrAll Clear Icons also (default = false) 00628 */ 00629 void cls(bool clrAll = false); 00630 00631 /** Set Icon 00632 * 00633 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00634 * @return none 00635 */ 00636 void setIcon(Icon icon); 00637 00638 /** Clr Icon 00639 * 00640 * @param Icon icon Enums Icon has Grid position encoded in 8 MSBs, Icon pattern encoded in 16 LSBs 00641 * @return none 00642 */ 00643 void clrIcon(Icon icon); 00644 00645 /** Set User Defined Characters (UDC) 00646 * 00647 * @param unsigned char udc_idx The Index of the UDC (0..7) 00648 * @param int udc_data The bitpattern for the UDC (16 bits) 00649 */ 00650 void setUDC(unsigned char udc_idx, int udc_data); 00651 00652 00653 /** Number of screen columns 00654 * 00655 * @param none 00656 * @return columns 00657 */ 00658 int columns(); 00659 00660 /** Write databyte to TM1637 00661 * @param char data byte written at given address 00662 * @param int address display memory location to write byte 00663 * @return none 00664 */ 00665 void writeData(char data, int address){ 00666 TM1637::writeData(data, address); 00667 } 00668 00669 /** Write Display datablock to TM1637 00670 * @param DisplayData_t data Array of TM1637_DISPLAY_MEM (=6) bytes for displaydata 00671 * @param length number bytes to write (valid range 0..(EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID) (=6), when starting at address 0) 00672 * @param int address display memory location to write bytes (default = 0) 00673 * @return none 00674 */ 00675 void writeData(DisplayData_t data, int length = (EYEWINK_NR_GRIDS * TM1637_BYTES_PER_GRID), int address = 0) { 00676 TM1637::writeData(data, length, address); 00677 } 00678 00679 protected: 00680 // Stream implementation functions 00681 virtual int _putc(int value); 00682 virtual int _getc(); 00683 00684 private: 00685 int _column; 00686 int _columns; 00687 00688 DisplayData_t _displaybuffer; 00689 UDCData_t _UDC_7S; 00690 }; 00691 #endif 00692 00693 #endif
Generated on Wed Jul 13 2022 07:50:57 by
1.7.2
