2018-04-13 01:14:01 +00:00
|
|
|
/**
|
2018-11-10 23:51:49 +00:00
|
|
|
* @file lcdprint_u8g.cpp
|
2018-04-13 01:14:01 +00:00
|
|
|
* @brief LCD print api for u8glib
|
|
|
|
* @author Yunhui Fu (yhfudev@gmail.com)
|
|
|
|
* @version 1.0
|
|
|
|
* @date 2016-08-19
|
|
|
|
* @copyright GPL/BSD
|
|
|
|
*/
|
|
|
|
|
2018-10-23 21:00:34 +00:00
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#if HAS_GRAPHICAL_LCD
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-11-19 12:20:17 +00:00
|
|
|
#include "ultralcd_DOGM.h"
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-10-23 21:00:34 +00:00
|
|
|
#include "../ultralcd.h"
|
|
|
|
#include "../../Marlin.h"
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-10-23 21:00:34 +00:00
|
|
|
#include "../fontutils.h"
|
2018-04-13 01:14:01 +00:00
|
|
|
#include "u8g_fontutf8.h"
|
2018-10-23 21:00:34 +00:00
|
|
|
#include "../lcdprint.h"
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-11-19 07:33:59 +00:00
|
|
|
int lcd_glyph_height(void) { return u8g_GetFontBBXHeight(u8g.getU8g()); }
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2019-08-18 00:58:38 +00:00
|
|
|
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) { u8g.setPrintPos(col, row); }
|
2018-11-19 02:39:49 +00:00
|
|
|
|
2018-11-19 07:33:59 +00:00
|
|
|
void lcd_put_int(const int i) { u8g.print(i); }
|
2018-04-13 01:14:01 +00:00
|
|
|
|
2018-05-26 04:32:37 +00:00
|
|
|
// return < 0 on error
|
|
|
|
// return the advanced pixels
|
2018-11-20 14:19:35 +00:00
|
|
|
int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
|
2018-04-13 01:14:01 +00:00
|
|
|
if (c < 256) {
|
2018-11-19 07:33:59 +00:00
|
|
|
u8g.print((char)c);
|
|
|
|
return u8g_GetFontBBXWidth(u8g.getU8g());
|
2018-04-13 01:14:01 +00:00
|
|
|
}
|
2019-08-18 00:58:38 +00:00
|
|
|
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
|
|
|
ret = uxg_DrawWchar(u8g.getU8g(), x, y, c, max_length);
|
2018-11-19 07:33:59 +00:00
|
|
|
u8g.setPrintPos(x + ret, y);
|
2018-04-13 01:14:01 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-20 14:19:35 +00:00
|
|
|
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
|
2019-08-18 00:58:38 +00:00
|
|
|
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
|
|
|
ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length);
|
2018-11-19 07:33:59 +00:00
|
|
|
u8g.setPrintPos(x + ret, y);
|
2018-04-13 01:14:01 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-20 14:19:35 +00:00
|
|
|
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
|
2019-08-18 00:58:38 +00:00
|
|
|
u8g_uint_t x = u8g.getPrintCol(), y = u8g.getPrintRow(),
|
|
|
|
ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length);
|
2018-11-19 07:33:59 +00:00
|
|
|
u8g.setPrintPos(x + ret, y);
|
2018-04-13 01:14:01 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-10-30 21:34:45 +00:00
|
|
|
#endif // HAS_GRAPHICAL_LCD
|