General updates, added HPM settings.

This commit is contained in:
imi415 2021-04-21 01:35:38 +08:00
parent a16a03dd1c
commit 00edc75a38
Signed by: imi415
GPG Key ID: 17F01E106F9F5E0A
13 changed files with 752 additions and 149 deletions

View File

@ -5,141 +5,49 @@ project(lcd_jlx C)
set(CMAKE_C_STANDARD 11)
set(SOURCES
main.c
st75256_impl.c
st7302_impl.c
st75256_lvgl_impl.c
st7302_lvgl_impl.c
user_tasks.c
fonts/jf_dot_jiskan24_2000.c
fonts/jf_dot_jiskan16.c
images/pixiv_87209173.c
tasks/task_lvgl.c
tasks/task_hello.c
lib/st75256_lcd/st75256_lcd.c
lib/st7302_lcd/st7302_lcd.c
lib/LittleVGL/src/lv_themes/lv_theme.c
lib/LittleVGL/src/lv_themes/lv_theme_empty.c
lib/LittleVGL/src/lv_themes/lv_theme_material.c
lib/LittleVGL/src/lv_themes/lv_theme_mono.c
lib/LittleVGL/src/lv_themes/lv_theme_template.c
lib/LittleVGL/src/lv_core/lv_indev.c
lib/LittleVGL/src/lv_core/lv_refr.c
lib/LittleVGL/src/lv_core/lv_style.c
lib/LittleVGL/src/lv_core/lv_obj.c
lib/LittleVGL/src/lv_core/lv_disp.c
lib/LittleVGL/src/lv_core/lv_group.c
lib/LittleVGL/src/lv_gpu/lv_gpu_nxp_pxp_osa.c
lib/LittleVGL/src/lv_gpu/lv_gpu_stm32_dma2d.c
lib/LittleVGL/src/lv_gpu/lv_gpu_nxp_pxp.c
lib/LittleVGL/src/lv_gpu/lv_gpu_nxp_vglite.c
lib/LittleVGL/src/lv_misc/lv_gc.c
lib/LittleVGL/src/lv_misc/lv_log.c
lib/LittleVGL/src/lv_misc/lv_printf.c
lib/LittleVGL/src/lv_misc/lv_bidi.c
lib/LittleVGL/src/lv_misc/lv_ll.c
lib/LittleVGL/src/lv_misc/lv_mem.c
lib/LittleVGL/src/lv_misc/lv_templ.c
lib/LittleVGL/src/lv_misc/lv_fs.c
lib/LittleVGL/src/lv_misc/lv_txt_ap.c
lib/LittleVGL/src/lv_misc/lv_txt.c
lib/LittleVGL/src/lv_misc/lv_task.c
lib/LittleVGL/src/lv_misc/lv_async.c
lib/LittleVGL/src/lv_misc/lv_math.c
lib/LittleVGL/src/lv_misc/lv_utils.c
lib/LittleVGL/src/lv_misc/lv_area.c
lib/LittleVGL/src/lv_misc/lv_debug.c
lib/LittleVGL/src/lv_misc/lv_anim.c
lib/LittleVGL/src/lv_misc/lv_color.c
lib/LittleVGL/src/lv_widgets/lv_objx_templ.c
lib/LittleVGL/src/lv_widgets/lv_table.c
lib/LittleVGL/src/lv_widgets/lv_btnmatrix.c
lib/LittleVGL/src/lv_widgets/lv_imgbtn.c
lib/LittleVGL/src/lv_widgets/lv_page.c
lib/LittleVGL/src/lv_widgets/lv_slider.c
lib/LittleVGL/src/lv_widgets/lv_cont.c
lib/LittleVGL/src/lv_widgets/lv_spinner.c
lib/LittleVGL/src/lv_widgets/lv_keyboard.c
lib/LittleVGL/src/lv_widgets/lv_list.c
lib/LittleVGL/src/lv_widgets/lv_label.c
lib/LittleVGL/src/lv_widgets/lv_bar.c
lib/LittleVGL/src/lv_widgets/lv_img.c
lib/LittleVGL/src/lv_widgets/lv_textarea.c
lib/LittleVGL/src/lv_widgets/lv_roller.c
lib/LittleVGL/src/lv_widgets/lv_chart.c
lib/LittleVGL/src/lv_widgets/lv_calendar.c
lib/LittleVGL/src/lv_widgets/lv_checkbox.c
lib/LittleVGL/src/lv_widgets/lv_linemeter.c
lib/LittleVGL/src/lv_widgets/lv_cpicker.c
lib/LittleVGL/src/lv_widgets/lv_tabview.c
lib/LittleVGL/src/lv_widgets/lv_led.c
lib/LittleVGL/src/lv_widgets/lv_switch.c
lib/LittleVGL/src/lv_widgets/lv_canvas.c
lib/LittleVGL/src/lv_widgets/lv_line.c
lib/LittleVGL/src/lv_widgets/lv_objmask.c
lib/LittleVGL/src/lv_widgets/lv_tileview.c
lib/LittleVGL/src/lv_widgets/lv_win.c
lib/LittleVGL/src/lv_widgets/lv_arc.c
lib/LittleVGL/src/lv_widgets/lv_btn.c
lib/LittleVGL/src/lv_widgets/lv_gauge.c
lib/LittleVGL/src/lv_widgets/lv_dropdown.c
lib/LittleVGL/src/lv_widgets/lv_msgbox.c
lib/LittleVGL/src/lv_widgets/lv_spinbox.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_34.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_38.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_32.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_26.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_22.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_24.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_46.c
lib/LittleVGL/src/lv_font/lv_font_dejavu_16_persian_hebrew.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_18.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_8.c
lib/LittleVGL/src/lv_font/lv_font_loader.c
lib/LittleVGL/src/lv_font/lv_font_simsun_16_cjk.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_30.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_36.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_48.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_12_subpx.c
lib/LittleVGL/src/lv_font/lv_font.c
lib/LittleVGL/src/lv_font/lv_font_unscii_8.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_42.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_40.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_12.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_10.c
lib/LittleVGL/src/lv_font/lv_font_fmt_txt.c
lib/LittleVGL/src/lv_font/lv_font_unscii_16.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_28.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_14.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_28_compressed.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_44.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_16.c
lib/LittleVGL/src/lv_font/lv_font_montserrat_20.c
lib/LittleVGL/src/lv_draw/lv_draw_triangle.c
lib/LittleVGL/src/lv_draw/lv_draw_img.c
lib/LittleVGL/src/lv_draw/lv_img_buf.c
lib/LittleVGL/src/lv_draw/lv_draw_arc.c
lib/LittleVGL/src/lv_draw/lv_draw_mask.c
lib/LittleVGL/src/lv_draw/lv_img_decoder.c
lib/LittleVGL/src/lv_draw/lv_draw_rect.c
lib/LittleVGL/src/lv_draw/lv_draw_line.c
lib/LittleVGL/src/lv_draw/lv_draw_blend.c
lib/LittleVGL/src/lv_draw/lv_draw_label.c
lib/LittleVGL/src/lv_draw/lv_img_cache.c
lib/LittleVGL/src/lv_hal/lv_hal_disp.c
lib/LittleVGL/src/lv_hal/lv_hal_indev.c
lib/LittleVGL/src/lv_hal/lv_hal_tick.c
"main.c"
"st75256_impl.c"
"st7302_impl.c"
"st75256_lvgl_impl.c"
"st7302_lvgl_impl.c"
"user_tasks.c"
"fonts/jf_dot_jiskan24_2000.c"
"fonts/jf_dot_jiskan16.c"
"fonts/unica_one_12.c"
"images/pixiv_87209173.c"
"tasks/task_lvgl.c"
"tasks/task_hello.c"
"tasks/task_load.c"
"lib/st75256_lcd/st75256_lcd.c"
"lib/st7302_lcd/st7302_lcd.c"
)
include_directories(
include
lib/st75256_lcd
lib/st7302_lcd
lib/LittleVGL
set(C_INCLUDES
"include"
"lib/st75256_lcd"
"lib/st7302_lcd"
"lib/LittleVGL"
)
add_definitions(-DLV_CONF_SIMPLE -D_GNU_SOURCE)
set(C_DEFINES
"_GNU_SOURCE"
"LV_LVGL_H_INCLUDE_SIMPLE"
)
set(C_LIBRARIES
"gpiod"
"pthread"
"st7302"
"lvgl"
)
set(LVGL_DEFINES
"LV_CONF_INCLUDE_SIMPLE"
)
add_subdirectory(lib)
add_executable(lcd_jlx ${SOURCES})
target_link_libraries(lcd_jlx gpiod pthread)
target_link_libraries(lcd_jlx ${C_LIBRARIES})
target_include_directories(lcd_jlx PRIVATE ${C_INCLUDES})
target_compile_definitions(lcd_jlx PRIVATE ${C_DEFINES})

14
aarch64-buildroot.cmake Normal file
View File

@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSROOT $ENV{BUILDROOT_SDK_PATH}/aarch64-buildroot-linux-gnu/sysroot)
set(CMAKE_C_COMPILER $ENV{BUILDROOT_SDK_PATH}/bin/aarch64-buildroot-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER $ENV{BUILDROOT_SDK_PATH}/bin/aarch64-buildroot-linux-gnu-g++)
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

552
fonts/unica_one_12.c Normal file
View File

@ -0,0 +1,552 @@
/*******************************************************************************
* Size: 12 px
* Bpp: 1
* Opts:
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef UNICA_ONE_12
#define UNICA_ONE_12 1
#endif
#if UNICA_ONE_12
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
0x0,
/* U+0021 "!" */
0xf9,
/* U+0022 "\"" */
0xb4,
/* U+0023 "#" */
0x24, 0x49, 0xf9, 0x22, 0x5f, 0xd2, 0x24,
/* U+0024 "$" */
0x2f, 0xbb, 0x62, 0x3b, 0xf2,
/* U+0025 "%" */
0x13, 0x4d, 0x38, 0xe0, 0xf3, 0x55, 0x5d, 0x0,
/* U+0026 "&" */
0xf4, 0xa1, 0xf9, 0x4a, 0x5e,
/* U+0027 "'" */
0xc0,
/* U+0028 "(" */
0x6a, 0xaa, 0x90,
/* U+0029 ")" */
0x95, 0x55, 0x60,
/* U+002A "*" */
0x5e, 0x80,
/* U+002B "+" */
0x21, 0x3e, 0x40,
/* U+002C "," */
0xe0,
/* U+002D "-" */
0xf0,
/* U+002E "." */
0x80,
/* U+002F "/" */
0x29, 0x24, 0xa4, 0x90,
/* U+0030 "0" */
0xf9, 0x99, 0x99, 0x9f,
/* U+0031 "1" */
0x6a, 0x22, 0x22, 0x27,
/* U+0032 "2" */
0xf9, 0x92, 0x24, 0x8f,
/* U+0033 "3" */
0xf9, 0x16, 0x19, 0x9f,
/* U+0034 "4" */
0x11, 0x94, 0xa9, 0x7c, 0x42,
/* U+0035 "5" */
0xf8, 0x8f, 0x19, 0x9f,
/* U+0036 "6" */
0xf9, 0x8f, 0x99, 0x9f,
/* U+0037 "7" */
0xf1, 0x12, 0x22, 0x44,
/* U+0038 "8" */
0xf9, 0x96, 0x99, 0x9f,
/* U+0039 "9" */
0xf9, 0x99, 0xf1, 0x9f,
/* U+003A ":" */
0x84,
/* U+003B ";" */
0x8e,
/* U+003C "<" */
0x34, 0xc2,
/* U+003D "=" */
0xf0, 0xf0,
/* U+003E ">" */
0xc2, 0x34,
/* U+003F "?" */
0xf6, 0x94, 0x82,
/* U+0040 "@" */
0x7a, 0x3f, 0xf3, 0x8f, 0xfc, 0xb3, 0xfd, 0xe0,
/* U+0041 "A" */
0x31, 0x94, 0xa5, 0x3d, 0x31,
/* U+0042 "B" */
0xf9, 0x9e, 0x99, 0x9f,
/* U+0043 "C" */
0xf9, 0x98, 0x88, 0x9f,
/* U+0044 "D" */
0xf9, 0x99, 0x99, 0x9f,
/* U+0045 "E" */
0xf8, 0x88, 0xe8, 0x8f,
/* U+0046 "F" */
0xf2, 0x4f, 0x24,
/* U+0047 "G" */
0xf9, 0x88, 0xb9, 0x9f,
/* U+0048 "H" */
0x99, 0x99, 0xf9, 0x99,
/* U+0049 "I" */
0xe9, 0x24, 0x97,
/* U+004A "J" */
0x64, 0x92, 0x6f,
/* U+004B "K" */
0x9a, 0xac, 0xca, 0xa9,
/* U+004C "L" */
0x92, 0x49, 0x27,
/* U+004D "M" */
0x8e, 0xf7, 0xbe, 0xd6, 0xb1,
/* U+004E "N" */
0x99, 0xdd, 0xdb, 0x99,
/* U+004F "O" */
0xf9, 0x99, 0x99, 0x9f,
/* U+0050 "P" */
0xe9, 0x99, 0x9f, 0x88,
/* U+0051 "Q" */
0xf9, 0x99, 0x99, 0x99, 0x62,
/* U+0052 "R" */
0xf9, 0x99, 0xea, 0x99,
/* U+0053 "S" */
0xf9, 0x94, 0x29, 0x9f,
/* U+0054 "T" */
0xf9, 0x8, 0x42, 0x10, 0x84,
/* U+0055 "U" */
0x99, 0x99, 0x99, 0x9f,
/* U+0056 "V" */
0x8a, 0x52, 0x95, 0x18, 0xc6,
/* U+0057 "W" */
0x93, 0x6a, 0xd5, 0xab, 0x59, 0xb3, 0x26,
/* U+0058 "X" */
0x4a, 0x8c, 0x42, 0x29, 0x49,
/* U+0059 "Y" */
0x8c, 0x94, 0xa2, 0x10, 0x84,
/* U+005A "Z" */
0xf1, 0x22, 0x44, 0x8f,
/* U+005B "[" */
0xea, 0xaa, 0xc0,
/* U+005C "\\" */
0x92, 0x44, 0x92, 0x44,
/* U+005D "]" */
0xd5, 0x55, 0xc0,
/* U+005E "^" */
0x66, 0x90,
/* U+005F "_" */
0xf8,
/* U+0060 "`" */
0x90,
/* U+0061 "a" */
0xf9, 0x1f, 0x99, 0x9f,
/* U+0062 "b" */
0xf9, 0x9e, 0x99, 0x9f,
/* U+0063 "c" */
0xf9, 0x98, 0x88, 0x9f,
/* U+0064 "d" */
0xf9, 0x99, 0x99, 0x9f,
/* U+0065 "e" */
0xf9, 0x9f, 0x89, 0x9f,
/* U+0066 "f" */
0xf2, 0x4f, 0x24,
/* U+0067 "g" */
0xf9, 0x88, 0xb9, 0x9f,
/* U+0068 "h" */
0x99, 0x99, 0xf9, 0x99,
/* U+0069 "i" */
0xff,
/* U+006A "j" */
0x24, 0x93, 0x6f,
/* U+006B "k" */
0x9a, 0xac, 0xca, 0xa9,
/* U+006C "l" */
0x92, 0x49, 0x27,
/* U+006D "m" */
0xef, 0x26, 0x4c, 0x99, 0x32, 0x64, 0xc9,
/* U+006E "n" */
0xf9, 0x99, 0x99, 0x99,
/* U+006F "o" */
0xf9, 0x99, 0x99, 0x9f,
/* U+0070 "p" */
0xe9, 0x99, 0x9f, 0x88,
/* U+0071 "q" */
0xf4, 0xa5, 0x29, 0x4a, 0x5c, 0x18,
/* U+0072 "r" */
0xf6, 0xc9, 0x24,
/* U+0073 "s" */
0xf9, 0x94, 0x29, 0x9f,
/* U+0074 "t" */
0xf2, 0x49, 0x6f,
/* U+0075 "u" */
0x99, 0x99, 0x99, 0x9f,
/* U+0076 "v" */
0x8a, 0x52, 0x95, 0x18, 0xc6,
/* U+0077 "w" */
0x93, 0x26, 0x4c, 0x99, 0x32, 0x64, 0xf7,
/* U+0078 "x" */
0x4a, 0x8c, 0x42, 0x29, 0x49,
/* U+0079 "y" */
0x8c, 0x63, 0x18, 0xb8, 0x84,
/* U+007A "z" */
0xf1, 0x22, 0x44, 0x8f,
/* U+007B "{" */
0x29, 0x25, 0x12, 0x4c,
/* U+007C "|" */
0xff, 0xc0,
/* U+007D "}" */
0x89, 0x24, 0x52, 0x58,
/* U+007E "~" */
0xf0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 44, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1, .adv_w = 56, .box_w = 1, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2, .adv_w = 79, .box_w = 3, .box_h = 2, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 3, .adv_w = 121, .box_w = 7, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 10, .adv_w = 98, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 15, .adv_w = 125, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 23, .adv_w = 98, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 28, .adv_w = 50, .box_w = 1, .box_h = 2, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 29, .adv_w = 62, .box_w = 2, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 32, .adv_w = 62, .box_w = 2, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 35, .adv_w = 73, .box_w = 3, .box_h = 3, .ofs_x = 1, .ofs_y = 5},
{.bitmap_index = 37, .adv_w = 98, .box_w = 5, .box_h = 4, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 40, .adv_w = 50, .box_w = 1, .box_h = 3, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 41, .adv_w = 94, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 42, .adv_w = 50, .box_w = 1, .box_h = 1, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 43, .adv_w = 73, .box_w = 3, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 47, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 51, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 55, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 59, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 63, .adv_w = 98, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 68, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 72, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 76, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 80, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 84, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 88, .adv_w = 50, .box_w = 1, .box_h = 6, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 89, .adv_w = 50, .box_w = 1, .box_h = 7, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 90, .adv_w = 98, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 92, .adv_w = 98, .box_w = 4, .box_h = 3, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 94, .adv_w = 98, .box_w = 4, .box_h = 4, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 96, .adv_w = 84, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 99, .adv_w = 143, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 107, .adv_w = 92, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 112, .adv_w = 97, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 116, .adv_w = 94, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 120, .adv_w = 97, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 124, .adv_w = 85, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 128, .adv_w = 80, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 131, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 135, .adv_w = 103, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 139, .adv_w = 60, .box_w = 3, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 142, .adv_w = 73, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 145, .adv_w = 87, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 149, .adv_w = 72, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 152, .adv_w = 123, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 157, .adv_w = 107, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 161, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 165, .adv_w = 88, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 169, .adv_w = 98, .box_w = 4, .box_h = 10, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 174, .adv_w = 93, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 178, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 182, .adv_w = 75, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 187, .adv_w = 100, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 191, .adv_w = 92, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 196, .adv_w = 131, .box_w = 7, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 203, .adv_w = 87, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 208, .adv_w = 86, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 213, .adv_w = 80, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 217, .adv_w = 62, .box_w = 2, .box_h = 9, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 220, .adv_w = 73, .box_w = 3, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 224, .adv_w = 62, .box_w = 2, .box_h = 9, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 227, .adv_w = 98, .box_w = 4, .box_h = 3, .ofs_x = 1, .ofs_y = 5},
{.bitmap_index = 229, .adv_w = 81, .box_w = 5, .box_h = 1, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 230, .adv_w = 61, .box_w = 2, .box_h = 2, .ofs_x = 1, .ofs_y = 8},
{.bitmap_index = 231, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 235, .adv_w = 97, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 239, .adv_w = 94, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 243, .adv_w = 97, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 247, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 251, .adv_w = 80, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 254, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 258, .adv_w = 103, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 262, .adv_w = 52, .box_w = 1, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 263, .adv_w = 73, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 266, .adv_w = 87, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 270, .adv_w = 72, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 273, .adv_w = 148, .box_w = 7, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 280, .adv_w = 101, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 284, .adv_w = 98, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 288, .adv_w = 88, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 292, .adv_w = 98, .box_w = 5, .box_h = 9, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 298, .adv_w = 77, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 301, .adv_w = 96, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 305, .adv_w = 72, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 308, .adv_w = 101, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 312, .adv_w = 92, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 317, .adv_w = 146, .box_w = 7, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 324, .adv_w = 87, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 329, .adv_w = 90, .box_w = 5, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 334, .adv_w = 80, .box_w = 4, .box_h = 8, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 338, .adv_w = 62, .box_w = 3, .box_h = 10, .ofs_x = 0, .ofs_y = -1},
{.bitmap_index = 342, .adv_w = 52, .box_w = 1, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 344, .adv_w = 62, .box_w = 3, .box_h = 10, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 348, .adv_w = 98, .box_w = 4, .box_h = 1, .ofs_x = 1, .ofs_y = 3}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
}
};
/*-----------------
* KERNING
*----------------*/
/*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
34, 53,
34, 55,
34, 56,
34, 58,
34, 87,
39, 34,
39, 43,
39, 75,
45, 53,
45, 55,
45, 56,
45, 58,
45, 87,
45, 90,
49, 34,
49, 75,
53, 34,
53, 43,
55, 34,
55, 43,
56, 34,
56, 43,
58, 34,
58, 43,
71, 34,
71, 43,
71, 75,
77, 53,
77, 55,
77, 56,
77, 58,
77, 87,
77, 90,
81, 34,
81, 75,
83, 43,
83, 75,
87, 34,
87, 43
};
/* Kerning between the respective left and right glyphs
* 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] =
{
-12, -4, -4, -8, -4, -8, -10, -9,
-12, -8, -8, -10, -8, -9, -4, -10,
-8, -11, -4, -11, -4, -11, -8, -10,
-8, -10, -9, -12, -8, -8, -10, -8,
-9, -4, -10, -4, -10, -4, -11
};
/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs =
{
.glyph_ids = kern_pair_glyph_ids,
.values = kern_pair_values,
.pair_cnt = 39,
.glyph_ids_size = 0
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = &kern_pairs,
.kern_scale = 16,
.cmap_num = 1,
.bpp = 1,
.kern_classes = 0,
.bitmap_format = 0,
#if LV_VERSION_CHECK(8, 0, 0)
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t unica_one_12 = {
#else
lv_font_t unica_one_12 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 12, /*The maximum line height required by the font*/
.base_line = 2, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0)
.underline_position = -1,
.underline_thickness = 1,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if UNICA_ONE_12*/

