From 7195fa4323b3c1bbf05c58682dd824c3fcb98a68 Mon Sep 17 00:00:00 2001 From: imi415 Date: Sun, 23 Jan 2022 16:03:07 +0800 Subject: [PATCH] ZJY 1.5" OLED --- Core/Inc/epd_impl.h | 4 ++-- Core/Src/main.c | 18 ++++++++---------- lib/epd-spi | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Core/Inc/epd_impl.h b/Core/Inc/epd_impl.h index 6416150..79aebf4 100644 --- a/Core/Inc/epd_impl.h +++ b/Core/Inc/epd_impl.h @@ -1,9 +1,9 @@ #ifndef EPD_IMPL_H #define EPD_IMPL_H -#include "epd_common.h" +#include "epd-spi/epd_common.h" -#define EPD_IMPL_CMD_DC_CHANGE_AT_PARAM 1 +#define EPD_IMPL_CMD_DC_CHANGE_AT_PARAM 0 int epd_impl_init(void); epd_ret_t epd_impl_reset_cb(void *handle); diff --git a/Core/Src/main.c b/Core/Src/main.c index 22a4aa7..1d273f0 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -27,7 +27,7 @@ #include #include #include "epd_impl.h" -#include "lcd_panel_jlx256128g_920.h" +#include "epd-spi/panel/oled_zjy150s700.h" /* USER CODE END Includes */ @@ -409,17 +409,13 @@ static void MX_GPIO_Init(void) /* USER CODE BEGIN 4 */ -static lcd_jlx256128g_t s_lcd = { +static oled_zjy150s700_t s_oled = { .cb = { .reset_cb = epd_impl_reset_cb, .write_command_cb = epd_impl_write_cmd_cb, .write_data_cb = epd_impl_write_data_cb, }, .user_data = NULL, - .config = { - .contrast = 310, - .mode = LCD_JLX256128G_MODE_GS, - }, }; static uint8_t s_frame[8192]; @@ -437,14 +433,14 @@ void StartDefaultTask(void *argument) { /* USER CODE BEGIN 5 */ epd_impl_init(); - lcd_jlx256128g_init(&s_lcd); + oled_zjy150s700_init(&s_oled); memset(s_frame, 0x00, 256); memset(&s_frame[256], 0x55, 256); memset(&s_frame[512], 0xAA, 256); memset(&s_frame[768], 0xFF, 256); - lcd_jlx256128g_upload(&s_lcd, NULL, s_frame); + oled_zjy150s700_upload(&s_oled, NULL, s_frame); osDelay(1000); @@ -454,7 +450,7 @@ void StartDefaultTask(void *argument) } FIL apple_fd; - if(f_open(&apple_fd, "0:/apple/apple_st75256.bin", FA_READ) != FR_OK) { + if(f_open(&apple_fd, "0:/apple/apple_ssd1327.bin", FA_READ) != FR_OK) { printf("Apple not found.\r\n"); goto dead_loop; } @@ -465,7 +461,7 @@ void StartDefaultTask(void *argument) if(f_read(&apple_fd, s_frame, 8192, &br) != FR_OK) { printf("Read failed.\r\n"); } - lcd_jlx256128g_upload(&s_lcd, NULL, s_frame); + oled_zjy150s700_upload(&s_oled, NULL, s_frame); HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin); uint32_t frame_end = osKernelGetTickCount(); if(frame_end - frame_start < 33) { @@ -476,6 +472,8 @@ void StartDefaultTask(void *argument) dead_loop: osDelay(5000); + oled_zjy150s700_power(&s_oled, 0); + /* Infinite loop */ for(;;) { diff --git a/lib/epd-spi b/lib/epd-spi index 3d49780..cdd4834 160000 --- a/lib/epd-spi +++ b/lib/epd-spi @@ -1 +1 @@ -Subproject commit 3d497800bbb4a069a62d989623ab16ce550ab312 +Subproject commit cdd4834ea6ba351f5a9d588231a5f375290e2519