2018-04-12 20:14:01 -05:00
|
|
|
/**
|
|
|
|
* @file lcdprint.h
|
|
|
|
* @brief LCD print api
|
|
|
|
* @author Yunhui Fu (yhfudev@gmail.com)
|
|
|
|
* @version 1.0
|
|
|
|
* @date 2016-08-19
|
|
|
|
* @copyright GPL/BSD
|
|
|
|
*/
|
2018-10-24 02:27:19 -05:00
|
|
|
#pragma once
|
2018-04-12 20:14:01 -05:00
|
|
|
|
|
|
|
#include "fontutils.h"
|
|
|
|
|
2019-11-24 19:06:23 -06:00
|
|
|
#include "../inc/MarlinConfig.h"
|
2018-10-23 16:00:34 -05:00
|
|
|
|
|
|
|
#if HAS_GRAPHICAL_LCD
|
|
|
|
#include "dogm/u8g_fontutf8.h"
|
2019-08-17 19:58:38 -05:00
|
|
|
typedef u8g_uint_t lcd_uint_t;
|
2018-04-12 20:14:01 -05:00
|
|
|
#else
|
2018-10-23 16:00:34 -05:00
|
|
|
#define _UxGT(a) a
|
2019-08-17 19:58:38 -05:00
|
|
|
typedef uint8_t lcd_uint_t;
|
2018-04-12 20:14:01 -05:00
|
|
|
#endif
|
|
|
|
|
2018-05-25 23:32:37 -05:00
|
|
|
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80u)
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2019-09-16 20:31:08 -05:00
|
|
|
int lcd_glyph_height();
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2018-11-20 08:19:35 -06:00
|
|
|
int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length);
|
2018-04-12 20:14:01 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Draw a UTF-8 string
|
|
|
|
*
|
|
|
|
* @param utf8_str : the UTF-8 string
|
|
|
|
* @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
|
|
|
|
*
|
|
|
|
* @return the pixel width
|
|
|
|
*
|
|
|
|
* Draw a UTF-8 string
|
|
|
|
*/
|
2018-11-20 08:19:35 -06:00
|
|
|
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2019-08-22 19:36:18 -05:00
|
|
|
/**
|
|
|
|
* Set the print baseline position
|
|
|
|
*/
|
|
|
|
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row);
|
|
|
|
|
2018-04-12 20:14:01 -05:00
|
|
|
/**
|
|
|
|
* @brief Draw a ROM UTF-8 string
|
|
|
|
*
|
|
|
|
* @param utf8_str_P : the ROM UTF-8 string
|
|
|
|
* @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
|
|
|
|
*
|
|
|
|
* @return the pixel width
|
|
|
|
*
|
|
|
|
* Draw a ROM UTF-8 string
|
|
|
|
*/
|
2018-11-20 08:19:35 -06:00
|
|
|
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
|
2019-08-22 19:36:18 -05:00
|
|
|
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) {
|
|
|
|
lcd_moveto(col, row);
|
|
|
|
return lcd_put_u8str_max_P(utf8_str_P, max_length);
|
|
|
|
}
|
2018-11-18 20:39:49 -06:00
|
|
|
|
|
|
|
void lcd_put_int(const int i);
|
2019-11-14 20:30:30 -06:00
|
|
|
inline void lcd_put_int(const lcd_uint_t col, const lcd_uint_t row, const int i) {
|
|
|
|
lcd_moveto(col, row);
|
|
|
|
lcd_put_int(i);
|
|
|
|
}
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2019-11-14 20:30:30 -06:00
|
|
|
inline int lcd_put_u8str_P(PGM_P const pstr) { return lcd_put_u8str_max_P(pstr, PIXEL_LEN_NOLIMIT); }
|
|
|
|
inline int lcd_put_u8str_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr) {
|
|
|
|
lcd_moveto(col, row);
|
|
|
|
return lcd_put_u8str_P(pstr);
|
|
|
|
}
|
|
|
|
|
2020-06-10 18:35:56 -05:00
|
|
|
lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, const lcd_uint_t maxlen=LCD_WIDTH);
|
|
|
|
inline lcd_uint_t lcd_put_u8str_ind_P(const lcd_uint_t col, const lcd_uint_t row, PGM_P const pstr, const int8_t ind, const lcd_uint_t maxlen=LCD_WIDTH) {
|
2019-11-14 20:30:30 -06:00
|
|
|
lcd_moveto(col, row);
|
|
|
|
return lcd_put_u8str_ind_P(pstr, ind, maxlen);
|
|
|
|
}
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2018-11-20 08:19:35 -06:00
|
|
|
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }
|
2019-11-14 20:30:30 -06:00
|
|
|
inline int lcd_put_u8str(const lcd_uint_t col, const lcd_uint_t row, PGM_P const str) {
|
|
|
|
lcd_moveto(col, row);
|
|
|
|
return lcd_put_u8str(str);
|
|
|
|
}
|
2018-04-12 20:14:01 -05:00
|
|
|
|
2018-11-18 20:39:49 -06:00
|
|
|
inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); }
|
2019-11-14 20:30:30 -06:00
|
|
|
inline int lcd_put_wchar(const lcd_uint_t col, const lcd_uint_t row, const wchar_t c) {
|
|
|
|
lcd_moveto(col, row);
|
|
|
|
return lcd_put_wchar(c);
|
|
|
|
}
|