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.

lcdprint.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @file lcdprint.h
  3. * @brief LCD print api
  4. * @author Yunhui Fu (yhfudev@gmail.com)
  5. * @version 1.0
  6. * @date 2016-08-19
  7. * @copyright GPL/BSD
  8. */
  9. #pragma once
  10. #include "fontutils.h"
  11. #include "../inc/MarlinConfig.h"
  12. #if HAS_GRAPHICAL_LCD
  13. #include "dogm/u8g_fontutf8.h"
  14. typedef u8g_uint_t lcd_uint_t;
  15. #else
  16. #define _UxGT(a) a
  17. typedef uint8_t lcd_uint_t;
  18. #endif
  19. #define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u)
  20. int lcd_glyph_height();
  21. int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length);
  22. /**
  23. * @brief Draw a UTF-8 string
  24. *
  25. * @param utf8_str : the UTF-8 string
  26. * @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
  27. *
  28. * @return the pixel width
  29. *
  30. * Draw a UTF-8 string
  31. */
  32. int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
  33. /**
  34. * Set the print baseline position
  35. */
  36. void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row);
  37. /**
  38. * @brief Draw a ROM UTF-8 string
  39. *
  40. * @param utf8_str_P : the ROM UTF-8 string
  41. * @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
  42. *
  43. * @return the pixel width
  44. *
  45. * Draw a ROM UTF-8 string
  46. */
  47. int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
  48. inline int lcd_put_u8str_max_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P utf8_str_P, pixel_len_t max_length) {
  49. lcd_moveto(col, row);
  50. return lcd_put_u8str_max_P(utf8_str_P, max_length);
  51. }
  52. void lcd_put_int(const int i);
  53. inline void lcd_put_int(const lcd_uint_t col, const lcd_uint_t row, const int i) {
  54. lcd_moveto(col, row);
  55. lcd_put_int(i);
  56. }
  57. inline int lcd_put_u8str_P(PGM_P const pstr) { return lcd_put_u8str_max_P(pstr, PIXEL_LEN_NOLIMIT); }
  58. inline int lcd_put_u8str_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr) {
  59. lcd_moveto(col, row);
  60. return lcd_put_u8str_P(pstr);
  61. }
  62. lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen=LCD_WIDTH);
  63. inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const uint8_t ind, const lcd_uint_t maxlen=LCD_WIDTH) {
  64. lcd_moveto(col, row);
  65. return lcd_put_u8str_ind_P(pstr, ind, maxlen);
  66. }
  67. inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
  68. inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, PGM_P const str) {
  69. lcd_moveto(col, row);
  70. return lcd_put_u8str(str);
  71. }
  72. inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
  73. inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) {
  74. lcd_moveto(col, row);
  75. return lcd_put_wchar(c);
  76. }