My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

LiquidCrystal.h 2.8KB

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