UP LVGL字库加载显示支持
This commit is contained in:
44
lib/inc/font/font.h
Normal file
44
lib/inc/font/font.h
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef HW_LIB_FONT_H
|
||||
#define HW_LIB_FONT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lvgl.h"
|
||||
|
||||
// 定义像素颜色的位数
|
||||
#define PIX_COLOR_SIZE 1
|
||||
|
||||
// 启用单行刷新
|
||||
#define LINE_FAST_SHOW
|
||||
|
||||
typedef struct Font Font_f_t;
|
||||
typedef void (*Font_Show_t)(Font_f_t *font, uint8_t *data, size_t len);
|
||||
struct Font {
|
||||
void *dev;
|
||||
uint8_t dev_w;
|
||||
uint16_t x, y, w, h;
|
||||
Font_Show_t show;
|
||||
#if PIX_COLOR_SIZE == 16
|
||||
uint16_t pixcolor;
|
||||
uint16_t backgroundcolor;
|
||||
#endif
|
||||
};
|
||||
|
||||
char Font_utf8_to_unicode(uint8_t *pInput, uint32_t *unicode_letter);
|
||||
|
||||
char Font_draw_letter(const lv_font_t *font, Font_f_t *fd, uint32_t letter, int16_t pos_x, int16_t pos_y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,20 +0,0 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __lvgl_font_H
|
||||
#define __lvgl_font_H
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lvgl.h"
|
||||
|
||||
#define LV_ANTIALIAS 0 //抗锯齿
|
||||
|
||||
char utf8_to_unicode(uint8_t *pInput, uint32_t *unicode_letter);
|
||||
|
||||
char lv_draw_letter(const lv_font_t *font, uint32_t letter, int16_t pos_x, int16_t pos_y);
|
||||
|
||||
#endif
|
@@ -6,6 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "stdint.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
|
||||
#define REFRESH_CALL_ENABLE 1 //使用DMA或者整体刷新函数
|
||||
@@ -278,6 +279,9 @@ void OLED_Fill(OLED_T *dev, uint8_t data);
|
||||
*/
|
||||
void OLED_CLS(OLED_T *dev);
|
||||
|
||||
|
||||
void OLED_DisplayString(OLED_T *dev, const lv_font_t *font, uint8_t *s, uint16_t x, uint16_t y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user