Initial commit.

This commit is contained in:
imi415 2021-01-21 16:55:13 +00:00
commit 3a9a9415d7
4 changed files with 87 additions and 0 deletions

16
CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.12)
project(epd_lvgl C)
set(CMAKE_C_STANDARD 11)
set(SOURCES
main.c
lib/gdew0213m21/gdew0213m21_epd.c
)
include_directories(
lib/gdew0213m21
)
add_executable(epd_lvgl ${SOURCES})

View File

@ -0,0 +1,35 @@
#include "gdew0213m21_epd.h"
uint8_t gdew0213m21_init_sequence[] = {
0x03, 0x06, 0x17, 0x17, 0x1F, // boost soft start
0x04, 0x01, 0x03, 0x00, 0x2B, 0x2B, // Power settings
0x01, 0x00, 0xBF, // Panel setting, LUT from OTP
0x01, 0x30, 0x3C,
0x03, 0x61, 0x68, 0x00, 0xD4,
0x01, 0x82, 0x12, // VCOM DC settings
0x01, 0x50, 0x47
};
des_epd_ret_t _des_epd_hardware_reset(des_epd_t *epd) {
//
}
des_epd_ret_t _des_epd_software_reset(des_epd_t *epd) {
//
}
des_epd_ret_t _des_epd_init_seq(des_epd_t *epd) {
uint16_t i = 0;
while(i < sizeof(DES_EPD_PANEL_SELECTION)) {
DES_EPD_ERROR_CHECK(epd->cb.write_cmd_cb(epd->user_data, &DES_EPD_PANEL_SELECTION[i + 1], DES_EPD_PANEL_SELECTION[i] + 1));
i += DES_EPD_PANEL_SELECTION[i] + 2;
}
return DES_EPD_OK;
}
des_epd_ret_t des_epd_init(des_epd_t *epd) {
DES_EPD_ERROR_CHECK(_des_epd_init_seq(epd));
return DES_EPD_OK;
}

View File

@ -0,0 +1,28 @@
#ifndef __GDEW0213M21_EPD_H
#define __GDEW0213M21_EPD_H
#include <stdint.h>
#define DES_EPD_PANEL_SELECTION gdew0213m21_init_sequence
typedef enum {
DES_EPD_OK,
DES_EPD_ERROR
} des_epd_ret_t;
typedef struct {
des_epd_ret_t (*write_cmd_cb)(void *handle, uint8_t *cmd, uint8_t len);
des_epd_ret_t (*write_data_cb)(void *handle, uint8_t *data, uint16_t len);
des_epd_ret_t (*reset_cb)(void *handle);
des_epd_ret_t (*check_busy_cb)(void *handle);
} des_epd_cb_t;
typedef struct {
void *user_data;
des_epd_cb_t cb;
} des_epd_t;
#define DES_EPD_ERROR_CHECK(x) if(x != DES_EPD_OK) return DES_EPD_ERROR
des_epd_ret_t des_epd_init(des_epd_t *epd);
#endif

8
main.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include "gdew0213m21_epd.h"
int main() {
printf("Hello World!\n");
return 0;
}