Image2lcd Register Code Guide

The Image2LCD code assumes you have basic read/write functions. You must define macros or functions that match the names used in the generated code (or rename the generated code to match your functions).

Common names used by Image2LCD:

Example Implementation (STM32 HAL SPI):

#define LCD_CS_LOW  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET)
#define LCD_CS_HIGH HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET)
#define LCD_DC_LOW  HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET) // Command
#define LCD_DC_HIGH HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET)   // Data
void LCD_WR_REG(uint8_t data) 
    LCD_CS_LOW;
    LCD_DC_LOW; // DC Low = Command
    HAL_SPI_Transmit(&hspi1, &data, 1, 100);
    LCD_CS_HIGH;
void LCD_WR_DATA(uint8_t data) 
    LCD_CS_LOW;
    LCD_DC_HIGH; // DC High = Data
    HAL_SPI_Transmit(&hspi1, &data, 1, 100);
    LCD_CS_HIGH;

Most tools let you:

Example custom struct format:

typedef struct 
    uint8_t cmd;
    uint8_t datalen;
    uint8_t data[8];
    uint16_t delay_ms;
 lcd_cmd_t;

When you select "Register Code" as your output type, Image2LCD does not generate a raw pixel array (const unsigned char image[] = ...). Instead, it generates a sequence of LCD controller commands followed by pixel data. image2lcd register code

Think of it this way: