Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
LCDKeypad.h
Go to the documentation of this file.
1 /*
2  LCDKeypad.h
3  */
4 
5 // ensure this library description is only included once
6 #ifndef LCDKeypad_h
7 #define LCDKeypad_h
8 
9 // library interface description
10 #define KEYPAD_NONE -1
11 #define KEYPAD_RIGHT 0
12 #define KEYPAD_UP 1
13 #define KEYPAD_DOWN 2
14 #define KEYPAD_LEFT 3
15 #define KEYPAD_SELECT 4
16 
17 //! @ingroup Third_Party
18 //! @{
19 //! @defgroup PRINT_MACROS LCD serial print macros
20 //! @}
21 
22 /** Macros used to print simultaneously on LCD and serial port
23 * @{
24 */
25 /** \brief writes degree C sign */
26 #define WRITE_DEGREE_C() \
27  { if (lcd->foundLCD) {lcd->write((uint8_t)0); lcd->print('C');} \
28  if (lcd->EnableSerialOutput) {Serial.write((uint8_t)176); Serial.print('C');} }
29 /** \brief clear screen */
30 #define CLEAR_SCREEN() { if (lcd->foundLCD) { \
31  lcd->clear(); \
32  lcd->display(); \
33  lcd->setCursor(0, 0);} \
34  if (lcd->EnableSerialOutput) Serial.println(); }
35 /** \brief print newline */
36 #define NEWLINE() { if (lcd->foundLCD) lcd->setCursor(0, 1); if (lcd->EnableSerialOutput) Serial.println(); }
37 /** \brief print value / text
38 \param A value / text to be written */
39 #define PRINTSCREEN(A) { if (lcd->foundLCD) lcd->print(A); if (lcd->EnableSerialOutput) Serial.print(A); }
40 /** \brief print formatted value
41 \param A value
42 \param B formatting argument */
43 #define PRINTSCREEN2(A,B) { if (lcd->foundLCD) lcd->print(A,B); if (lcd->EnableSerialOutput) Serial.print(A,B); }
44 /** \brief move cursor
45 \param A column
46 \param B row */
47 #define SCREENSETCURSOR(A,B) { if (lcd->foundLCD) lcd->setCursor(A,B); if (lcd->EnableSerialOutput) Serial.print(' '); }
48 /** @} */ // end of PRINT_MACROS
49 
50 
51 class LCDKeypad : public LiquidCrystal
52 {
53  public:
54  LCDKeypad(uint8_t ledCtrlPin);
55  int button();
56  void searchForLCD();
57  void Disable4BitLCD();
58  void LEDon();
59  void LEDoff();
60  static uint8_t degree[8];
61 
62  boolean foundLCD = false;
64  private:
65  uint8_t _ledCtrlPin;
66 };
67 
68 #endif
69 
70 
71 
int button()
Definition: LCDKeypad.cpp:92
static uint8_t degree[8]
degree sign for LCD see https://omerk.github.io/lcdchargen/
Definition: LCDKeypad.h:60
boolean foundLCD
Definition: LCDKeypad.h:62
void LEDoff()
Definition: LCDKeypad.cpp:113
boolean EnableSerialOutput
Definition: LCDKeypad.h:63
void LEDon()
Definition: LCDKeypad.cpp:107
LCDKeypad(uint8_t ledCtrlPin)
Definition: LCDKeypad.cpp:78
void Disable4BitLCD()
Definition: LCDKeypad.cpp:63
void searchForLCD()
Definition: LCDKeypad.cpp:47