View File

@ -418,7 +418,8 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
* LV_FONT_DECLARE(my_font_2)
*/
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(jf_dot_jiskan24_2000) \
LV_FONT_DECLARE(jf_dot_jiskan16)
LV_FONT_DECLARE(jf_dot_jiskan16) \
LV_FONT_DECLARE(unica_one_12)
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp

View File

@ -19,4 +19,9 @@ int hello_task_deinit(void);
extern pthread_t hello_thread_handle;
void *hello_thread(void *arguments);
int load_task_init(void);
int load_task_deinit(void);
extern pthread_t load_thread_handle;
void *load_thread(void *arguments);
#endif

View File

@ -0,0 +1,20 @@
# Note: LittleVGL officially supports Zephyr and ESP-IDF, we are neither.
file(GLOB_RECURSE LVGL_SOURCES
"LittleVGL/src/*.c"
)
set(LVGL_INCLUDES
"../include"
)
add_library(lvgl STATIC ${LVGL_SOURCES})
target_include_directories(lvgl PRIVATE ${LVGL_INCLUDES})
target_compile_definitions(lvgl PRIVATE ${LVGL_DEFINES})
set(ST7302_LCD_SOURCES
"st7302_lcd/st7302_lcd.c"
)
add_library(st7302 STATIC ${ST7302_LCD_SOURCES})

