My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LiquidCrystalRus.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // based on LiquidCrystal library from ArduinoIDE, see http://arduino.cc
  3. // modified 27 Jul 2011
  4. // by Ilya V. Danilov http://mk90.ru/
  5. //
  6. #ifndef LiquidCrystalRus_h
  7. #define LiquidCrystalRus_h
  8. #include <inttypes.h>
  9. #include "Print.h"
  10. // commands
  11. #define LCD_CLEARDISPLAY 0x01
  12. #define LCD_RETURNHOME 0x02
  13. #define LCD_ENTRYMODESET 0x04
  14. #define LCD_DISPLAYCONTROL 0x08
  15. #define LCD_CURSORSHIFT 0x10
  16. #define LCD_FUNCTIONSET 0x20
  17. #define LCD_SETCGRAMADDR 0x40
  18. #define LCD_SETDDRAMADDR 0x80
  19. // flags for display entry mode
  20. #define LCD_ENTRYRIGHT 0x00
  21. #define LCD_ENTRYLEFT 0x02
  22. #define LCD_ENTRYSHIFTINCREMENT 0x01
  23. #define LCD_ENTRYSHIFTDECREMENT 0x00
  24. // flags for display on/off control
  25. #define LCD_DISPLAYON 0x04
  26. #define LCD_DISPLAYOFF 0x00
  27. #define LCD_CURSORON 0x02
  28. #define LCD_CURSOROFF 0x00
  29. #define LCD_BLINKON 0x01
  30. #define LCD_BLINKOFF 0x00
  31. // flags for display/cursor shift
  32. #define LCD_DISPLAYMOVE 0x08
  33. #define LCD_CURSORMOVE 0x00
  34. #define LCD_MOVERIGHT 0x04
  35. #define LCD_MOVELEFT 0x00
  36. // flags for function set
  37. #define LCD_8BITMODE 0x10
  38. #define LCD_4BITMODE 0x00
  39. #define LCD_2LINE 0x08
  40. #define LCD_1LINE 0x00
  41. #define LCD_5x10DOTS 0x04
  42. #define LCD_5x8DOTS 0x00
  43. // enum for
  44. #define LCD_DRAM_Normal 0x00
  45. #define LCD_DRAM_WH1601 0x01
  46. class LiquidCrystalRus : public Print {
  47. public:
  48. LiquidCrystalRus(uint8_t rs, uint8_t enable,
  49. uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
  50. uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
  51. LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
  52. uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
  53. uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
  54. LiquidCrystalRus(uint8_t rs, uint8_t rw, uint8_t enable,
  55. uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
  56. LiquidCrystalRus(uint8_t rs, uint8_t enable,
  57. uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
  58. void init(uint8_t fourbitmode, uint8_t rs, uint8_t rw, uint8_t enable,
  59. uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
  60. uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
  61. void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
  62. void clear();
  63. void home();
  64. void noDisplay();
  65. void display();
  66. void noBlink();
  67. void blink();
  68. void noCursor();
  69. void cursor();
  70. void scrollDisplayLeft();
  71. void scrollDisplayRight();
  72. void leftToRight();
  73. void rightToLeft();
  74. void autoscroll();
  75. void noAutoscroll();
  76. void createChar(uint8_t, uint8_t[]);
  77. void setCursor(uint8_t, uint8_t);
  78. #if defined(ARDUINO) && ARDUINO >= 100
  79. virtual size_t write(uint8_t);
  80. using Print::write;
  81. #else
  82. virtual void write(uint8_t);
  83. #endif
  84. void command(uint8_t);
  85. void setDRAMModel(uint8_t);
  86. private:
  87. void send(uint8_t, uint8_t);
  88. void writeNbits(uint8_t, uint8_t);
  89. uint8_t recv(uint8_t);
  90. uint8_t readNbits(uint8_t);
  91. void pulseEnable();
  92. uint8_t _rs_pin; // LOW: command. HIGH: character.
  93. uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
  94. uint8_t _enable_pin; // activated by a HIGH pulse.
  95. uint8_t _data_pins[8];
  96. uint8_t _displayfunction;
  97. uint8_t _displaycontrol;
  98. uint8_t _displaymode;
  99. uint8_t _initialized;
  100. uint8_t _numlines,_currline;
  101. uint8_t _dram_model;
  102. uint8_t utf_hi_char; // UTF-8 high part
  103. };
  104. #endif