My Project
TM1638QYF.h
Go to the documentation of this file.
1 /*
2 TM1638QYF.h - Library for TM1638.
3 
4 Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>
5 
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the version 3 GNU General Public License as
8 published by the Free Software Foundation.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef TM1638QYF_h
20 #define TM1638QYF_h
21 
22 #if defined(ARDUINO) && ARDUINO >= 100
23  #include "Arduino.h"
24 #else
25  #include "WProgram.h"
26 #endif
27 
28 #include "TM16XX.h"
29 #include "TM16XXFonts.h"
30 
31 class TM1638QYF : public TM16XX
32 {
33  public:
35  TM1638QYF(byte dataPin, byte clockPin, byte strobePin, boolean activateDisplay = true, byte intensity = 7);
36 
38  void setDisplayToHexNumber(unsigned long number, byte dots, boolean leadingZeros = true,
39  const byte numberFont[] = FONT_DEFAULT);
41  void setDisplayToDecNumber(unsigned long number, byte dots, boolean leadingZeros = true,
42  const byte numberFont[] = FONT_DEFAULT);
44  void setDisplayToSignedDecNumber(signed long number, byte dots, boolean leadingZeros = true,
45  const byte numberFont[] = FONT_DEFAULT);
47  void setDisplayToBinNumber(byte number, byte dots,
48  const byte numberFont[] = NUMBER_FONT);
49 
51  virtual void clearDisplay();
53  virtual void setDisplayToString(const char* string, const word dots = 0, const byte pos = 0,
54  const byte font[] = FONT_DEFAULT);
56  virtual void setDisplayToString(String string, const word dots = 0, const byte pos = 0,
57  const byte font[] = FONT_DEFAULT);
58 
60  virtual word getButtons();
61 
62  protected:
64  virtual void setDisplay(const byte values[], unsigned int length = 8);
65 
66  private:
67  // unsupported in common anode design
68  virtual void setDisplayDigit(byte digit, byte pos, boolean dot, const byte numberFont[] = NUMBER_FONT) { setDisplayToError(); };
69  // unsupported in common anode design
70  virtual void clearDisplayDigit(byte pos, boolean dot) { setDisplayToError(); };
71  // unsupported in common anode design
72  virtual void sendChar(byte pos, byte data, boolean dot) { setDisplayToError(); }
73 };
74 
75 #endif
virtual void setDisplayToError()
Definition: TM16XX.cpp:70
byte dataPin
Definition: TM16XX.h:76
byte strobePin
Definition: TM16XX.h:78
byte clockPin
Definition: TM16XX.h:77
const byte FONT_DEFAULT[]
Definition: TM16XXFonts.h:68
void setDisplayToDecNumber(unsigned long number, byte dots, boolean leadingZeros=true, const byte numberFont[]=FONT_DEFAULT)
Definition: TM1638QYF.cpp:112
const byte NUMBER_FONT[]
Definition: TM16XXFonts.h:34
virtual word getButtons()
Definition: TM1638QYF.cpp:134
Definition: TM1638QYF.h:31
void setDisplayToSignedDecNumber(signed long number, byte dots, boolean leadingZeros=true, const byte numberFont[]=FONT_DEFAULT)
Definition: TM1638QYF.cpp:124
virtual void setDisplayToString(const char *string, const word dots=0, const byte pos=0, const byte font[]=FONT_DEFAULT)
Definition: TM1638QYF.cpp:52
virtual void setDisplay(const byte values[], unsigned int length=8)
Definition: TM1638QYF.cpp:34
void setDisplayToHexNumber(unsigned long number, byte dots, boolean leadingZeros=true, const byte numberFont[]=FONT_DEFAULT)
Definition: TM1638QYF.cpp:102
virtual void clearDisplay()
Definition: TM1638QYF.cpp:47
Definition: TM16XX.h:30
void setDisplayToBinNumber(byte number, byte dots, const byte numberFont[]=NUMBER_FONT)
Definition: TM1638QYF.cpp:89
TM1638QYF(byte dataPin, byte clockPin, byte strobePin, boolean activateDisplay=true, byte intensity=7)
Definition: TM1638QYF.cpp:28