View File

@ -21,6 +21,27 @@ uint8_t st7302_gd_unknown_init_sequence[] = {
0x02, 0x2B, 0x00, 0x7C, // Row Address Setting
};
uint8_t st7302_gd_unknown_hpm_init_sequence[] = {
0x01, 0xEB, 0x02, // Enable OTP
0x01, 0xD7, 0x68, // OTP Load Control
0x01, 0xD1, 0x01, // Auto Power Control
0x01, 0xC0, 0xF6, // Gate Voltage setting
0x06, 0xC1, 0x28, 0x28, 0x28, 0x28, 0x14, 0x00, // VSH Setting
0x04, 0xC2, 0x06, 0x06, 0x06, 0x06, // VSL Setting
0x01, 0xCB, 0x08, // VCOMH Setting
0x01, 0xB3, 0x94, // VCOM EQ Enable
0x0A, 0xB4, 0xE5, 0x66, 0xFD, 0xFF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x7F, // Gate EQ
0x02, 0xC7, 0xA6, 0xE9, // OSC Setting
0x01, 0xB0, 0x3F, // Duty Setting
0x02, 0xB2, 0x00, 0x05, // Frame Rate Setting
0x01, 0x36, 0x20, // Memory Access Mode
0x01, 0x3A, 0x01, // Data Format
0x01, 0xB9, 0x23, // Source Setting
0x01, 0xB8, 0x09, // Panel Setting
0x02, 0x2A, 0x19, 0x23, // Column Address Setting
0x02, 0x2B, 0x00, 0x7C, // Row Address Setting
};
st7302_ret_t _st7302_init_seq(st7302_t *lcd) {
uint16_t i = 0;
@ -33,6 +54,8 @@ st7302_ret_t _st7302_init_seq(st7302_t *lcd) {
}
st7302_ret_t st7302_init(st7302_t *lcd) {
ST7302_ERROR_CHECK(lcd->cb.reset_cb(lcd->user_data));
ST7302_ERROR_CHECK(_st7302_init_seq(lcd));
uint8_t command[3] = {0xB2, 0x01, 0x05};
command[0] = 0x11;
@ -41,7 +64,7 @@ st7302_ret_t st7302_init(st7302_t *lcd) {
command[0] = 0x29;
ST7302_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, command, 0x01)); // Display ON
command[0] = 0x38;
command[0] = 0x39;
ST7302_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, command, 0x01)); // LPM ON
return ST7302_OK;
@ -62,4 +85,4 @@ st7302_ret_t st7302_upload(st7302_t *lcd, uint8_t col_start, uint8_t col_end, ui
uint16_t data_len = (col_end - col_start + 1) * (row_end - row_start + 1) * 3;
ST7302_ERROR_CHECK(lcd->cb.write_data_cb(lcd->user_data, data, data_len));
}
}

