#include "st7302_lcd.h" #include "stm32h7xx_hal.h" uint8_t st7302_gd_unknown_init_sequence[] = { 0x01, 0xEB, 0x02, // Enable OTP 0x01, 0xD7, 0x68, // OTP Load Control 0x01, 0xD1, 0x01, // Auto Power Control 0x01, 0xC0, 0x40, // Gate Voltage setting 0x06, 0xC1, 0x22, 0x22, 0x22, 0x22, 0x14, 0x00, // VSH Setting 0x04, 0xC2, 0x00, 0x00, 0x00, 0x00, // VSL Setting 0x01, 0xCB, 0x0E, // VCOMH Setting 0x0A, 0xB4, 0xE5, 0x66, 0x85, 0xFF, 0xFF, 0x52, 0x85, 0xFF, 0xFF, 0x52, // Gate EQ 0x02, 0xC7, 0xA6, 0xE9, // OSC Setting 0x01, 0xB0, 0x3F, // Duty Setting 0x01, 0x36, 0x00, // Memory Access Mode 0x01, 0x3A, 0x11, // Data Format 0x01, 0xB9, 0x23, // Source Setting 0x01, 0xB8, 0x09, // Source 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; while(i < sizeof(ST7302_PANEL_SELECTION)) { ST7302_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, &ST7302_PANEL_SELECTION[i + 1], ST7302_PANEL_SELECTION[i] + 1)); i += ST7302_PANEL_SELECTION[i] + 2; } return ST7302_OK; } st7302_ret_t st7302_init(st7302_t *lcd) { ST7302_ERROR_CHECK(_st7302_init_seq(lcd)); uint8_t command[3] = {0xB2, 0x01, 0x05}; command[0] = 0x11; ST7302_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, command, 0x01)); // Sleep Out HAL_Delay(100); command[0] = 0x29; ST7302_ERROR_CHECK(lcd->cb.write_cmd_cb(lcd->user_data, command, 0x01)); // Display ON return ST7302_OK; }