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.

LiquidCrystal.h 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef LiquidCrystal_h
  2. #define LiquidCrystal_h
  3. #include <inttypes.h>
  4. #include "binary.h"
  5. #include "Print.h"
  6. #include <HAL_LPC1768/pinmapping.h>
  7. // commands
  8. #define LCD_CLEARDISPLAY 0x01
  9. #define LCD_RETURNHOME 0x02
  10. #define LCD_ENTRYMODESET 0x04
  11. #define LCD_DISPLAYCONTROL 0x08
  12. #define LCD_CURSORSHIFT 0x10
  13. #define LCD_FUNCTIONSET 0x20
  14. #define LCD_SETCGRAMADDR 0x40
  15. #define LCD_SETDDRAMADDR 0x80
  16. // flags for display entry mode
  17. #define LCD_ENTRYRIGHT 0x00
  18. #define LCD_ENTRYLEFT 0x02
  19. #define LCD_ENTRYSHIFTINCREMENT 0x01
  20. #define LCD_ENTRYSHIFTDECREMENT 0x00
  21. // flags for display on/off control
  22. #define LCD_DISPLAYON 0x04
  23. #define LCD_DISPLAYOFF 0x00
  24. #define LCD_CURSORON 0x02
  25. #define LCD_CURSOROFF 0x00
  26. #define LCD_BLINKON 0x01
  27. #define LCD_BLINKOFF 0x00
  28. // flags for display/cursor shift
  29. #define LCD_DISPLAYMOVE 0x08
  30. #define LCD_CURSORMOVE 0x00
  31. #define LCD_MOVERIGHT 0x04
  32. #define LCD_MOVELEFT 0x00
  33. // flags for function set
  34. #define LCD_8BITMODE 0x10
  35. #define LCD_4BITMODE 0x00
  36. #define LCD_2LINE 0x08
  37. #define LCD_1LINE 0x00
  38. #define LCD_5x10DOTS 0x04
  39. #define LCD_5x8DOTS 0x00
  40. class LiquidCrystal : public Print {
  41. public:
  42. LiquidCrystal(pin_t rs, pin_t enable,
  43. pin_t d0, pin_t d1, pin_t d2, pin_t d3,
  44. pin_t d4, pin_t d5, pin_t d6, pin_t d7);
  45. LiquidCrystal(pin_t rs, pin_t rw, pin_t enable,
  46. pin_t d0, pin_t d1, pin_t d2, pin_t d3,
  47. pin_t d4, pin_t d5, pin_t d6, pin_t d7);
  48. LiquidCrystal(pin_t rs, pin_t rw, pin_t enable,
  49. pin_t d0, pin_t d1, pin_t d2, pin_t d3);
  50. LiquidCrystal(pin_t rs, pin_t enable,
  51. pin_t d0, pin_t d1, pin_t d2, pin_t d3);
  52. void init(uint8_t fourbitmode, pin_t rs, pin_t rw, pin_t enable,
  53. pin_t d0, pin_t d1, pin_t d2, pin_t d3,
  54. pin_t d4, pin_t d5, pin_t d6, pin_t d7);
  55. void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);
  56. void clear();
  57. void home();
  58. void noDisplay();
  59. void display();
  60. void noBlink();
  61. void blink();
  62. void noCursor();
  63. void cursor();
  64. void scrollDisplayLeft();
  65. void scrollDisplayRight();
  66. void leftToRight();
  67. void rightToLeft();
  68. void autoscroll();
  69. void noAutoscroll();
  70. void setRowOffsets(int row1, int row2, int row3, int row4);
  71. void createChar(uint8_t, uint8_t[]);
  72. void setCursor(uint8_t, uint8_t);
  73. virtual size_t write(uint8_t);
  74. void command(uint8_t);
  75. using Print::write;
  76. private:
  77. void send(uint8_t, uint8_t);
  78. void write4bits(uint8_t);
  79. void write8bits(uint8_t);
  80. void pulseEnable();
  81. pin_t _rs_pin; // LOW: command. HIGH: character.
  82. pin_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD.
  83. pin_t _enable_pin; // activated by a HIGH pulse.
  84. pin_t _data_pins[8];
  85. uint8_t _displayfunction;
  86. uint8_t _displaycontrol;
  87. uint8_t _displaymode;
  88. uint8_t _initialized;
  89. uint8_t _numlines;
  90. uint8_t _row_offsets[4];
  91. };
  92. #endif