View File

@ -27,4 +27,4 @@ typedef struct {
st7302_ret_t st7302_init(st7302_t *lcd);
st7302_ret_t st7302_upload(st7302_t *lcd, uint8_t col_start, uint8_t col_end, uint8_t row_start, uint8_t row_end, uint8_t *data);
#endif
#endif

2
main.c
View File

@ -8,6 +8,6 @@ int main() {
user_tasks_loop();
user_tasks_deinit();
printf("Hello World!!\n");
printf("Monitor exit...\n");
return 0;
}

View File

@ -137,12 +137,12 @@ st7302_ret_t _st7302_impl_reset(void *handle) {
int ret = gpiod_line_set_value(impl->gpio_line_res, 0);
if(ret) return ST7302_ERROR;
usleep(10 * 1000);
usleep(50 * 1000);
ret = gpiod_line_set_value(impl->gpio_line_res, 1);
if(ret) return ST7302_ERROR;
usleep(10 * 1000);
usleep(200 * 1000);
return ST7302_OK;
}
@ -150,4 +150,4 @@ st7302_ret_t _st7302_impl_reset(void *handle) {
st7302_ret_t _st7302_impl_delay(void *handle, uint32_t usec) {
usleep(usec);
return ST7302_OK;
}
}

View File

@ -1,3 +1,6 @@
#include <stdio.h>
#include <time.h>
#include <stdint.h>
#include <unistd.h>
@ -23,18 +26,39 @@ void *hello_thread(void *arguments) {
lv_style_t hello_label_style;
lv_style_init(&hello_label_style);
lv_style_set_text_font(&hello_label_style, LV_STATE_DEFAULT, &jf_dot_jiskan24_2000);
lv_style_set_text_font(&hello_label_style, LV_STATE_DEFAULT, &lv_font_unscii_8);
lv_obj_t * hello_label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_long_mode(hello_label, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/
lv_label_set_anim_speed(hello_label, 1);
lv_obj_set_width(hello_label, 250);
lv_label_set_text(hello_label, "JFドットjiskan24-2000 電子情報技術産業協会 / 矢木達也氏");
lv_obj_t *hello_label = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_width(hello_label, 200);
lv_label_set_text(hello_label, "----/--/-- --:--:-- N/A");
lv_obj_add_style(hello_label, LV_LABEL_PART_MAIN, &hello_label_style);
lv_obj_align(hello_label, NULL, LV_ALIGN_CENTER, 0, 0);
lv_label_set_long_mode(hello_label, LV_LABEL_LONG_SROLL_CIRC);
lv_obj_align(hello_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
pthread_mutex_unlock(&g_lvgl_mutex);
tzset();
time_t cur_time;
struct tm *time_info;
char date_buf[25];
while(g_running) {
sleep(1);
time(&cur_time);
time_info = localtime(&cur_time); // Note: THIS IS NTS
snprintf(date_buf, 25, "%04d/%02d/%02d %02d:%02d:%02d %s",
time_info->tm_year + 1900, time_info->tm_mon + 1, time_info->tm_mday,
time_info->tm_hour, time_info->tm_min, time_info->tm_sec, tzname[0]
);
pthread_mutex_lock(&g_lvgl_mutex);
lv_label_set_text(hello_label, date_buf);
lv_obj_align(hello_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
pthread_mutex_unlock(&g_lvgl_mutex);
usleep(100 * 1000);
}
}
}

54
tasks/task_load.c Normal file
View File

@ -0,0 +1,54 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include "lvgl.h"
#include "user_tasks.h"
extern uint8_t g_running;
extern pthread_mutex_t g_lvgl_mutex;
int load_task_init(void) {
int ret = pthread_create(&load_thread_handle, NULL, load_thread, NULL);
ret = pthread_setname_np(load_thread_handle, "LOAD_THR");
}
int load_task_deinit(void) {
}
pthread_t load_thread_handle;
void *load_thread(void *arguments) {
pthread_mutex_lock(&g_lvgl_mutex);
lv_style_t load_label_style;
lv_style_init(&load_label_style);
lv_style_set_text_font(&load_label_style, LV_STATE_DEFAULT, &lv_font_unscii_8);
lv_obj_t *load_label = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_width(load_label, 150);
lv_label_set_text(load_label, "LOAD AVG. --.--/--.--/--.--");
lv_obj_add_style(load_label, LV_LABEL_PART_MAIN, &load_label_style);
lv_obj_align(load_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 8);
pthread_mutex_unlock(&g_lvgl_mutex);
double load_avg[3];
char load_buf[28];
while(g_running) {
getloadavg(load_avg, 3);
snprintf(load_buf, 28, "LOAD AVG. %02.02f/%02.02f/%02.02f",
load_avg[0], load_avg[1], load_avg[2]
);
pthread_mutex_lock(&g_lvgl_mutex);
lv_label_set_text(load_label, load_buf);
lv_obj_align(load_label, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 8);
pthread_mutex_unlock(&g_lvgl_mutex);
sleep(1);
}
}

View File

@ -20,6 +20,7 @@ void user_tasks_init(void) {
lvgl_task_init();
hello_task_init();
load_task_init();
}
void user_tasks_loop(void) {
@ -31,4 +32,5 @@ void user_tasks_loop(void) {
void user_tasks_deinit(void) {
hello_task_deinit();
lvgl_task_deinit();
load_task_deinit();
}